clang: lib/StaticAnalyzer/Core/LoopWidening.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

20

21using namespace clang;

22using namespace ento;

24

26

27

30 default:

31 return nullptr;

32 case Stmt::ForStmtClass:

33 return cast(LoopStmt)->getCond();

34 case Stmt::WhileStmtClass:

35 return cast(LoopStmt)->getCond();

36 case Stmt::DoStmtClass:

37 return cast(LoopStmt)->getCond();

38 case Stmt::CXXForRangeStmtClass:

39 return cast(LoopStmt)->getCond();

40 }

41}

42

44namespace ento {

45

48 unsigned BlockCount, const Stmt *LoopStmt) {

49

50 assert((isa<ForStmt, WhileStmt, DoStmt, CXXForRangeStmt>(LoopStmt)));

51

52

53

54

55

56

57

60 MemRegionManager &MRMgr = PrevState->getStateManager().getRegionManager();

65 for (auto *Region : Regions) {

68 }

69

70

71 auto Matches = match(

77 assert(VD);

81 }

82

83

84

85

86

87

94 }

95

96 return PrevState->invalidateRegions(Regions, getLoopCondition(LoopStmt),

97 BlockCount, LCtx, true, nullptr, nullptr,

98 &ITraits);

99}

100

101}

102}

static const Expr * getLoopCondition(const Stmt *LoopStmt)

Return the loops condition Stmt or NULL if LoopStmt is not a loop.

This header contains the declarations of functions which are used to widen loops which do not otherwi...

Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...

ASTContext & getASTContext() const

Represents a static or instance method of a struct/union/class.

bool isImplicitObjectMemberFunction() const

[C++2b][dcl.fct]/p7 An implicit object member function is a non-static member function without an exp...

QualType getThisType() const

Return the type of the this pointer.

virtual Stmt * getBody() const

getBody - If this Decl represents a declaration for a body of code, such as a function or method defi...

This represents one expression.

It wraps the AnalysisDeclContext to represent both the call stack with the help of StackFrameContext ...

const Decl * getDecl() const

LLVM_ATTRIBUTE_RETURNS_NONNULL AnalysisDeclContext * getAnalysisDeclContext() const

const StackFrameContext * getStackFrame() const

It represents a stack frame of the call stack (based on CallEvent).

Stmt - This represents one statement.

StmtClass getStmtClass() const

Represents a variable declaration or definition.

Maps string IDs to AST nodes matched by parts of a matcher.

CXXThisRegion - Represents the region for the implicit 'this' parameter in a call to a C++ method.

const StackArgumentsSpaceRegion * getStackArgumentsRegion(const StackFrameContext *STC)

getStackArgumentsRegion - Retrieve the memory region associated with function/method arguments of the...

const CXXThisRegion * getCXXThisRegion(QualType thisPointerTy, const LocationContext *LC)

getCXXThisRegion - Retrieve the [artificial] region associated with the parameter 'this'.

const VarRegion * getVarRegion(const VarDecl *VD, const LocationContext *LC)

getVarRegion - Retrieve or create the memory region associated with a specified VarDecl and LocationC...

const StackLocalsSpaceRegion * getStackLocalsRegion(const StackFrameContext *STC)

getStackLocalsRegion - Retrieve the memory region associated with the specified stack frame.

const GlobalsSpaceRegion * getGlobalsRegion(MemRegion::Kind K=MemRegion::GlobalInternalSpaceRegionKind, const CodeTextRegion *R=nullptr)

getGlobalsRegion - Retrieve the memory region associated with global variables.

MemRegion - The root abstract class for all memory regions.

Information about invalidation for a particular region/symbol.

@ TK_PreserveContents

Tells that a region's contents is not changed.

@ TK_EntireMemSpace

When applied to a MemSpaceRegion, indicates the entire memory space should be invalidated.

void setTrait(SymbolRef Sym, InvalidationKinds IK)

const internal::VariadicDynCastAllOfMatcher< Decl, VarDecl > varDecl

Matches variable declarations.

const internal::ArgumentAdaptingMatcherFunc< internal::HasDescendantMatcher > hasDescendant

Matches AST nodes that have descendant AST nodes that match the provided matcher.

SmallVector< BoundNodes, 1 > match(MatcherT Matcher, const NodeT &Node, ASTContext &Context)

Returns the results of matching Matcher on Node.

const AstTypeMatcher< ReferenceType > referenceType

Matches both lvalue and rvalue reference types.

internal::Matcher< T > findAll(const internal::Matcher< T > &Matcher)

Matches if the node or any descendant matches.

const internal::VariadicAllOfMatcher< Stmt > stmt

Matches statements.

ProgramStateRef getWidenedLoopState(ProgramStateRef PrevState, const LocationContext *LCtx, unsigned BlockCount, const Stmt *LoopStmt)

Get the states that result from widening the loop.

The JSON file list parser is used to communicate input to InstallAPI.