clang 8.0.0

LoopUnrolling.cpp
Go to the documentation of this file.
1 //===--- LoopUnrolling.cpp - Unroll loops -----------------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 ///
10 /// This file contains functions which are used to decide if a loop worth to be
11 /// unrolled. Moreover, these functions manages the stack of loop which is
12 /// tracked by the ProgramState.
13 ///
14 //===----------------------------------------------------------------------===//
15
16 #include "clang/ASTMatchers/ASTMatchers.h"
17 #include "clang/ASTMatchers/ASTMatchFinder.h"
18 #include "clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h"
19 #include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h"
20 #include "clang/StaticAnalyzer/Core/PathSensitive/LoopUnrolling.h"
21
22 using namespace clang;
23 using namespace ento;
24 using namespace clang::ast_matchers;
25
26 static const int MAXIMUM_STEP_UNROLLED = 128;
27
28 struct LoopState {
29 private:
30 enum Kind { Normal, Unrolled } K;
31 const Stmt *LoopStmt;
32 const LocationContext *LCtx;
33 unsigned maxStep;
34 LoopState(Kind InK, const Stmt *S, const LocationContext *L, unsigned N)
35 : K(InK), LoopStmt(S), LCtx(L), maxStep(N) {}
36
37 public:
38 static LoopState getNormal(const Stmt *S, const LocationContext *L,
39 unsigned N) {
40 return LoopState(Normal, S, L, N);
41 }
42 static LoopState getUnrolled(const Stmt *S, const LocationContext *L,
43 unsigned N) {
44 return LoopState(Unrolled, S, L, N);
45 }
46 bool isUnrolled() const { return K == Unrolled; }
47 unsigned getMaxStep() const { return maxStep; }
48 const Stmt *getLoopStmt() const { return LoopStmt; }
49 const LocationContext *getLocationContext() const { return LCtx; }
50 bool operator==(const LoopState &X) const {
51 return K == X.K && LoopStmt == X.LoopStmt;
52 }
53 void Profile(llvm::FoldingSetNodeID &ID) const {
54 ID.AddInteger(K);
55 ID.AddPointer(LoopStmt);
56 ID.AddPointer(LCtx);
57 ID.AddInteger(maxStep);
58 }
59 };
60
61 // The tracked stack of loops. The stack indicates that which loops the
62 // simulated element contained by. The loops are marked depending if we decided
63 // to unroll them.
64 // TODO: The loop stack should not need to be in the program state since it is
65 // lexical in nature. Instead, the stack of loops should be tracked in the
66 // LocationContext.
67 REGISTER_LIST_WITH_PROGRAMSTATE(LoopStack, LoopState)
68
69 namespace clang {
70 namespace ento {
71
72 static bool isLoopStmt(const Stmt *S) {
73 return S && (isa<ForStmt>(S) || isa<WhileStmt>(S) || isa<DoStmt>(S));
74 }
75
76 ProgramStateRef processLoopEnd(const Stmt *LoopStmt, ProgramStateRef State) {
77 auto LS = State->get<LoopStack>();
78 if (!LS.isEmpty() && LS.getHead().getLoopStmt() == LoopStmt)
79 State = State->set<LoopStack>(LS.getTail());
80 return State;
81 }
82
83 static internal::Matcher<Stmt> simpleCondition(StringRef BindName) {
84 return binaryOperator(anyOf(hasOperatorName("<"), hasOperatorName(">"),
85 hasOperatorName("<="), hasOperatorName(">="),
86 hasOperatorName("!=")),
87 hasEitherOperand(ignoringParenImpCasts(declRefExpr(
88 to(varDecl(hasType(isInteger())).bind(BindName))))),
89 hasEitherOperand(ignoringParenImpCasts(
90 integerLiteral().bind("boundNum"))))
91 .bind("conditionOperator");
92 }
93
94 static internal::Matcher<Stmt>
95 changeIntBoundNode(internal::Matcher<Decl> VarNodeMatcher) {
96 return anyOf(
97 unaryOperator(anyOf(hasOperatorName("--"), hasOperatorName("++")),
98 hasUnaryOperand(ignoringParenImpCasts(
99 declRefExpr(to(varDecl(VarNodeMatcher)))))),
100 binaryOperator(isAssignmentOperator(),
101 hasLHS(ignoringParenImpCasts(
102 declRefExpr(to(varDecl(VarNodeMatcher)))))));
103 }
104
105 static internal::Matcher<Stmt>
106 callByRef(internal::Matcher<Decl> VarNodeMatcher) {
107 return callExpr(forEachArgumentWithParam(
108 declRefExpr(to(varDecl(VarNodeMatcher))),
109 parmVarDecl(hasType(references(qualType(unless(isConstQualified())))))));
110 }
111
112 static internal::Matcher<Stmt>
113 assignedToRef(internal::Matcher<Decl> VarNodeMatcher) {
114 return declStmt(hasDescendant(varDecl(
115 allOf(hasType(referenceType()),
116 hasInitializer(anyOf(
117 initListExpr(has(declRefExpr(to(varDecl(VarNodeMatcher))))),
118 declRefExpr(to(varDecl(VarNodeMatcher)))))))));
119 }
120
121 static internal::Matcher<Stmt>
122 getAddrTo(internal::Matcher<Decl> VarNodeMatcher) {
123 return unaryOperator(
124 hasOperatorName("&"),
125 hasUnaryOperand(declRefExpr(hasDeclaration(VarNodeMatcher))));
126 }
127
128 static internal::Matcher<Stmt> hasSuspiciousStmt(StringRef NodeName) {
129 return hasDescendant(stmt(
130 anyOf(gotoStmt(), switchStmt(), returnStmt(),
131 // Escaping and not known mutation of the loop counter is handled
132 // by exclusion of assigning and address-of operators and
133 // pass-by-ref function calls on the loop counter from the body.
134 changeIntBoundNode(equalsBoundNode(NodeName)),
135 callByRef(equalsBoundNode(NodeName)),
136 getAddrTo(equalsBoundNode(NodeName)),
137 assignedToRef(equalsBoundNode(NodeName)))));
138 }
139
140 static internal::Matcher<Stmt> forLoopMatcher() {
141 return forStmt(
142 hasCondition(simpleCondition("initVarName")),
143 // Initialization should match the form: 'int i = 6' or 'i = 42'.
144 hasLoopInit(
145 anyOf(declStmt(hasSingleDecl(
146 varDecl(allOf(hasInitializer(ignoringParenImpCasts(
147 integerLiteral().bind("initNum"))),
148 equalsBoundNode("initVarName"))))),
149 binaryOperator(hasLHS(declRefExpr(to(varDecl(
150 equalsBoundNode("initVarName"))))),
151 hasRHS(ignoringParenImpCasts(
152 integerLiteral().bind("initNum")))))),
153 // Incrementation should be a simple increment or decrement
154 // operator call.
155 hasIncrement(unaryOperator(
156 anyOf(hasOperatorName("++"), hasOperatorName("--")),
157 hasUnaryOperand(declRefExpr(
158 to(varDecl(allOf(equalsBoundNode("initVarName"),
159 hasType(isInteger())))))))),
160 unless(hasBody(hasSuspiciousStmt("initVarName")))).bind("forLoop");
161 }
162
163 static bool isPossiblyEscaped(const VarDecl *VD, ExplodedNode *N) {
164 // Global variables assumed as escaped variables.
165 if (VD->hasGlobalStorage())
166 return true;
167
168 while (!N->pred_empty()) {
169 const Stmt *S = PathDiagnosticLocation::getStmt(N);
170 if (!S) {
171 N = N->getFirstPred();
172 continue;
173 }
174
175 if (const DeclStmt *DS = dyn_cast<DeclStmt>(S)) {
176 for (const Decl *D : DS->decls()) {
177 // Once we reach the declaration of the VD we can return.
178 if (D->getCanonicalDecl() == VD)
179 return false;
180 }
181 }
182 // Check the usage of the pass-by-ref function calls and adress-of operator
183 // on VD and reference initialized by VD.
184 ASTContext &ASTCtx =
185 N->getLocationContext()->getAnalysisDeclContext()->getASTContext();
186 auto Match =
187 match(stmt(anyOf(callByRef(equalsNode(VD)), getAddrTo(equalsNode(VD)),
188 assignedToRef(equalsNode(VD)))),
189 *S, ASTCtx);
190 if (!Match.empty())
191 return true;
192
193 N = N->getFirstPred();
194 }
195 llvm_unreachable("Reached root without finding the declaration of VD");
196 }
197
198 bool shouldCompletelyUnroll(const Stmt *LoopStmt, ASTContext &ASTCtx,
199 ExplodedNode *Pred, unsigned &maxStep) {
200
201 if (!isLoopStmt(LoopStmt))
202 return false;
203
204 // TODO: Match the cases where the bound is not a concrete literal but an
205 // integer with known value
206 auto Matches = match(forLoopMatcher(), *LoopStmt, ASTCtx);
207 if (Matches.empty())
208 return false;
209
210 auto CounterVar = Matches[0].getNodeAs<VarDecl>("initVarName");
211 llvm::APInt BoundNum =
212 Matches[0].getNodeAs<IntegerLiteral>("boundNum")->getValue();
213 llvm::APInt InitNum =
214 Matches[0].getNodeAs<IntegerLiteral>("initNum")->getValue();
215 auto CondOp = Matches[0].getNodeAs<BinaryOperator>("conditionOperator");
216 if (InitNum.getBitWidth() != BoundNum.getBitWidth()) {
217 InitNum = InitNum.zextOrSelf(BoundNum.getBitWidth());
218 BoundNum = BoundNum.zextOrSelf(InitNum.getBitWidth());
219 }
220
221 if (CondOp->getOpcode() == BO_GE || CondOp->getOpcode() == BO_LE)
222 maxStep = (BoundNum - InitNum + 1).abs().getZExtValue();
223 else
224 maxStep = (BoundNum - InitNum).abs().getZExtValue();
225
226 // Check if the counter of the loop is not escaped before.
227 return !isPossiblyEscaped(CounterVar->getCanonicalDecl(), Pred);
228 }
229
230 bool madeNewBranch(ExplodedNode *N, const Stmt *LoopStmt) {
231 const Stmt *S = nullptr;
232 while (!N->pred_empty()) {
233 if (N->succ_size() > 1)
234 return true;
235
236 ProgramPoint P = N->getLocation();
237 if (Optional<BlockEntrance> BE = P.getAs<BlockEntrance>())
238 S = BE->getBlock()->getTerminator();
239
240 if (S == LoopStmt)
241 return false;
242
243 N = N->getFirstPred();
244 }
245
246 llvm_unreachable("Reached root without encountering the previous step");
247 }
248
249 // updateLoopStack is called on every basic block, therefore it needs to be fast
250 ProgramStateRef updateLoopStack(const Stmt *LoopStmt, ASTContext &ASTCtx,
251 ExplodedNode *Pred, unsigned maxVisitOnPath) {
252 auto State = Pred->getState();
253 auto LCtx = Pred->getLocationContext();
254
255 if (!isLoopStmt(LoopStmt))
256 return State;
257
258 auto LS = State->get<LoopStack>();
259 if (!LS.isEmpty() && LoopStmt == LS.getHead().getLoopStmt() &&
260 LCtx == LS.getHead().getLocationContext()) {
261 if (LS.getHead().isUnrolled() && madeNewBranch(Pred, LoopStmt)) {
262 State = State->set<LoopStack>(LS.getTail());
263 State = State->add<LoopStack>(
264 LoopState::getNormal(LoopStmt, LCtx, maxVisitOnPath));
265 }
266 return State;
267 }
268 unsigned maxStep;
269 if (!shouldCompletelyUnroll(LoopStmt, ASTCtx, Pred, maxStep)) {
270 State = State->add<LoopStack>(
271 LoopState::getNormal(LoopStmt, LCtx, maxVisitOnPath));
272 return State;
273 }
274
275 unsigned outerStep = (LS.isEmpty() ? 1 : LS.getHead().getMaxStep());
276
277 unsigned innerMaxStep = maxStep * outerStep;
278 if (innerMaxStep > MAXIMUM_STEP_UNROLLED)
279 State = State->add<LoopStack>(
280 LoopState::getNormal(LoopStmt, LCtx, maxVisitOnPath));
281 else
282 State = State->add<LoopStack>(
283 LoopState::getUnrolled(LoopStmt, LCtx, innerMaxStep));
284 return State;
285 }
286
287 bool isUnrolledState(ProgramStateRef State) {
288 auto LS = State->get<LoopStack>();
289 if (LS.isEmpty() || !LS.getHead().isUnrolled())
290 return false;
291 return true;
292 }
293 }
294 }
clang::Builtin::ID
ID
Definition: Builtins.h:49
ento
clang::ast_matchers
Definition: ASTMatchers.h:93
clang::ast_matchers::callExpr
const internal::VariadicDynCastAllOfMatcher< Stmt, CallExpr > callExpr
Matches call expressions.
Definition: ASTMatchersInternal.cpp:622
LoopUnrolling.h
clang::ast_matchers::stmt
const internal::VariadicAllOfMatcher< Stmt > stmt
Matches statements.
Definition: ASTMatchersInternal.cpp:615
LoopState::getUnrolled
static LoopState getUnrolled(const Stmt *S, const LocationContext *L, unsigned N)
Definition: LoopUnrolling.cpp:42
clang::ast_matchers::has
const internal::ArgumentAdaptingMatcherFunc< internal::HasMatcher > has
Matches AST nodes that have child AST nodes that match the provided matcher.
Definition: ASTMatchersInternal.cpp:783
clang::ento::shouldCompletelyUnroll
bool shouldCompletelyUnroll(const Stmt *LoopStmt, ASTContext &ASTCtx, ExplodedNode *Pred, unsigned &maxStep)
Definition: LoopUnrolling.cpp:198
ASTMatchFinder.h
clang::Stmt
Stmt - This represents one statement.
Definition: Stmt.h:66
clang::ast_matchers::hasDeclaration
internal::PolymorphicMatcherWithParam1< internal::HasDeclarationMatcher, internal::Matcher< Decl >, void(internal::HasDeclarationSupportedTypes)> hasDeclaration(const internal::Matcher< Decl > &InnerMatcher)
Matches a node if the declaration associated with that node matches the given matcher.
Definition: ASTMatchers.h:2865
clang::ast_matchers::anyOf
const internal::VariadicOperatorMatcherFunc< 2, std::numeric_limits< unsigned >::max()> anyOf
Matches if any of the given matchers matches.
Definition: ASTMatchersInternal.cpp:773
clang::Decl
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:87
abs
__DEVICE__ long long abs(long long __n)
Definition: __clang_cuda_cmath.h:49
P
StringRef P
Definition: ASTMatchersInternal.cpp:439
clang::ast_matchers::hasDescendant
const internal::ArgumentAdaptingMatcherFunc< internal::HasDescendantMatcher > hasDescendant
Matches AST nodes that have descendant AST nodes that match the provided matcher. ...
Definition: ASTMatchersInternal.cpp:785
IteratorComparison::isAssignmentOperator
bool isAssignmentOperator(OverloadedOperatorKind OK)
clang::IntegerLiteral
Definition: Expr.h:1308
clang::LocationContext
Definition: AnalysisDeclContext.h:218
clang::ento::ExplodedNode::getState
const ProgramStateRef & getState() const
Definition: ExplodedGraph.h:164
clang::BlockEntrance
Definition: ProgramPoint.h:227
clang::VarDecl
Represents a variable declaration or definition.
Definition: Decl.h:813
clang::AnalysisDeclContext::getASTContext
ASTContext & getASTContext() const
Definition: AnalysisDeclContext.h:104
clang::ast_matchers::allOf
const internal::VariadicOperatorMatcherFunc< 2, std::numeric_limits< unsigned >::max()> allOf
Matches if all given matchers match.
Definition: ASTMatchersInternal.cpp:776
clang::ast_matchers::binaryOperator
const internal::VariadicDynCastAllOfMatcher< Stmt, BinaryOperator > binaryOperator
Matches binary operator expressions.
Definition: ASTMatchersInternal.cpp:735
clang::ento::isUnrolledState
bool isUnrolledState(ProgramStateRef State)
Returns if the given State indicates that is inside a completely unrolled loop.
Definition: LoopUnrolling.cpp:287
clang::ast_matchers::varDecl
const internal::VariadicDynCastAllOfMatcher< Decl, VarDecl > varDecl
Matches variable declarations.
Definition: ASTMatchersInternal.cpp:607
clang::ASTContext
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:155
llvm::Optional
Definition: LLVM.h:38
State
LineState State
Definition: UnwrappedLineFormatter.cpp:877
LoopState
Definition: LoopUnrolling.cpp:28
clang::ento::processLoopEnd
ProgramStateRef processLoopEnd(const Stmt *LoopStmt, ProgramStateRef State)
Updates the given ProgramState.
Definition: LoopUnrolling.cpp:76
clang::ento::ExplodedNode
Definition: ExplodedGraph.h:66
clang::ast_matchers::gotoStmt
const internal::VariadicDynCastAllOfMatcher< Stmt, GotoStmt > gotoStmt
Matches goto statements.
Definition: ASTMatchersInternal.cpp:703
clang::ast_matchers::declStmt
const internal::VariadicDynCastAllOfMatcher< Stmt, DeclStmt > declStmt
Matches declaration statements.
Definition: ASTMatchersInternal.cpp:616
clang::ento::ExplodedNode::succ_size
unsigned succ_size() const
Definition: ExplodedGraph.h:194
clang::ast_matchers::declRefExpr
const internal::VariadicDynCastAllOfMatcher< Stmt, DeclRefExpr > declRefExpr
Matches expressions that refer to declarations.
Definition: ASTMatchersInternal.cpp:691
clang::ento::updateLoopStack
ProgramStateRef updateLoopStack(const Stmt *LoopStmt, ASTContext &ASTCtx, ExplodedNode *Pred, unsigned maxVisitOnPath)
Updates the stack of loops contained by the ProgramState.
Definition: LoopUnrolling.cpp:250
LoopState::isUnrolled
bool isUnrolled() const
Definition: LoopUnrolling.cpp:46
clang::ento::ExplodedNode::getLocationContext
const LocationContext * getLocationContext() const
Definition: ExplodedGraph.h:145
clang::BinaryOperator
A builtin binary operation expression such as "x + y" or "x <= y".
Definition: Expr.h:3287
ASTMatchers.h
clang::ento::ExplodedNode::getFirstPred
ExplodedNode * getFirstPred()
Definition: ExplodedGraph.h:205
clang::ast_matchers::match
SmallVector< BoundNodes, 1 > match(MatcherT Matcher, const NodeT &Node, ASTContext &Context)
Returns the results of matching Matcher on Node.
Definition: ASTMatchFinder.h:299
LoopState::getLocationContext
const LocationContext * getLocationContext() const
Definition: LoopUnrolling.cpp:49
clang::ento::assignedToRef
static internal::Matcher< Stmt > assignedToRef(internal::Matcher< Decl > VarNodeMatcher)
Definition: LoopUnrolling.cpp:113
MAXIMUM_STEP_UNROLLED
static const int MAXIMUM_STEP_UNROLLED
Definition: LoopUnrolling.cpp:26
clang::ast_matchers::switchStmt
const internal::VariadicDynCastAllOfMatcher< Stmt, SwitchStmt > switchStmt
Matches switch statements.
Definition: ASTMatchersInternal.cpp:706
REGISTER_LIST_WITH_PROGRAMSTATE
#define REGISTER_LIST_WITH_PROGRAMSTATE(Name, Elem)
Declares an immutable list type NameTy, suitable for placement into the ProgramState.
Definition: ProgramStateTrait.h:133
getValue
static SVal getValue(SVal val, SValBuilder &svalBuilder)
Definition: ArrayBoundCheckerV2.cpp:276
clang::ast_matchers::returnStmt
const internal::VariadicDynCastAllOfMatcher< Stmt, ReturnStmt > returnStmt
Matches return statements.
Definition: ASTMatchersInternal.cpp:702
LoopState::getLoopStmt
const Stmt * getLoopStmt() const
Definition: LoopUnrolling.cpp:48
clang::ento::PathDiagnosticLocation::getStmt
static const Stmt * getStmt(const ExplodedNode *N)
Given an exploded node, retrieve the statement that should be used for the diagnostic location...
Definition: PathDiagnostic.cpp:767
llvm::IntrusiveRefCntPtr
Definition: LLVM.h:45
clang::ast_matchers::parmVarDecl
const internal::VariadicDynCastAllOfMatcher< Decl, ParmVarDecl > parmVarDecl
Matches parameter variable declarations.
Definition: ASTMatchersInternal.cpp:581
LoopState::getMaxStep
unsigned getMaxStep() const
Definition: LoopUnrolling.cpp:47
clang::ento::madeNewBranch
bool madeNewBranch(ExplodedNode *N, const Stmt *LoopStmt)
Definition: LoopUnrolling.cpp:230
clang::DeclStmt
DeclStmt - Adaptor class for mixing declarations with statements and expressions. ...
Definition: Stmt.h:1143
clang::ast_matchers::integerLiteral
const internal::VariadicDynCastAllOfMatcher< Stmt, IntegerLiteral > integerLiteral
Matches integer literals of all sizes / encodings, e.g.
Definition: ASTMatchersInternal.cpp:722
clang::VarDecl::hasGlobalStorage
bool hasGlobalStorage() const
Returns true for all variables that do not have local storage.
Definition: Decl.h:1078
clang::ast_matchers::qualType
const internal::VariadicAllOfMatcher< QualType > qualType
Matches QualTypes in the clang AST.
Definition: ASTMatchersInternal.cpp:591
clang::ento::ExplodedNode::getLocation
ProgramPoint getLocation() const
getLocation - Returns the edge associated with the given node.
Definition: ExplodedGraph.h:143
clang::ast_matchers::unless
const internal::VariadicOperatorMatcherFunc< 1, 1 > unless
Matches if the provided matcher does not match.
Definition: ASTMatchersInternal.cpp:800
clang::ast_matchers::forStmt
const internal::VariadicDynCastAllOfMatcher< Stmt, ForStmt > forStmt
Matches for statements.
Definition: ASTMatchersInternal.cpp:695
clang
Dataflow Directional Tag Classes.
Definition: CFGReachabilityAnalysis.h:22
LoopState::getNormal
static LoopState getNormal(const Stmt *S, const LocationContext *L, unsigned N)
Definition: LoopUnrolling.cpp:38
clang::ento::isLoopStmt
static bool isLoopStmt(const Stmt *S)
Definition: LoopUnrolling.cpp:72
clang::ProgramPoint
Definition: ProgramPoint.h:61
clang::ast_matchers::initListExpr
const internal::VariadicDynCastAllOfMatcher< Stmt, InitListExpr > initListExpr
Matches init list expressions.
Definition: ASTMatchersInternal.cpp:654
clang::ento::forLoopMatcher
static internal::Matcher< Stmt > forLoopMatcher()
Definition: LoopUnrolling.cpp:140
clang::ast_matchers::hasEitherOperand
internal::Matcher< BinaryOperator > hasEitherOperand(const internal::Matcher< Expr > &InnerMatcher)
Matches if either the left hand side or the right hand side of a binary operator matches.
Definition: ASTMatchers.h:4391
clang::ast_matchers::unaryOperator
const internal::VariadicDynCastAllOfMatcher< Stmt, UnaryOperator > unaryOperator
Matches unary operator expressions.
Definition: ASTMatchersInternal.cpp:736
X
X
Add a minimal nested name specifier fixit hint to allow lookup of a tag name from an outer enclosing ...
Definition: SemaDecl.cpp:13954
clang::ento::changeIntBoundNode
static internal::Matcher< Stmt > changeIntBoundNode(internal::Matcher< Decl > VarNodeMatcher)
Definition: LoopUnrolling.cpp:95
clang::ento::hasSuspiciousStmt
static internal::Matcher< Stmt > hasSuspiciousStmt(StringRef NodeName)
Definition: LoopUnrolling.cpp:128
clang::ento::simpleCondition
static internal::Matcher< Stmt > simpleCondition(StringRef BindName)
Definition: LoopUnrolling.cpp:83
clang::ento::ExplodedNode::pred_empty
bool pred_empty() const
Definition: ExplodedGraph.h:197
clang::ento::callByRef
static internal::Matcher< Stmt > callByRef(internal::Matcher< Decl > VarNodeMatcher)
Definition: LoopUnrolling.cpp:106
clang::ento::isPossiblyEscaped
static bool isPossiblyEscaped(const VarDecl *VD, ExplodedNode *N)
Definition: LoopUnrolling.cpp:163
LoopState::operator==
bool operator==(const LoopState &X) const
Definition: LoopUnrolling.cpp:50
clang::ProgramPoint::getAs
Optional< T > getAs() const
Convert to the specified ProgramPoint type, returning None if this ProgramPoint is not of the desired...
Definition: ProgramPoint.h:153
clang::ento::getAddrTo
static internal::Matcher< Stmt > getAddrTo(internal::Matcher< Decl > VarNodeMatcher)
Definition: LoopUnrolling.cpp:122
clang::LocationContext::getAnalysisDeclContext
AnalysisDeclContext * getAnalysisDeclContext() const
Definition: AnalysisDeclContext.h:247
clang::ast_matchers::referenceType
const AstTypeMatcher< ReferenceType > referenceType
Matches both lvalue and rvalue reference types.
Definition: ASTMatchersInternal.cpp:824
CallEvent.h
CheckerContext.h
LoopState::Profile
void Profile(llvm::FoldingSetNodeID &ID) const
Definition: LoopUnrolling.cpp:53