class FindUninitializedFields
Declaration
class FindUninitializedFields { /* full declaration omitted */ };
Description
Searches for and stores uninitialized fields in a non-union object.
Declared at: clang/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObject.h:197
Member Variables
- private clang::ento::ProgramStateRef State
- private const clang::ento::TypedValueRegion* const ObjectR
- private const clang::ento::UninitObjCheckerOptions Opts
- private bool IsAnyFieldInitialized = false
- private FieldChainInfo::FieldChain::Factory ChainFactory
- private clang::ento::UninitFieldMap UninitFields
- After analyzing `a`, the map will contain a pair for `a.x`'s region and the note message "uninitialized field 'this->x'.
Method Overview
- public FindUninitializedFields(clang::ento::ProgramStateRef State, const clang::ento::TypedValueRegion *const R, const clang::ento::UninitObjCheckerOptions & Opts)
- private bool addFieldToUninits(clang::ento::FieldChainInfo LocalChain, const clang::ento::MemRegion * PointeeR = nullptr)
- public std::pair<ProgramStateRef, const UninitFieldMap &> getResults()
- public bool isAnyFieldInitialized()
- private bool isDereferencableUninit(const clang::ento::FieldRegion * FR, clang::ento::FieldChainInfo LocalChain)
- private bool isNonUnionUninit(const clang::ento::TypedValueRegion * R, clang::ento::FieldChainInfo LocalChain)
- private bool isPrimitiveUninit(const clang::ento::SVal & V)
- private bool isUnionUninit(const clang::ento::TypedValueRegion * R)
Methods
¶FindUninitializedFields(
clang::ento::ProgramStateRef State,
const clang::ento::TypedValueRegion* const R,
const clang::ento::UninitObjCheckerOptions&
Opts)
FindUninitializedFields(
clang::ento::ProgramStateRef State,
const clang::ento::TypedValueRegion* const R,
const clang::ento::UninitObjCheckerOptions&
Opts)
Description
Constructs the FindUninitializedField object, searches for and stores uninitialized fields in R.
Declared at: clang/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObject.h:221
Parameters
- clang::ento::ProgramStateRef State
- const clang::ento::TypedValueRegion* const R
- const clang::ento::UninitObjCheckerOptions& Opts
¶bool addFieldToUninits(
clang::ento::FieldChainInfo LocalChain,
const clang::ento::MemRegion* PointeeR =
nullptr)
bool addFieldToUninits(
clang::ento::FieldChainInfo LocalChain,
const clang::ento::MemRegion* PointeeR =
nullptr)
Description
Processes LocalChain and attempts to insert it into UninitFields. Returns true on success. Also adds the head of the list and \p PointeeR (if supplied) to the GDM as already analyzed objects. Since this class analyzes regions with recursion, we'll only store references to temporary FieldNode objects created on the stack. This means that after analyzing a leaf of the directed tree described above, the elements LocalChain references will be destructed, so we can't store it directly.
Declared at: clang/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObject.h:318
Parameters
- clang::ento::FieldChainInfo LocalChain
- const clang::ento::MemRegion* PointeeR = nullptr
¶std::pair<ProgramStateRef, const UninitFieldMap&>
getResults()
std::pair<ProgramStateRef, const UninitFieldMap&>
getResults()
Description
Returns with the modified state and a map of (uninitialized region, note message) pairs.
Declared at: clang/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObject.h:227
¶bool isAnyFieldInitialized()
bool isAnyFieldInitialized()
Description
Returns whether the analyzed region contains at least one initialized field. Note that this includes subfields as well, not just direct ones, and will return false if an uninitialized pointee is found with CheckPointeeInitialization enabled.
Declared at: clang/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObject.h:235
¶bool isDereferencableUninit(
const clang::ento::FieldRegion* FR,
clang::ento::FieldChainInfo LocalChain)
bool isDereferencableUninit(
const clang::ento::FieldRegion* FR,
clang::ento::FieldChainInfo LocalChain)
Description
Checks a region of a pointer or reference object, and returns true if the ptr/ref object itself or any field within the pointee's region is uninitialized.
Declared at: clang/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObject.h:299
Parameters
- const clang::ento::FieldRegion* FR
- clang::ento::FieldChainInfo LocalChain
¶bool isNonUnionUninit(
const clang::ento::TypedValueRegion* R,
clang::ento::FieldChainInfo LocalChain)
bool isNonUnionUninit(
const clang::ento::TypedValueRegion* R,
clang::ento::FieldChainInfo LocalChain)
Description
Checks a region of a non-union object, and returns true if an uninitialized field is found within the region.
Declared at: clang/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObject.h:294
Parameters
- const clang::ento::TypedValueRegion* R
- clang::ento::FieldChainInfo LocalChain
¶bool isPrimitiveUninit(const clang::ento::SVal& V)
bool isPrimitiveUninit(const clang::ento::SVal& V)
Description
Returns true if the value of a primitive object is uninitialized.
Declared at: clang/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObject.h:302
Parameters
- const clang::ento::SVal& V
¶bool isUnionUninit(
const clang::ento::TypedValueRegion* R)
bool isUnionUninit(
const clang::ento::TypedValueRegion* R)
Description
Checks the region of a union object, and returns true if no field is initialized within the region.
Declared at: clang/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObject.h:290
Parameters
- const clang::ento::TypedValueRegion* R