clang 20.0.0git
Macros | Functions
MemRegion.cpp File Reference
#include "clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/Attr.h"
#include "clang/AST/CharUnits.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/Expr.h"
#include "clang/AST/PrettyPrinter.h"
#include "clang/AST/RecordLayout.h"
#include "clang/AST/Type.h"
#include "clang/Analysis/AnalysisDeclContext.h"
#include "clang/Analysis/Support/BumpVector.h"
#include "clang/Basic/IdentifierTable.h"
#include "clang/Basic/LLVM.h"
#include "clang/Basic/SourceManager.h"
#include "clang/StaticAnalyzer/Core/AnalyzerOptions.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/DynamicExtent.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/SVals.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/FoldingSet.h"
#include "llvm/ADT/PointerUnion.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h"
#include "llvm/ADT/iterator_range.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CheckedArithmetic.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include <cassert>
#include <cstdint>
#include <functional>
#include <iterator>
#include <optional>
#include <string>
#include <tuple>
#include <utility>
#include "clang/StaticAnalyzer/Core/PathSensitive/Regions.def"

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "MemRegion"
 
#define REGION(Id, Parent)
 

Functions

static llvm::PointerUnion< const StackFrameContext *, const VarRegion * > getStackOrCaptureRegionForDeclContext (const LocationContext *LC, const DeclContext *DC, const VarDecl *VD)
 Look through a chain of LocationContexts to either find the StackFrameContext that matches a DeclContext, or find a VarRegion for a variable captured by a block.
 
static bool isValidBaseClass (const CXXRecordDecl *BaseClass, const TypedValueRegion *Super, bool IsVirtual)
 Checks whether BaseClass is a valid virtual or direct non-virtual base class of the type of Super.
 
static bool isImmediateBase (const CXXRecordDecl *Child, const CXXRecordDecl *Base)
 Returns true if Base is an immediate base class of Child.
 
static RegionOffset calculateOffset (const MemRegion *R)
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "MemRegion"

Definition at line 62 of file MemRegion.cpp.

◆ REGION

#define REGION (   Id,
  Parent 
)
Value:
case Id##Kind: \
return #Id;
uint32_t Id
Definition: SemaARM.cpp:1143

Function Documentation

◆ calculateOffset()

static RegionOffset calculateOffset ( const MemRegion R)
static

◆ getStackOrCaptureRegionForDeclContext()

static llvm::PointerUnion< const StackFrameContext *, const VarRegion * > getStackOrCaptureRegionForDeclContext ( const LocationContext LC,
const DeclContext DC,
const VarDecl VD 
)
static

Look through a chain of LocationContexts to either find the StackFrameContext that matches a DeclContext, or find a VarRegion for a variable captured by a block.

Definition at line 977 of file MemRegion.cpp.

References clang::LocationContext::getParent().

Referenced by clang::ento::MemRegionManager::getVarRegion().

◆ isImmediateBase()

static bool isImmediateBase ( const CXXRecordDecl Child,
const CXXRecordDecl Base 
)
static

Returns true if Base is an immediate base class of Child.

Definition at line 1473 of file MemRegion.cpp.

Referenced by calculateOffset().

◆ isValidBaseClass()

static bool isValidBaseClass ( const CXXRecordDecl BaseClass,
const TypedValueRegion Super,
bool  IsVirtual 
)
static

Checks whether BaseClass is a valid virtual or direct non-virtual base class of the type of Super.

Definition at line 1253 of file MemRegion.cpp.

References clang::Class, clang::Type::getAsCXXRecordDecl(), clang::CXXRecordDecl::getCanonicalDecl(), and clang::ento::TypedValueRegion::getValueType().

Referenced by clang::ento::MemRegionManager::getCXXBaseObjectRegion().