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 = Alloc.make<SymbolRegionValue>(R);
174 DataSet.InsertNode(SD, InsertPos);
175 }
176
177 return cast<SymbolRegionValue>(SD);
178}
179
181 const LocationContext *LCtx,
182 QualType T,
183 unsigned Count,
184 const void *SymbolTag) {
185 llvm::FoldingSetNodeID profile;
186 SymbolConjured::Profile(profile, E, T, Count, LCtx, SymbolTag);
187 void *InsertPos;
188 SymExpr *SD = DataSet.FindNodeOrInsertPos(profile, InsertPos);
189 if (!SD) {
190 SD = Alloc.make<SymbolConjured>(E, LCtx, T, Count, SymbolTag);
191 DataSet.InsertNode(SD, InsertPos);
192 }
193
194 return cast<SymbolConjured>(SD);
195}
196
197const SymbolDerived*
199 const TypedValueRegion *R) {
200 llvm::FoldingSetNodeID profile;
201 SymbolDerived::Profile(profile, parentSymbol, R);
202 void *InsertPos;
203 SymExpr *SD = DataSet.FindNodeOrInsertPos(profile, InsertPos);
204 if (!SD) {
205 SD = Alloc.make<SymbolDerived>(parentSymbol, R);
206 DataSet.InsertNode(SD, InsertPos);
207 }
208
209 return cast<SymbolDerived>(SD);
210}
211
212const SymbolExtent*
214 llvm::FoldingSetNodeID profile;
215 SymbolExtent::Profile(profile, R);
216 void *InsertPos;
217 SymExpr *SD = DataSet.FindNodeOrInsertPos(profile, InsertPos);
218 if (!SD) {
219 SD = Alloc.make<SymbolExtent>(R);
220 DataSet.InsertNode(SD, InsertPos);
221 }
222
223 return cast<SymbolExtent>(SD);
224}
225
226const SymbolMetadata *
228 const LocationContext *LCtx,
229 unsigned Count, const void *SymbolTag) {
230 llvm::FoldingSetNodeID profile;
231 SymbolMetadata::Profile(profile, R, S, T, LCtx, Count, SymbolTag);
232 void *InsertPos;
233 SymExpr *SD = DataSet.FindNodeOrInsertPos(profile, InsertPos);
234 if (!SD) {
235 SD = Alloc.make<SymbolMetadata>(R, S, T, LCtx, Count, SymbolTag);
236 DataSet.InsertNode(SD, InsertPos);
237 }
238
239 return cast<SymbolMetadata>(SD);
240}
241
242const SymbolCast*
244 QualType From, QualType To) {
245 llvm::FoldingSetNodeID ID;
246 SymbolCast::Profile(ID, Op, From, To);
247 void *InsertPos;
248 SymExpr *data = DataSet.FindNodeOrInsertPos(ID, InsertPos);
249 if (!data) {
250 data = Alloc.make<SymbolCast>(Op, From, To);
251 DataSet.InsertNode(data, InsertPos);
252 }
253
254 return cast<SymbolCast>(data);
255}
256
259 APSIntPtr v, QualType t) {
260 llvm::FoldingSetNodeID ID;
261 SymIntExpr::Profile(ID, lhs, op, v, t);
262 void *InsertPos;
263 SymExpr *data = DataSet.FindNodeOrInsertPos(ID, InsertPos);
264
265 if (!data) {
266 data = Alloc.make<SymIntExpr>(lhs, op, v, t);
267 DataSet.InsertNode(data, InsertPos);
268 }
269
270 return cast<SymIntExpr>(data);
271}
272
275 const SymExpr *rhs, QualType t) {
276 llvm::FoldingSetNodeID ID;
277 IntSymExpr::Profile(ID, lhs, op, rhs, t);
278 void *InsertPos;
279 SymExpr *data = DataSet.FindNodeOrInsertPos(ID, InsertPos);
280
281 if (!data) {
282 data = Alloc.make<IntSymExpr>(lhs, op, rhs, t);
283 DataSet.InsertNode(data, InsertPos);
284 }
285
286 return cast<IntSymExpr>(data);
287}
288
291 const SymExpr *rhs,
292 QualType t) {
293 llvm::FoldingSetNodeID ID;
294 SymSymExpr::Profile(ID, lhs, op, rhs, t);
295 void *InsertPos;
296 SymExpr *data = DataSet.FindNodeOrInsertPos(ID, InsertPos);
297
298 if (!data) {
299 data = Alloc.make<SymSymExpr>(lhs, op, rhs, t);
300 DataSet.InsertNode(data, InsertPos);
301 }
302
303 return cast<SymSymExpr>(data);
304}
305
308 QualType T) {
309 llvm::FoldingSetNodeID ID;
310 UnarySymExpr::Profile(ID, Operand, Opc, T);
311 void *InsertPos;
312 SymExpr *data = DataSet.FindNodeOrInsertPos(ID, InsertPos);
313 if (!data) {
314 data = Alloc.make<UnarySymExpr>(Operand, Opc, T);
315 DataSet.InsertNode(data, InsertPos);
316 }
317
318 return cast<UnarySymExpr>(data);
319}
320
322 return T;
323}
324
326 return R->getValueType();
327}
328
330 ASTContext &Ctx = R->getMemRegionManager().getContext();
331 return Ctx.getSizeType();
332}
333
335 return T;
336}
337
339 return R->getValueType();
340}
341
343 T = T.getCanonicalType();
344
345 if (Loc::isLocType(T))
346 return true;
347
349 return true;
350
351 if (T->isRecordType() && !T->isUnionType())
352 return true;
353
354 return false;
355}
356
358 const SymbolRef Dependent) {
359 auto &dependencies = SymbolDependencies[Primary];
360 if (!dependencies) {
361 dependencies = std::make_unique<SymbolRefSmallVectorTy>();
362 }
363 dependencies->push_back(Dependent);
364}
365
367 const SymbolRef Primary) {
368 SymbolDependTy::const_iterator I = SymbolDependencies.find(Primary);
369 if (I == SymbolDependencies.end())
370 return nullptr;
371 return I->second.get();
372}
373
374void SymbolReaper::markDependentsLive(SymbolRef sym) {
375 // Do not mark dependents more then once.
376 SymbolMapTy::iterator LI = TheLiving.find(sym);
377 assert(LI != TheLiving.end() && "The primary symbol is not live.");
378 if (LI->second == HaveMarkedDependents)
379 return;
380 LI->second = HaveMarkedDependents;
381
382 if (const SymbolRefSmallVectorTy *Deps = SymMgr.getDependentSymbols(sym)) {
383 for (const auto I : *Deps) {
384 if (TheLiving.contains(I))
385 continue;
386 markLive(I);
387 }
388 }
389}
390
392 TheLiving[sym] = NotProcessed;
393 markDependentsLive(sym);
394}
395
397 LiveRegionRoots.insert(region->getBaseRegion());
398 markElementIndicesLive(region);
399}
400
402 LazilyCopiedRegionRoots.insert(region->getBaseRegion());
403}
404
406 for (auto SR = dyn_cast<SubRegion>(region); SR;
407 SR = dyn_cast<SubRegion>(SR->getSuperRegion())) {
408 if (const auto ER = dyn_cast<ElementRegion>(SR)) {
409 SVal Idx = ER->getIndex();
410 for (SymbolRef Sym : Idx.symbols())
411 markLive(Sym);
412 }
413 }
414}
415
417 if (isa<SymbolMetadata>(sym))
418 MetadataInUse.insert(sym);
419}
420
422 // TODO: For now, liveness of a memory region is equivalent to liveness of its
423 // base region. In fact we can do a bit better: say, if a particular FieldDecl
424 // is not used later in the path, we can diagnose a leak of a value within
425 // that field earlier than, say, the variable that contains the field dies.
426 MR = MR->getBaseRegion();
427 if (LiveRegionRoots.count(MR))
428 return true;
429
430 if (const auto *SR = dyn_cast<SymbolicRegion>(MR))
431 return isLive(SR->getSymbol());
432
433 if (const auto *VR = dyn_cast<VarRegion>(MR))
434 return isLive(VR, true);
435
436 // FIXME: This is a gross over-approximation. What we really need is a way to
437 // tell if anything still refers to this region. Unlike SymbolicRegions,
438 // AllocaRegions don't have associated symbols, though, so we don't actually
439 // have a way to track their liveness.
440 return isa<AllocaRegion, CXXThisRegion, MemSpaceRegion, CodeTextRegion>(MR);
441}
442
443bool SymbolReaper::isLazilyCopiedRegion(const MemRegion *MR) const {
444 // TODO: See comment in isLiveRegion.
445 return LazilyCopiedRegionRoots.count(MR->getBaseRegion());
446}
447
448bool SymbolReaper::isReadableRegion(const MemRegion *MR) {
449 return isLiveRegion(MR) || isLazilyCopiedRegion(MR);
450}
451
453 if (TheLiving.count(sym)) {
454 markDependentsLive(sym);
455 return true;
456 }
457
458 bool KnownLive;
459
460 switch (sym->getKind()) {
461 case SymExpr::SymbolRegionValueKind:
462 KnownLive = isReadableRegion(cast<SymbolRegionValue>(sym)->getRegion());
463 break;
464 case SymExpr::SymbolConjuredKind:
465 KnownLive = false;
466 break;
467 case SymExpr::SymbolDerivedKind:
468 KnownLive = isLive(cast<SymbolDerived>(sym)->getParentSymbol());
469 break;
470 case SymExpr::SymbolExtentKind:
471 KnownLive = isLiveRegion(cast<SymbolExtent>(sym)->getRegion());
472 break;
473 case SymExpr::SymbolMetadataKind:
474 KnownLive = MetadataInUse.count(sym) &&
475 isLiveRegion(cast<SymbolMetadata>(sym)->getRegion());
476 if (KnownLive)
477 MetadataInUse.erase(sym);
478 break;
479 case SymExpr::SymIntExprKind:
480 KnownLive = isLive(cast<SymIntExpr>(sym)->getLHS());
481 break;
482 case SymExpr::IntSymExprKind:
483 KnownLive = isLive(cast<IntSymExpr>(sym)->getRHS());
484 break;
485 case SymExpr::SymSymExprKind:
486 KnownLive = isLive(cast<SymSymExpr>(sym)->getLHS()) &&
487 isLive(cast<SymSymExpr>(sym)->getRHS());
488 break;
489 case SymExpr::SymbolCastKind:
490 KnownLive = isLive(cast<SymbolCast>(sym)->getOperand());
491 break;
492 case SymExpr::UnarySymExprKind:
493 KnownLive = isLive(cast<UnarySymExpr>(sym)->getOperand());
494 break;
495 }
496
497 if (KnownLive)
498 markLive(sym);
499
500 return KnownLive;
501}
502
503bool
504SymbolReaper::isLive(const Expr *ExprVal, const LocationContext *ELCtx) const {
505 if (LCtx == nullptr)
506 return false;
507
508 if (LCtx != ELCtx) {
509 // If the reaper's location context is a parent of the expression's
510 // location context, then the expression value is now "out of scope".
511 if (LCtx->isParentOf(ELCtx))
512 return false;
513 return true;
514 }
515
516 // If no statement is provided, everything in this and parent contexts is
517 // live.
518 if (!Loc)
519 return true;
520
521 return LCtx->getAnalysis<RelaxedLiveVariables>()->isLive(Loc, ExprVal);
522}
523
524bool SymbolReaper::isLive(const VarRegion *VR, bool includeStoreBindings) const{
525 const StackFrameContext *VarContext = VR->getStackFrame();
526
527 if (!VarContext)
528 return true;
529
530 if (!LCtx)
531 return false;
532 const StackFrameContext *CurrentContext = LCtx->getStackFrame();
533
534 if (VarContext == CurrentContext) {
535 // If no statement is provided, everything is live.
536 if (!Loc)
537 return true;
538
539 // Anonymous parameters of an inheriting constructor are live for the entire
540 // duration of the constructor.
541 if (isa<CXXInheritedCtorInitExpr>(Loc))
542 return true;
543
544 if (LCtx->getAnalysis<RelaxedLiveVariables>()->isLive(Loc, VR->getDecl()))
545 return true;
546
547 if (!includeStoreBindings)
548 return false;
549
550 unsigned &cachedQuery =
551 const_cast<SymbolReaper *>(this)->includedRegionCache[VR];
552
553 if (cachedQuery) {
554 return cachedQuery == 1;
555 }
556
557 // Query the store to see if the region occurs in any live bindings.
558 if (Store store = reapedStore.getStore()) {
559 bool hasRegion =
560 reapedStore.getStoreManager().includedInBindings(store, VR);
561 cachedQuery = hasRegion ? 1 : 2;
562 return hasRegion;
563 }
564
565 return false;
566 }
567
568 return VarContext->isParentOf(CurrentContext);
569}
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:91
bool operator!=(const symbol_iterator &X) const
bool operator==(const symbol_iterator &X) const
Symbolic value.
Definition: SymExpr.h:32
virtual void dumpToStream(raw_ostream &os) const
Definition: SymExpr.h:81
Kind getKind() const
Definition: SymExpr.h:69
virtual void dump() const
SymbolID getSymbolID() const
Get a unique identifier for this symbol.
Definition: SymExpr.h:77
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:82
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
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:44
void dumpToStream(raw_ostream &os) const override
static void Profile(llvm::FoldingSetNodeID &profile, const TypedValueRegion *R)
Definition: SymbolManager.h:58
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
@ OS
Indicates that the tracking object is a descendant of a referenced-counted OSObject,...
const void * Store
Store - This opaque type encapsulates an immutable mapping from locations to values.
Definition: StoreRef.h:27
The JSON file list parser is used to communicate input to InstallAPI.
BinaryOperatorKind
UnaryOperatorKind
const FunctionProtoType * T