clang 22.0.0git
|
#include "clang/AST/Attr.h"
#include "clang/AST/CharUnits.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/Analysis/AnalysisDeclContext.h"
#include "clang/Basic/JsonSupport.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h"
#include "llvm/ADT/ImmutableMap.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/TimeProfiler.h"
#include "llvm/Support/raw_ostream.h"
#include <limits>
#include <optional>
#include <utility>
Go to the source code of this file.
Classes | |
class | LimitedRegionBindingsRef |
This class represents the same as RegionBindingsRef , but with a limit on the number of bindings that can be added. More... |
Namespaces | |
namespace | llvm |
Diagnostic wrappers for TextAPI types for error reporting. |
Typedefs | |
typedef llvm::ImmutableMap< BindingKey, SVal > | ClusterBindings |
typedef llvm::ImmutableMapRef< BindingKey, SVal > | ClusterBindingsRef |
typedef std::pair< BindingKey, SVal > | BindingPair |
typedef llvm::ImmutableMap< const MemRegion *, ClusterBindings > | RegionBindings |
typedef const RegionBindingsRef & | RegionBindingsConstRef |
typedef const LimitedRegionBindingsRef & | LimitedRegionBindingsConstRef |
typedef SmallVector< const FieldDecl *, 8 > | FieldVector |
Functions | |
static raw_ostream & | llvm::operator<< (raw_ostream &Out, BindingKey K) |
static bool | isUnionField (const FieldRegion *FR) |
static void | getSymbolicOffsetFields (BindingKey K, FieldVector &Fields) |
static bool | isCompatibleWithFields (BindingKey K, const FieldVector &Fields) |
static void | collectSubRegionBindings (SmallVectorImpl< BindingPair > &Bindings, SValBuilder &SVB, const ClusterBindings &Cluster, const SubRegion *Top, BindingKey TopKey, bool IncludeAllDefaultBindings) |
Collects all bindings in Cluster that may refer to bindings within Top . | |
static void | collectSubRegionBindings (SmallVectorImpl< BindingPair > &Bindings, SValBuilder &SVB, const ClusterBindings &Cluster, const SubRegion *Top, bool IncludeAllDefaultBindings) |
static QualType | getUnderlyingType (const SubRegion *R) |
static std::optional< nonloc::LazyCompoundVal > | getExistingLazyBinding (SValBuilder &SVB, RegionBindingsConstRef B, const SubRegion *R, bool AllowSubregionBindings) |
Checks to see if store B has a lazy binding for region R . | |
static SmallVector< uint64_t, 2 > | getConstantArrayExtents (const ConstantArrayType *CAT) |
This is a helper function for getConstantValFromConstArrayInitializer. | |
static std::pair< SmallVector< SVal, 2 >, const MemRegion * > | getElementRegionOffsetsWithBase (const ElementRegion *ER) |
This is a helper function for getConstantValFromConstArrayInitializer. | |
static std::optional< SVal > | convertOffsetsFromSvalToUnsigneds (const SmallVector< SVal, 2 > &SrcOffsets, const SmallVector< uint64_t, 2 > ArrayExtents, SmallVector< uint64_t, 2 > &DstOffsets) |
static std::optional< SVal > | getDerivedSymbolForBinding (RegionBindingsConstRef B, const TypedValueRegion *BaseRegion, const TypedValueRegion *SubReg, const ASTContext &Ctx, SValBuilder &SVB) |
typedef std::pair<BindingKey, SVal> BindingPair |
Definition at line 160 of file RegionStore.cpp.
typedef llvm::ImmutableMap<BindingKey, SVal> ClusterBindings |
Definition at line 158 of file RegionStore.cpp.
typedef llvm::ImmutableMapRef<BindingKey, SVal> ClusterBindingsRef |
Definition at line 159 of file RegionStore.cpp.
typedef SmallVector<const FieldDecl *, 8> FieldVector |
Definition at line 978 of file RegionStore.cpp.
typedef const LimitedRegionBindingsRef& LimitedRegionBindingsConstRef |
Definition at line 403 of file RegionStore.cpp.
typedef llvm::ImmutableMap<const MemRegion *, ClusterBindings> RegionBindings |
Definition at line 163 of file RegionStore.cpp.
typedef const RegionBindingsRef& RegionBindingsConstRef |
Definition at line 402 of file RegionStore.cpp.
|
static |
Collects all bindings in Cluster
that may refer to bindings within Top
.
Each binding is a pair whose first
is the key (a BindingKey) and whose second
is the value (an SVal).
The IncludeAllDefaultBindings
parameter specifies whether to include default bindings that may extend beyond Top
itself, e.g. if Top
is an aggregate within a larger aggregate with a default binding.
Definition at line 1024 of file RegionStore.cpp.
References clang::ento::SVal::getAs(), clang::ASTContext::getCharWidth(), clang::ento::SValBuilder::getContext(), clang::ento::SubRegion::getMemRegionManager(), clang::ento::MemRegionManager::getStaticSize(), getSymbolicOffsetFields(), isCompatibleWithFields(), and clang::ento::SubRegion::isSubRegionOf().
Referenced by collectSubRegionBindings(), and getExistingLazyBinding().
|
static |
Definition at line 1095 of file RegionStore.cpp.
References collectSubRegionBindings().
|
static |
Definition at line 1832 of file RegionStore.cpp.
References V.
|
static |
This is a helper function for getConstantValFromConstArrayInitializer.
Return an array of extents of the declared array type.
E.g. for int x[1][2][3]; returns { 1, 2, 3 }.
Definition at line 1773 of file RegionStore.cpp.
References clang::cast(), clang::Type::getCanonicalTypeInternal(), clang::ArrayType::getElementType(), and clang::ConstantArrayType::getZExtSize().
|
static |
Definition at line 2045 of file RegionStore.cpp.
References clang::ento::SValBuilder::getDerivedRegionValueSymbolVal(), clang::ASTContext::getTypeSizeInChars(), clang::ento::TypedValueRegion::getValueType(), and clang::Type::isScalarType().
|
static |
This is a helper function for getConstantValFromConstArrayInitializer.
Return an array of offsets from nested ElementRegions and a root base region. The array is never empty and a base region is never null.
E.g. for Element{Element{Element{VarRegion},1},2},3} returns { 3, 2, 1 }. This represents an access through indirection: arr[1][2][3];
ER | The given (possibly nested) ElementRegion. |
Definition at line 1798 of file RegionStore.cpp.
References clang::ento::ElementRegion::getIndex(), and clang::ento::SubRegion::getSuperRegion().
|
static |
Checks to see if store B
has a lazy binding for region R
.
If AllowSubregionBindings
is false
, a lazy binding will be rejected if there are additional bindings within R
.
Note that unlike RegionStoreManager::findLazyBinding, this will not search for lazy bindings for super-regions of R
.
Definition at line 1691 of file RegionStore.cpp.
References collectSubRegionBindings(), clang::ento::MemRegion::getBaseRegion(), clang::ento::SValBuilder::getContext(), getUnderlyingType(), clang::ASTContext::hasSameUnqualifiedType(), clang::QualType::isNull(), clang::Type::isVoidPointerType(), and V.
|
static |
Definition at line 980 of file RegionStore.cpp.
References clang::cast(), and isUnionField().
Referenced by collectSubRegionBindings(), and isCompatibleWithFields().
Definition at line 1672 of file RegionStore.cpp.
Referenced by clang::PredefinedExpr::ComputeName(), getExistingLazyBinding(), IsStructurallyEquivalent(), and MarkUsedTemplateParameters().
|
static |
Definition at line 995 of file RegionStore.cpp.
References getSymbolicOffsetFields().
Referenced by collectSubRegionBindings().
|
inlinestatic |
Definition at line 974 of file RegionStore.cpp.
References clang::ento::FieldRegion::getDecl(), clang::FieldDecl::getParent(), and clang::TagDecl::isUnion().
Referenced by getSymbolicOffsetFields().