clang 20.0.0git
SymbolManager.cpp
Go to the documentation of this file.
1//===- SymbolManager.h - Management of Symbolic Values --------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file defines SymbolManager, a class that manages symbolic values
10// created for use by ExprEngine and related classes.
11//
12//===----------------------------------------------------------------------===//
13
16#include "clang/AST/Expr.h"
17#include "clang/AST/StmtObjC.h"
20#include "clang/Basic/LLVM.h"
25#include "llvm/ADT/FoldingSet.h"
26#include "llvm/ADT/STLExtras.h"
27#include "llvm/Support/Casting.h"
28#include "llvm/Support/Compiler.h"
29#include "llvm/Support/ErrorHandling.h"
30#include "llvm/Support/raw_ostream.h"
31#include <cassert>
32
33using namespace clang;
34using namespace ento;
35
36void SymExpr::anchor() {}
37
38StringRef SymbolConjured::getKindStr() const { return "conj_$"; }
39StringRef SymbolDerived::getKindStr() const { return "derived_$"; }
40StringRef SymbolExtent::getKindStr() const { return "extent_$"; }
41StringRef SymbolMetadata::getKindStr() const { return "meta_$"; }
42StringRef SymbolRegionValue::getKindStr() const { return "reg_$"; }
43
44LLVM_DUMP_METHOD void SymExpr::dump() const { dumpToStream(llvm::errs()); }
45
46void BinarySymExpr::dumpToStreamImpl(raw_ostream &OS, const SymExpr *Sym) {
47 OS << '(';
48 Sym->dumpToStream(OS);
49 OS << ')';
50}
51
53 const llvm::APSInt &Value) {
54 if (Value.isUnsigned())
55 OS << Value.getZExtValue();
56 else
57 OS << Value.getSExtValue();
58 if (Value.isUnsigned())
59 OS << 'U';
60}
61
64 OS << ' ' << BinaryOperator::getOpcodeStr(Op) << ' ';
65}
66
67void SymbolCast::dumpToStream(raw_ostream &os) const {
68 os << '(' << ToTy << ") (";
69 Operand->dumpToStream(os);
70 os << ')';
71}
72
73void UnarySymExpr::dumpToStream(raw_ostream &os) const {
75 bool Binary = isa<BinarySymExpr>(Operand);
76 if (Binary)
77 os << '(';
78 Operand->dumpToStream(os);
79 if (Binary)
80 os << ')';
81}
82
83void SymbolConjured::dumpToStream(raw_ostream &os) const {
84 os << getKindStr() << getSymbolID() << '{' << T << ", LC" << LCtx->getID();
85 if (S)
86 os << ", S" << S->getID(LCtx->getDecl()->getASTContext());
87 else
88 os << ", no stmt";
89 os << ", #" << Count << '}';
90}
91
92void SymbolDerived::dumpToStream(raw_ostream &os) const {
93 os << getKindStr() << getSymbolID() << '{' << getParentSymbol() << ','
94 << getRegion() << '}';
95}
96
97void SymbolExtent::dumpToStream(raw_ostream &os) const {
98 os << getKindStr() << getSymbolID() << '{' << getRegion() << '}';
99}
100
101void SymbolMetadata::dumpToStream(raw_ostream &os) const {
102 os << getKindStr() << getSymbolID() << '{' << getRegion() << ',' << T << '}';
103}
104
105void SymbolData::anchor() {}
106
107void SymbolRegionValue::dumpToStream(raw_ostream &os) const {
108 os << getKindStr() << getSymbolID() << '<' << getType() << ' ' << R << '>';
109}
110
112 return itr == X.itr;
113}
114
116 return itr != X.itr;
117}
118
120 itr.push_back(SE);
121}
122
124 assert(!itr.empty() && "attempting to iterate on an 'end' iterator");
125 expand();
126 return *this;
127}
128
130 assert(!itr.empty() && "attempting to dereference an 'end' iterator");
131 return itr.back();
132}
133
134void SymExpr::symbol_iterator::expand() {
135 const SymExpr *SE = itr.pop_back_val();
136
137 switch (SE->getKind()) {
138 case SymExpr::SymbolRegionValueKind:
139 case SymExpr::SymbolConjuredKind:
140 case SymExpr::SymbolDerivedKind:
141 case SymExpr::SymbolExtentKind:
142 case SymExpr::SymbolMetadataKind:
143 return;
144 case SymExpr::SymbolCastKind:
145 itr.push_back(cast<SymbolCast>(SE)->getOperand());
146 return;
147 case SymExpr::UnarySymExprKind:
148 itr.push_back(cast<UnarySymExpr>(SE)->getOperand());
149 return;
150 case SymExpr::SymIntExprKind:
151 itr.push_back(cast<SymIntExpr>(SE)->getLHS());
152 return;
153 case SymExpr::IntSymExprKind:
154 itr.push_back(cast<IntSymExpr>(SE)->getRHS());
155 return;
156 case SymExpr::SymSymExprKind: {
157 const auto *x = cast<SymSymExpr>(SE);
158 itr.push_back(x->getLHS());
159 itr.push_back(x->getRHS());
160 return;
161 }
162 }
163 llvm_unreachable("unhandled expansion case");
164}
165
168 llvm::FoldingSetNodeID profile;
169 SymbolRegionValue::Profile(profile, R);
170 void *InsertPos;
171 SymExpr *SD = DataSet.FindNodeOrInsertPos(profile, InsertPos);
172 if (!SD) {
173 SD = new (BPAlloc) SymbolRegionValue(SymbolCounter, R);
174 DataSet.InsertNode(SD, InsertPos);
175 ++SymbolCounter;
176 }
177
178 return cast<SymbolRegionValue>(SD);
179}
180
182 const LocationContext *LCtx,
183 QualType T,
184 unsigned Count,
185 const void *SymbolTag) {
186 llvm::FoldingSetNodeID profile;
187 SymbolConjured::Profile(profile, E, T, Count, LCtx, SymbolTag);
188 void *InsertPos;
189 SymExpr *SD = DataSet.FindNodeOrInsertPos(profile, InsertPos);
190 if (!SD) {
191 SD = new (BPAlloc) SymbolConjured(SymbolCounter, E, LCtx, T, Count, SymbolTag);
192 DataSet.InsertNode(SD, InsertPos);
193 ++SymbolCounter;
194 }
195
196 return cast<SymbolConjured>(SD);
197}
198
199const SymbolDerived*
201 const TypedValueRegion *R) {
202 llvm::FoldingSetNodeID profile;
203 SymbolDerived::Profile(profile, parentSymbol, R);
204 void *InsertPos;
205 SymExpr *SD = DataSet.FindNodeOrInsertPos(profile, InsertPos);
206 if (!SD) {
207 SD = new (BPAlloc) SymbolDerived(SymbolCounter, parentSymbol, R);
208 DataSet.InsertNode(SD, InsertPos);
209 ++SymbolCounter;
210 }
211
212 return cast<SymbolDerived>(SD);
213}
214
215const SymbolExtent*
217 llvm::FoldingSetNodeID profile;
218 SymbolExtent::Profile(profile, R);
219 void *InsertPos;
220 SymExpr *SD = DataSet.FindNodeOrInsertPos(profile, InsertPos);
221 if (!SD) {
222 SD = new (BPAlloc) SymbolExtent(SymbolCounter, R);
223 DataSet.InsertNode(SD, InsertPos);
224 ++SymbolCounter;
225 }
226
227 return cast<SymbolExtent>(SD);
228}
229
230const SymbolMetadata *
232 const LocationContext *LCtx,
233 unsigned Count, const void *SymbolTag) {
234 llvm::FoldingSetNodeID profile;
235 SymbolMetadata::Profile(profile, R, S, T, LCtx, Count, SymbolTag);
236 void *InsertPos;
237 SymExpr *SD = DataSet.FindNodeOrInsertPos(profile, InsertPos);
238 if (!SD) {
239 SD = new (BPAlloc) SymbolMetadata(SymbolCounter, R, S, T, LCtx, Count, SymbolTag);
240 DataSet.InsertNode(SD, InsertPos);
241 ++SymbolCounter;
242 }
243
244 return cast<SymbolMetadata>(SD);
245}
246
247const SymbolCast*
249 QualType From, QualType To) {
250 llvm::FoldingSetNodeID ID;
251 SymbolCast::Profile(ID, Op, From, To);
252 void *InsertPos;
253 SymExpr *data = DataSet.FindNodeOrInsertPos(ID, InsertPos);
254 if (!data) {
255 data = new (BPAlloc) SymbolCast(Op, From, To);
256 DataSet.InsertNode(data, InsertPos);
257 }
258
259 return cast<SymbolCast>(data);
260}
261
264 APSIntPtr v, QualType t) {
265 llvm::FoldingSetNodeID ID;
266 SymIntExpr::Profile(ID, lhs, op, v, t);
267 void *InsertPos;
268 SymExpr *data = DataSet.FindNodeOrInsertPos(ID, InsertPos);
269
270 if (!data) {
271 data = new (BPAlloc) SymIntExpr(lhs, op, v, t);
272 DataSet.InsertNode(data, InsertPos);
273 }
274
275 return cast<SymIntExpr>(data);
276}
277
280 const SymExpr *rhs, QualType t) {
281 llvm::FoldingSetNodeID ID;
282 IntSymExpr::Profile(ID, lhs, op, rhs, t);
283 void *InsertPos;
284 SymExpr *data = DataSet.FindNodeOrInsertPos(ID, InsertPos);
285
286 if (!data) {
287 data = new (BPAlloc) IntSymExpr(lhs, op, rhs, t);
288 DataSet.InsertNode(data, InsertPos);
289 }
290
291 return cast<IntSymExpr>(data);
292}
293
296 const SymExpr *rhs,
297 QualType t) {
298 llvm::FoldingSetNodeID ID;
299 SymSymExpr::Profile(ID, lhs, op, rhs, t);
300 void *InsertPos;
301 SymExpr *data = DataSet.FindNodeOrInsertPos(ID, InsertPos);
302
303 if (!data) {
304 data = new (BPAlloc) SymSymExpr(lhs, op, rhs, t);
305 DataSet.InsertNode(data, InsertPos);
306 }
307
308 return cast<SymSymExpr>(data);
309}
310
313 QualType T) {
314 llvm::FoldingSetNodeID ID;
315 UnarySymExpr::Profile(ID, Operand, Opc, T);
316 void *InsertPos;
317 SymExpr *data = DataSet.FindNodeOrInsertPos(ID, InsertPos);
318 if (!data) {
319 data = new (BPAlloc) UnarySymExpr(Operand, Opc, T);
320 DataSet.InsertNode(data, InsertPos);
321 }
322
323 return cast<UnarySymExpr>(data);
324}
325
327 return T;
328}
329
331 return R->getValueType();
332}
333
335 ASTContext &Ctx = R->getMemRegionManager().getContext();
336 return Ctx.getSizeType();
337}
338
340 return T;
341}
342
344 return R->getValueType();
345}
346
348 T = T.getCanonicalType();
349
350 if (Loc::isLocType(T))
351 return true;
352
354 return true;
355
356 if (T->isRecordType() && !T->isUnionType())
357 return true;
358
359 return false;
360}
361
363 const SymbolRef Dependent) {
364 auto &dependencies = SymbolDependencies[Primary];
365 if (!dependencies) {
366 dependencies = std::make_unique<SymbolRefSmallVectorTy>();
367 }
368 dependencies->push_back(Dependent);
369}
370
372 const SymbolRef Primary) {
373 SymbolDependTy::const_iterator I = SymbolDependencies.find(Primary);
374 if (I == SymbolDependencies.end())
375 return nullptr;
376 return I->second.get();
377}
378
379void SymbolReaper::markDependentsLive(SymbolRef sym) {
380 // Do not mark dependents more then once.
381 SymbolMapTy::iterator LI = TheLiving.find(sym);
382 assert(LI != TheLiving.end() && "The primary symbol is not live.");
383 if (LI->second == HaveMarkedDependents)
384 return;
385 LI->second = HaveMarkedDependents;
386
387 if (const SymbolRefSmallVectorTy *Deps = SymMgr.getDependentSymbols(sym)) {
388 for (const auto I : *Deps) {
389 if (TheLiving.contains(I))
390 continue;
391 markLive(I);
392 }
393 }
394}
395
397 TheLiving[sym] = NotProcessed;
398 markDependentsLive(sym);
399}
400
402 LiveRegionRoots.insert(region->getBaseRegion());
403 markElementIndicesLive(region);
404}
405
407 LazilyCopiedRegionRoots.insert(region->getBaseRegion());
408}
409
411 for (auto SR = dyn_cast<SubRegion>(region); SR;
412 SR = dyn_cast<SubRegion>(SR->getSuperRegion())) {
413 if (const auto ER = dyn_cast<ElementRegion>(SR)) {
414 SVal Idx = ER->getIndex();
415 for (SymbolRef Sym : Idx.symbols())
416 markLive(Sym);
417 }
418 }
419}
420
422 if (isa<SymbolMetadata>(sym))
423 MetadataInUse.insert(sym);
424}
425
427 // TODO: For now, liveness of a memory region is equivalent to liveness of its
428 // base region. In fact we can do a bit better: say, if a particular FieldDecl
429 // is not used later in the path, we can diagnose a leak of a value within
430 // that field earlier than, say, the variable that contains the field dies.
431 MR = MR->getBaseRegion();
432 if (LiveRegionRoots.count(MR))
433 return true;
434
435 if (const auto *SR = dyn_cast<SymbolicRegion>(MR))
436 return isLive(SR->getSymbol());
437
438 if (const auto *VR = dyn_cast<VarRegion>(MR))
439 return isLive(VR, true);
440
441 // FIXME: This is a gross over-approximation. What we really need is a way to
442 // tell if anything still refers to this region. Unlike SymbolicRegions,
443 // AllocaRegions don't have associated symbols, though, so we don't actually
444 // have a way to track their liveness.
445 return isa<AllocaRegion, CXXThisRegion, MemSpaceRegion, CodeTextRegion>(MR);
446}
447
448bool SymbolReaper::isLazilyCopiedRegion(const MemRegion *MR) const {
449 // TODO: See comment in isLiveRegion.
450 return LazilyCopiedRegionRoots.count(MR->getBaseRegion());
451}
452
453bool SymbolReaper::isReadableRegion(const MemRegion *MR) {
454 return isLiveRegion(MR) || isLazilyCopiedRegion(MR);
455}
456
458 if (TheLiving.count(sym)) {
459 markDependentsLive(sym);
460 return true;
461 }
462
463 bool KnownLive;
464
465 switch (sym->getKind()) {
466 case SymExpr::SymbolRegionValueKind:
467 KnownLive = isReadableRegion(cast<SymbolRegionValue>(sym)->getRegion());
468 break;
469 case SymExpr::SymbolConjuredKind:
470 KnownLive = false;
471 break;
472 case SymExpr::SymbolDerivedKind:
473 KnownLive = isLive(cast<SymbolDerived>(sym)->getParentSymbol());
474 break;
475 case SymExpr::SymbolExtentKind:
476 KnownLive = isLiveRegion(cast<SymbolExtent>(sym)->getRegion());
477 break;
478 case SymExpr::SymbolMetadataKind:
479 KnownLive = MetadataInUse.count(sym) &&
480 isLiveRegion(cast<SymbolMetadata>(sym)->getRegion());
481 if (KnownLive)
482 MetadataInUse.erase(sym);
483 break;
484 case SymExpr::SymIntExprKind:
485 KnownLive = isLive(cast<SymIntExpr>(sym)->getLHS());
486 break;
487 case SymExpr::IntSymExprKind:
488 KnownLive = isLive(cast<IntSymExpr>(sym)->getRHS());
489 break;
490 case SymExpr::SymSymExprKind:
491 KnownLive = isLive(cast<SymSymExpr>(sym)->getLHS()) &&
492 isLive(cast<SymSymExpr>(sym)->getRHS());
493 break;
494 case SymExpr::SymbolCastKind:
495 KnownLive = isLive(cast<SymbolCast>(sym)->getOperand());
496 break;
497 case SymExpr::UnarySymExprKind:
498 KnownLive = isLive(cast<UnarySymExpr>(sym)->getOperand());
499 break;
500 }
501
502 if (KnownLive)
503 markLive(sym);
504
505 return KnownLive;
506}
507
508bool
509SymbolReaper::isLive(const Expr *ExprVal, const LocationContext *ELCtx) const {
510 if (LCtx == nullptr)
511 return false;
512
513 if (LCtx != ELCtx) {
514 // If the reaper's location context is a parent of the expression's
515 // location context, then the expression value is now "out of scope".
516 if (LCtx->isParentOf(ELCtx))
517 return false;
518 return true;
519 }
520
521 // If no statement is provided, everything in this and parent contexts is
522 // live.
523 if (!Loc)
524 return true;
525
526 return LCtx->getAnalysis<RelaxedLiveVariables>()->isLive(Loc, ExprVal);
527}
528
529bool SymbolReaper::isLive(const VarRegion *VR, bool includeStoreBindings) const{
530 const StackFrameContext *VarContext = VR->getStackFrame();
531
532 if (!VarContext)
533 return true;
534
535 if (!LCtx)
536 return false;
537 const StackFrameContext *CurrentContext = LCtx->getStackFrame();
538
539 if (VarContext == CurrentContext) {
540 // If no statement is provided, everything is live.
541 if (!Loc)
542 return true;
543
544 // Anonymous parameters of an inheriting constructor are live for the entire
545 // duration of the constructor.
546 if (isa<CXXInheritedCtorInitExpr>(Loc))
547 return true;
548
549 if (LCtx->getAnalysis<RelaxedLiveVariables>()->isLive(Loc, VR->getDecl()))
550 return true;
551
552 if (!includeStoreBindings)
553 return false;
554
555 unsigned &cachedQuery =
556 const_cast<SymbolReaper *>(this)->includedRegionCache[VR];
557
558 if (cachedQuery) {
559 return cachedQuery == 1;
560 }
561
562 // Query the store to see if the region occurs in any live bindings.
563 if (Store store = reapedStore.getStore()) {
564 bool hasRegion =
565 reapedStore.getStoreManager().includedInBindings(store, VR);
566 cachedQuery = hasRegion ? 1 : 2;
567 return hasRegion;
568 }
569
570 return false;
571 }
572
573 return VarContext->isParentOf(CurrentContext);
574}
Defines the clang::ASTContext interface.
This file defines AnalysisDeclContext, a class that manages the analysis context data for context sen...
static const MemRegion * getRegion(const CallEvent &Call, const MutexDescriptor &Descriptor, bool IsLock)
Expr * E
#define X(type, name)
Definition: Value.h:144
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Defines the Objective-C statement AST node classes.
do v
Definition: arm_acle.h:91
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:188
CanQualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
StringRef getOpcodeStr() const
Definition: Expr.h:3975
ASTContext & getASTContext() const LLVM_READONLY
Definition: DeclBase.cpp:520
This represents one expression.
Definition: Expr.h:110
bool isLive(const CFGBlock *B, const VarDecl *D)
Return true if a variable is live at the end of a specified block.
It wraps the AnalysisDeclContext to represent both the call stack with the help of StackFrameContext ...
bool isParentOf(const LocationContext *LC) const
const Decl * getDecl() const
const StackFrameContext * getStackFrame() const
A (possibly-)qualified type.
Definition: Type.h:929
It represents a stack frame of the call stack (based on CallEvent).
Stmt - This represents one statement.
Definition: Stmt.h:84
int64_t getID(const ASTContext &Context) const
Definition: Stmt.cpp:369
bool isIntegralOrEnumerationType() const
Determine whether this type is an integral or enumeration type.
Definition: Type.h:8625
bool isRecordType() const
Definition: Type.h:8286
bool isUnionType() const
Definition: Type.cpp:704
static StringRef getOpcodeStr(Opcode Op)
getOpcodeStr - Turn an Opcode enum value into the punctuation char it corresponds to,...
Definition: Expr.cpp:1401
A safe wrapper around APSInt objects allocated and owned by BasicValueFactory.
Definition: APSIntPtr.h:19
Template implementation for all binary symbolic expressions.
static void Profile(llvm::FoldingSetNodeID &ID, LHSTYPE lhs, BinaryOperator::Opcode op, RHSTYPE rhs, QualType t)
static void dumpToStreamImpl(raw_ostream &os, const SymExpr *Value)
static bool isLocType(QualType T)
Definition: SVals.h:262
MemRegion - The root abstract class for all memory regions.
Definition: MemRegion.h:97
LLVM_ATTRIBUTE_RETURNS_NONNULL const MemRegion * getBaseRegion() const
Definition: MemRegion.cpp:1377
SVal - This represents a symbolic expression, which can be either an L-value or an R-value.
Definition: SVals.h:56
llvm::iterator_range< SymExpr::symbol_iterator > symbols() const
Definition: SVals.h:156
SubRegion - A region that subsets another larger region.
Definition: MemRegion.h:446
Iterator over symbols that the current symbol depends on.
Definition: SymExpr.h:71
bool operator!=(const symbol_iterator &X) const
bool operator==(const symbol_iterator &X) const
Symbolic value.
Definition: SymExpr.h:30
virtual void dumpToStream(raw_ostream &os) const
Definition: SymExpr.h:61
Kind getKind() const
Definition: SymExpr.h:57
virtual void dump() const
Represents a cast expression.
static void Profile(llvm::FoldingSetNodeID &ID, const SymExpr *In, QualType From, QualType To)
void dumpToStream(raw_ostream &os) const override
A symbol representing the result of an expression in the case when we do not know anything about what...
Definition: SymbolManager.h:80
StringRef getKindStr() const override
Get a string representation of the kind of the region.
static void Profile(llvm::FoldingSetNodeID &profile, const Stmt *S, QualType T, unsigned Count, const LocationContext *LCtx, const void *SymbolTag)
void dumpToStream(raw_ostream &os) const override
QualType getType() const override
SymbolID getSymbolID() const
Definition: SymExpr.h:135
A symbol representing the value of a MemRegion whose parent region has symbolic value.
LLVM_ATTRIBUTE_RETURNS_NONNULL SymbolRef getParentSymbol() const
StringRef getKindStr() const override
Get a string representation of the kind of the region.
void dumpToStream(raw_ostream &os) const override
static void Profile(llvm::FoldingSetNodeID &profile, SymbolRef parent, const TypedValueRegion *r)
QualType getType() const override
LLVM_ATTRIBUTE_RETURNS_NONNULL const TypedValueRegion * getRegion() const
SymbolExtent - Represents the extent (size in bytes) of a bounded region.
LLVM_ATTRIBUTE_RETURNS_NONNULL const SubRegion * getRegion() const
void dumpToStream(raw_ostream &os) const override
QualType getType() const override
static void Profile(llvm::FoldingSetNodeID &profile, const SubRegion *R)
StringRef getKindStr() const override
Get a string representation of the kind of the region.
const SymbolExtent * getExtentSymbol(const SubRegion *R)
const SymbolDerived * getDerivedSymbol(SymbolRef parentSymbol, const TypedValueRegion *R)
const SymbolMetadata * getMetadataSymbol(const MemRegion *R, const Stmt *S, QualType T, const LocationContext *LCtx, unsigned VisitCount, const void *SymbolTag=nullptr)
Creates a metadata symbol associated with a specific region.
const SymbolRegionValue * getRegionValueSymbol(const TypedValueRegion *R)
Make a unique symbol for MemRegion R according to its kind.
const SymIntExpr * getSymIntExpr(const SymExpr *lhs, BinaryOperator::Opcode op, APSIntPtr rhs, QualType t)
const SymbolConjured * conjureSymbol(const Stmt *E, const LocationContext *LCtx, QualType T, unsigned VisitCount, const void *SymbolTag=nullptr)
const IntSymExpr * getIntSymExpr(APSIntPtr lhs, BinaryOperator::Opcode op, const SymExpr *rhs, QualType t)
void addSymbolDependency(const SymbolRef Primary, const SymbolRef Dependent)
Add artificial symbol dependency.
const SymbolCast * getCastSymbol(const SymExpr *Operand, QualType From, QualType To)
const UnarySymExpr * getUnarySymExpr(const SymExpr *operand, UnaryOperator::Opcode op, QualType t)
const SymbolRefSmallVectorTy * getDependentSymbols(const SymbolRef Primary)
static bool canSymbolicate(QualType T)
const SymSymExpr * getSymSymExpr(const SymExpr *lhs, BinaryOperator::Opcode op, const SymExpr *rhs, QualType t)
SymbolMetadata - Represents path-dependent metadata about a specific region.
void dumpToStream(raw_ostream &os) const override
LLVM_ATTRIBUTE_RETURNS_NONNULL const MemRegion * getRegion() const
static void Profile(llvm::FoldingSetNodeID &profile, const MemRegion *R, const Stmt *S, QualType T, const LocationContext *LCtx, unsigned Count, const void *Tag)
StringRef getKindStr() const override
Get a string representation of the kind of the region.
QualType getType() const override
A class responsible for cleaning up unused symbols.
void markLive(SymbolRef sym)
Unconditionally marks a symbol as live.
void markElementIndicesLive(const MemRegion *region)
void markInUse(SymbolRef sym)
Marks a symbol as important to a checker.
bool isLiveRegion(const MemRegion *region)
void markLazilyCopied(const MemRegion *region)
bool isLive(SymbolRef sym)
A symbol representing the value stored at a MemRegion.
Definition: SymbolManager.h:43
void dumpToStream(raw_ostream &os) const override
static void Profile(llvm::FoldingSetNodeID &profile, const TypedValueRegion *R)
Definition: SymbolManager.h:56
QualType getType() const override
StringRef getKindStr() const override
Get a string representation of the kind of the region.
TypedValueRegion - An abstract class representing regions having a typed value.
Definition: MemRegion.h:535
Represents a symbolic expression involving a unary operator.
void dumpToStream(raw_ostream &os) const override
static void Profile(llvm::FoldingSetNodeID &ID, const SymExpr *In, UnaryOperator::Opcode Op, QualType T)
const VarDecl * getDecl() const override=0
const StackFrameContext * getStackFrame() const
It might return null.
Definition: MemRegion.cpp:165
BinarySymExprImpl< const SymExpr *, const SymExpr *, SymExpr::Kind::SymSymExprKind > SymSymExpr
Represents a symbolic expression like 'x' + 'y'.
@ OS
Indicates that the tracking object is a descendant of a referenced-counted OSObject,...
BinarySymExprImpl< APSIntPtr, const SymExpr *, SymExpr::Kind::IntSymExprKind > IntSymExpr
Represents a symbolic expression like 3 - 'x'.
const void * Store
Store - This opaque type encapsulates an immutable mapping from locations to values.
Definition: StoreRef.h:27
BinarySymExprImpl< const SymExpr *, APSIntPtr, SymExpr::Kind::SymIntExprKind > SymIntExpr
Represents a symbolic expression like 'x' + 3.
The JSON file list parser is used to communicate input to InstallAPI.
BinaryOperatorKind
UnaryOperatorKind
const FunctionProtoType * T