clang 24.0.0git
SVals.h
Go to the documentation of this file.
1//===- SVals.h - Abstract Values for Static Analysis ------------*- C++ -*-===//
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 SVal, Loc, and NonLoc, classes that represent
10// abstract r-values for use with path-sensitive value tracking.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_SVALS_H
15#define LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_SVALS_H
16
17#include "clang/AST/Expr.h"
18#include "clang/AST/Type.h"
19#include "clang/Basic/LLVM.h"
22#include "llvm/ADT/APSInt.h"
23#include "llvm/ADT/FoldingSet.h"
24#include "llvm/ADT/ImmutableList.h"
25#include "llvm/ADT/ImmutableSet.h"
26#include "llvm/ADT/PointerUnion.h"
27#include "llvm/ADT/STLForwardCompat.h"
28#include "llvm/ADT/iterator_range.h"
29#include "llvm/Support/Casting.h"
30#include <cassert>
31#include <cstdint>
32#include <optional>
33#include <utility>
34
35//==------------------------------------------------------------------------==//
36// Base SVal types.
37//==------------------------------------------------------------------------==//
38
39namespace clang {
40
42class FunctionDecl;
43class LabelDecl;
44
45namespace ento {
46
47class CompoundValData;
49class MemRegion;
51class SValBuilder;
53
54/// SVal - This represents a symbolic expression, which can be either
55/// an L-value or an R-value.
56///
57class SVal {
58public:
59 enum SValKind : unsigned char {
60#define BASIC_SVAL(Id, Parent) Id##Kind,
61#define LOC_SVAL(Id, Parent) Loc##Id##Kind,
62#define NONLOC_SVAL(Id, Parent) NonLoc##Id##Kind,
63#define SVAL_RANGE(Id, First, Last) \
64 BEGIN_##Id = Id##First##Kind, END_##Id = Id##Last##Kind,
65#include "clang/StaticAnalyzer/Core/PathSensitive/SVals.def"
66 };
67
68protected:
69 const void *Data = nullptr;
70 SValKind Kind = UndefinedValKind;
71
72 explicit SVal(SValKind Kind, const void *Data = nullptr)
73 : Data(Data), Kind(Kind) {}
74
75 template <typename T> const T *castDataAs() const {
76 return static_cast<const T *>(Data);
77 }
78
79public:
80 explicit SVal() = default;
81
82 /// Convert to the specified SVal type, asserting that this SVal is of
83 /// the desired type.
84 template <typename T> T castAs() const { return llvm::cast<T>(*this); }
85
86 /// Convert to the specified SVal type, returning std::nullopt if this SVal is
87 /// not of the desired type.
88 template <typename T> std::optional<T> getAs() const {
89 return llvm::dyn_cast<T>(*this);
90 }
91
92 SValKind getKind() const { return Kind; }
93
94 StringRef getKindStr() const;
95
96 // This method is required for using SVal in a FoldingSetNode. It
97 // extracts a unique signature for this SVal object.
98 void Profile(llvm::FoldingSetNodeID &ID) const {
99 ID.AddPointer(Data);
100 ID.AddInteger(llvm::to_underlying(getKind()));
101 }
102
103 bool operator<(SVal R) const {
104 return std::tie(Data, Kind) < std::tie(R.Data, R.Kind);
105 }
106 bool operator==(SVal R) const {
107 return std::tie(Data, Kind) == std::tie(R.Data, R.Kind);
108 }
109 bool operator!=(SVal R) const { return !(*this == R); }
110
111 bool isUnknown() const { return getKind() == UnknownValKind; }
112
113 bool isUndef() const { return getKind() == UndefinedValKind; }
114
115 bool isUnknownOrUndef() const { return isUnknown() || isUndef(); }
116
117 bool isValid() const { return !isUnknownOrUndef(); }
118
119 bool isConstant() const;
120
121 bool isConstant(int I) const;
122
123 bool isZeroConstant() const;
124
125 /// getAsFunctionDecl - If this SVal is a MemRegionVal and wraps a
126 /// CodeTextRegion wrapping a FunctionDecl, return that FunctionDecl.
127 /// Otherwise return 0.
128 const FunctionDecl *getAsFunctionDecl() const;
129
130 /// If this SVal is a location and wraps a symbol, return that
131 /// SymbolRef. Otherwise return 0.
132 ///
133 /// Casts are ignored during lookup.
134 /// \param IncludeBaseRegions The boolean that controls whether the search
135 /// should continue to the base regions if the region is not symbolic.
136 SymbolRef getAsLocSymbol(bool IncludeBaseRegions = false) const;
137
138 /// Get the symbol in the SVal or its base region.
140
141 /// If this SVal wraps a symbol return that SymbolRef.
142 /// Otherwise, return 0.
143 ///
144 /// Casts are ignored during lookup.
145 /// \param IncludeBaseRegions The boolean that controls whether the search
146 /// should continue to the base regions if the region is not symbolic.
147 SymbolRef getAsSymbol(bool IncludeBaseRegions = false) const;
148
149 /// If this SVal is loc::ConcreteInt or nonloc::ConcreteInt,
150 /// return a pointer to APSInt which is held in it.
151 /// Otherwise, return nullptr.
152 const llvm::APSInt *getAsInteger() const;
153
154 const MemRegion *getAsRegion() const;
155
156 /// printJson - Pretty-prints in JSON format.
157 void printJson(raw_ostream &Out, bool AddQuotes) const;
158
159 void dumpToStream(raw_ostream &OS) const;
160 void dump() const;
161
163 return SymExpr::symbol_range(getAsSymbol(/*IncludeBaseRegions=*/true));
164 }
165
166 /// Try to get a reasonable type for the given value.
167 ///
168 /// \returns The best approximation of the value type or Null.
169 /// In theory, all symbolic values should be typed, but this function
170 /// is still a WIP and might have a few blind spots.
171 ///
172 /// \note This function should not be used when the user has access to the
173 /// bound expression AST node as well, since AST always has exact types.
174 ///
175 /// \note Loc values are interpreted as pointer rvalues for the purposes of
176 /// this method.
177 QualType getType(const ASTContext &) const;
178};
179
180inline raw_ostream &operator<<(raw_ostream &os, clang::ento::SVal V) {
181 V.dumpToStream(os);
182 return os;
183}
184
185namespace nonloc {
186/// Sub-kinds for NonLoc values.
187#define NONLOC_SVAL(Id, Parent) \
188 inline constexpr auto Id##Kind = SVal::SValKind::NonLoc##Id##Kind;
189#include "clang/StaticAnalyzer/Core/PathSensitive/SVals.def"
190} // namespace nonloc
191
192namespace loc {
193/// Sub-kinds for Loc values.
194#define LOC_SVAL(Id, Parent) \
195 inline constexpr auto Id##Kind = SVal::SValKind::Loc##Id##Kind;
196#include "clang/StaticAnalyzer/Core/PathSensitive/SVals.def"
197} // namespace loc
198
199class UndefinedVal : public SVal {
200public:
201 UndefinedVal() : SVal(UndefinedValKind) {}
202 static bool classof(SVal V) { return V.getKind() == UndefinedValKind; }
203};
204
206public:
207 // We want calling these methods to be a compiler error since they are
208 // tautologically false.
209 bool isUndef() const = delete;
210 bool isValid() const = delete;
211
212 static bool classof(SVal V) { return !V.isUndef(); }
213
214protected:
215 explicit DefinedOrUnknownSVal(SValKind Kind, const void *Data = nullptr)
216 : SVal(Kind, Data) {}
217};
218
220public:
221 explicit UnknownVal() : DefinedOrUnknownSVal(UnknownValKind) {}
222
223 static bool classof(SVal V) { return V.getKind() == UnknownValKind; }
224};
225
227public:
228 // We want calling these methods to be a compiler error since they are
229 // tautologically true/false.
230 bool isUnknown() const = delete;
231 bool isUnknownOrUndef() const = delete;
232 bool isValid() const = delete;
233
234 static bool classof(SVal V) { return !V.isUnknownOrUndef(); }
235
236protected:
237 explicit DefinedSVal(SValKind Kind, const void *Data)
239};
240
241class NonLoc : public DefinedSVal {
242protected:
244
245public:
246 void dumpToStream(raw_ostream &Out) const;
247
248 static bool isCompoundType(QualType T) {
249 return T->isArrayType() || T->isRecordType() ||
250 T->isAnyComplexType() || T->isVectorType();
251 }
252
253 static bool classof(SVal V) {
254 return BEGIN_NonLoc <= V.getKind() && V.getKind() <= END_NonLoc;
255 }
256};
257
258class Loc : public DefinedSVal {
259protected:
260 Loc(SValKind Kind, const void *Data) : DefinedSVal(Kind, Data) {}
261
262public:
263 void dumpToStream(raw_ostream &Out) const;
264
265 static bool isLocType(QualType T) {
266 return T->isAnyPointerType() || T->isBlockPointerType() ||
267 T->isReferenceType() || T->isNullPtrType();
268 }
269
270 static bool classof(SVal V) {
271 return BEGIN_Loc <= V.getKind() && V.getKind() <= END_Loc;
272 }
273};
274
275//==------------------------------------------------------------------------==//
276// Subclasses of NonLoc.
277//==------------------------------------------------------------------------==//
278
279namespace nonloc {
280
281/// Represents symbolic expression that isn't a location.
282class SymbolVal : public NonLoc {
283public:
284 SymbolVal() = delete;
285 explicit SymbolVal(SymbolRef Sym) : NonLoc(SymbolValKind, Sym) {
286 assert(Sym);
287 assert(!Loc::isLocType(Sym->getType()));
288 }
289
290 LLVM_ATTRIBUTE_RETURNS_NONNULL
292 return (const SymExpr *) Data;
293 }
294
295 bool isExpression() const {
296 return !isa<SymbolData>(getSymbol());
297 }
298
299 static bool classof(SVal V) { return V.getKind() == SymbolValKind; }
300};
301
302/// Value representing integer constant.
303class ConcreteInt : public NonLoc {
304public:
305 explicit ConcreteInt(APSIntPtr V) : NonLoc(ConcreteIntKind, V.get()) {}
306
308 // This is safe because in the ctor we take a safe APSIntPtr.
310 }
311
312 static bool classof(SVal V) { return V.getKind() == ConcreteIntKind; }
313};
314
315class LocAsInteger : public NonLoc {
316 friend class ento::SValBuilder;
317
318 explicit LocAsInteger(const std::pair<SVal, uintptr_t> &data)
319 : NonLoc(LocAsIntegerKind, &data) {
320 // We do not need to represent loc::ConcreteInt as LocAsInteger,
321 // as it'd collapse into a nonloc::ConcreteInt instead.
322 [[maybe_unused]] SValKind K = data.first.getKind();
323 assert(K == loc::MemRegionValKind || K == loc::GotoLabelKind);
324 }
325
326public:
327 Loc getLoc() const {
328 return castDataAs<std::pair<SVal, uintptr_t>>()->first.castAs<Loc>();
329 }
330
331 unsigned getNumBits() const {
333 }
334
335 static bool classof(SVal V) { return V.getKind() == LocAsIntegerKind; }
336};
337
338/// The simplest example of a concrete compound value is nonloc::CompoundVal,
339/// which represents a concrete r-value of an initializer-list or a string.
340/// Internally, it contains an llvm::ImmutableList of SVal's stored inside the
341/// literal.
342class CompoundVal : public NonLoc {
343 friend class ento::SValBuilder;
344
345 explicit CompoundVal(const CompoundValData *D) : NonLoc(CompoundValKind, D) {
346 assert(D);
347 }
348
349public:
350 LLVM_ATTRIBUTE_RETURNS_NONNULL
351 const CompoundValData* getValue() const {
353 }
354
355 using iterator = llvm::ImmutableList<SVal>::iterator;
356 iterator begin() const;
357 iterator end() const;
358
359 static bool classof(SVal V) { return V.getKind() == CompoundValKind; }
360};
361
362/// While nonloc::CompoundVal covers a few simple use cases,
363/// nonloc::LazyCompoundVal is a more performant and flexible way to represent
364/// an rvalue of record type, so it shows up much more frequently during
365/// analysis. This value is an r-value that represents a snapshot of any
366/// structure "as a whole" at a given moment during the analysis. Such value is
367/// already quite far from being referred to as "concrete", as many fields
368/// inside it would be unknown or symbolic. nonloc::LazyCompoundVal operates by
369/// storing two things:
370/// * a reference to the TypedValueRegion being snapshotted (yes, it is always
371/// typed), and also
372/// * a reference to the whole Store object, obtained from the ProgramState in
373/// which the nonloc::LazyCompoundVal was created.
374///
375/// Note that the old ProgramState and its Store is kept alive during the
376/// analysis because these are immutable functional data structures and each new
377/// Store value is represented as "earlier Store" + "additional binding".
378///
379/// Essentially, nonloc::LazyCompoundVal is a performance optimization for the
380/// analyzer. Because Store is immutable, creating a nonloc::LazyCompoundVal is
381/// a very cheap operation. Note that the Store contains all region bindings in
382/// the program state, not only related to the region. Later, if necessary, such
383/// value can be unpacked -- eg. when it is assigned to another variable.
384///
385/// If you ever need to inspect the contents of the LazyCompoundVal, you can use
386/// StoreManager::iterBindings(). It'll iterate through all values in the Store,
387/// but you're only interested in the ones that belong to
388/// LazyCompoundVal::getRegion(); other bindings are immaterial.
389///
390/// NOTE: LazyCompoundVal::getRegion() itself is also immaterial (see the actual
391/// method docs for details).
392class LazyCompoundVal : public NonLoc {
393 friend class ento::SValBuilder;
394
395 explicit LazyCompoundVal(const LazyCompoundValData *D)
396 : NonLoc(LazyCompoundValKind, D) {
397 assert(D);
398 }
399
400public:
401 LLVM_ATTRIBUTE_RETURNS_NONNULL
405
406 /// It might return null.
407 const void *getStore() const;
408
409 /// This function itself is immaterial. It is only an implementation detail.
410 /// LazyCompoundVal represents only the rvalue, the data (known or unknown)
411 /// that *was* stored in that region *at some point in the past*. The region
412 /// should not be used for any purpose other than figuring out what part of
413 /// the frozen Store you're interested in. The value does not represent the
414 /// *current* value of that region. Sometimes it may, but this should not be
415 /// relied upon. Instead, if you want to figure out what region it represents,
416 /// you typically need to see where you got it from in the first place. The
417 /// region is absolutely not analogous to the C++ "this" pointer. It is also
418 /// not a valid way to "materialize" the prvalue into a glvalue in C++,
419 /// because the region represents the *old* storage (sometimes very old), not
420 /// the *future* storage.
421 LLVM_ATTRIBUTE_RETURNS_NONNULL
422 const TypedValueRegion *getRegion() const;
423
424 static bool classof(SVal V) { return V.getKind() == LazyCompoundValKind; }
425};
426
427/// Value representing pointer-to-member.
428///
429/// This value is qualified as NonLoc because neither loading nor storing
430/// operations are applied to it. Instead, the analyzer uses the L-value coming
431/// from pointer-to-member applied to an object.
432/// This SVal is represented by a NamedDecl which can be a member function
433/// pointer or a member data pointer and an optional list of CXXBaseSpecifiers.
434/// This list is required to accumulate the pointer-to-member cast history to
435/// figure out the correct subobject field. In particular, implicit casts grow
436/// this list and explicit casts like static_cast shrink this list.
437class PointerToMember : public NonLoc {
438 friend class ento::SValBuilder;
439
440public:
442 llvm::PointerUnion<const NamedDecl *, const PointerToMemberData *>;
443
444 const PTMDataType getPTMData() const {
445 return PTMDataType::getFromOpaqueValue(const_cast<void *>(Data));
446 }
447
448 bool isNullMemberPointer() const;
449
450 const NamedDecl *getDecl() const;
451
452 template<typename AdjustedDecl>
453 const AdjustedDecl *getDeclAs() const {
454 return dyn_cast_or_null<AdjustedDecl>(getDecl());
455 }
456
457 using iterator = llvm::ImmutableList<const CXXBaseSpecifier *>::iterator;
458
459 iterator begin() const;
460 iterator end() const;
461
462 static bool classof(SVal V) { return V.getKind() == PointerToMemberKind; }
463
464private:
465 explicit PointerToMember(const PTMDataType D)
466 : NonLoc(PointerToMemberKind, D.getOpaqueValue()) {}
467};
468
469} // namespace nonloc
470
471//==------------------------------------------------------------------------==//
472// Subclasses of Loc.
473//==------------------------------------------------------------------------==//
474
475namespace loc {
476
477class GotoLabel : public Loc {
478public:
479 explicit GotoLabel(const LabelDecl *Label) : Loc(GotoLabelKind, Label) {
480 assert(Label);
481 }
482
483 const LabelDecl *getLabel() const { return castDataAs<LabelDecl>(); }
484
485 static bool classof(SVal V) { return V.getKind() == GotoLabelKind; }
486};
487
488class MemRegionVal : public Loc {
489public:
490 explicit MemRegionVal(const MemRegion *r) : Loc(MemRegionValKind, r) {
491 assert(r);
492 }
493
494 /// Get the underlining region.
495 LLVM_ATTRIBUTE_RETURNS_NONNULL
496 const MemRegion *getRegion() const { return castDataAs<MemRegion>(); }
497
498 /// Get the underlining region and strip casts.
499 LLVM_ATTRIBUTE_RETURNS_NONNULL
500 const MemRegion* stripCasts(bool StripBaseCasts = true) const;
501
502 template <typename REGION>
503 const REGION* getRegionAs() const {
504 return dyn_cast<REGION>(getRegion());
505 }
506
507 bool operator==(const MemRegionVal &R) const {
508 return getRegion() == R.getRegion();
509 }
510
511 bool operator!=(const MemRegionVal &R) const {
512 return getRegion() != R.getRegion();
513 }
514
515 static bool classof(SVal V) { return V.getKind() == MemRegionValKind; }
516};
517
518class ConcreteInt : public Loc {
519public:
520 explicit ConcreteInt(APSIntPtr V) : Loc(ConcreteIntKind, V.get()) {}
521
523 // This is safe because in the ctor we take a safe APSIntPtr.
525 }
526
527 static bool classof(SVal V) { return V.getKind() == ConcreteIntKind; }
528};
529
530} // namespace loc
531} // namespace ento
532} // namespace clang
533
534namespace llvm {
535// Allow SVal to be used as a key in ImmutableSet / ImmutableMap.
536template <>
537struct ImutContainerInfo<clang::ento::SVal>
538 : public ImutProfileInfo<clang::ento::SVal> {
545
546 static key_type_ref KeyOfValue(value_type_ref D) { return D; }
547 static data_type_ref DataOfValue(value_type_ref) { return true; }
548
550 return L == R;
551 }
552
553 static bool isLess(clang::ento::SVal L, clang::ento::SVal R) { return L < R; }
554
555 static bool isDataEqual(data_type_ref, data_type_ref) { return true; }
556};
557
558template <typename To, typename From>
559struct CastInfo<
560 To, From,
561 std::enable_if_t<std::is_base_of<::clang::ento::SVal, From>::value>>
562 : public CastIsPossible<To, ::clang::ento::SVal> {
563 using Self = CastInfo<
564 To, From,
565 std::enable_if_t<std::is_base_of<::clang::ento::SVal, From>::value>>;
566 static bool isPossible(const From &V) {
567 return To::classof(*static_cast<const ::clang::ento::SVal *>(&V));
568 }
569 static std::optional<To> castFailed() { return std::optional<To>{}; }
570 static To doCast(const From &f) {
571 return *static_cast<const To *>(cast<::clang::ento::SVal>(&f));
572 }
573 static std::optional<To> doCastIfPossible(const From &f) {
574 if (!Self::isPossible(f))
575 return Self::castFailed();
576 return doCast(f);
577 }
578};
579} // namespace llvm
580
581#endif // LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_SVALS_H
#define V(N, I)
TokenType getType() const
Returns the token's type, e.g.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
#define REGION(Id, Parent)
Definition MemRegion.h:100
C Language Family Type Representation.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition ASTContext.h:245
Represents a base class of a C++ class.
Definition DeclCXX.h:146
Represents a function declaration or definition.
Definition Decl.h:2082
Represents the declaration of a label.
Definition Decl.h:526
This represents a decl that may have a name.
Definition Decl.h:276
A (possibly-)qualified type.
Definition TypeBase.h:938
A safe wrapper around APSInt objects allocated and owned by BasicValueFactory.
Definition APSIntPtr.h:19
static APSIntPtr unsafeConstructor(const APSInt *Ptr)
You should not use this API.
Definition APSIntPtr.h:31
bool isUndef() const =delete
static bool classof(SVal V)
Definition SVals.h:212
bool isValid() const =delete
DefinedOrUnknownSVal(SValKind Kind, const void *Data=nullptr)
Definition SVals.h:215
static bool classof(SVal V)
Definition SVals.h:234
DefinedSVal(SValKind Kind, const void *Data)
Definition SVals.h:237
bool isUnknown() const =delete
bool isUnknownOrUndef() const =delete
bool isValid() const =delete
void dumpToStream(raw_ostream &Out) const
Definition SVals.cpp:379
Loc(SValKind Kind, const void *Data)
Definition SVals.h:260
static bool classof(SVal V)
Definition SVals.h:270
static bool isLocType(QualType T)
Definition SVals.h:265
MemRegion - The root abstract class for all memory regions.
Definition MemRegion.h:97
static bool isCompoundType(QualType T)
Definition SVals.h:248
static bool classof(SVal V)
Definition SVals.h:253
NonLoc(SValKind Kind, const void *Data)
Definition SVals.h:243
void dumpToStream(raw_ostream &Out) const
Definition SVals.cpp:313
SVal - This represents a symbolic expression, which can be either an L-value or an R-value.
Definition SVals.h:57
bool isUndef() const
Definition SVals.h:113
bool operator!=(SVal R) const
Definition SVals.h:109
const void * Data
Definition SVals.h:69
bool isZeroConstant() const
Definition SVals.cpp:257
bool isUnknownOrUndef() const
Definition SVals.h:115
bool operator<(SVal R) const
Definition SVals.h:103
SValKind getKind() const
Definition SVals.h:92
void dumpToStream(raw_ostream &OS) const
Definition SVals.cpp:293
const T * castDataAs() const
Definition SVals.h:75
void dump() const
Definition SVals.cpp:282
SymExpr::symbol_range symbols() const
Definition SVals.h:162
SymbolRef getAsSymbol(bool IncludeBaseRegions=false) const
If this SVal wraps a symbol return that SymbolRef.
Definition SVals.cpp:103
const FunctionDecl * getAsFunctionDecl() const
getAsFunctionDecl - If this SVal is a MemRegionVal and wraps a CodeTextRegion wrapping a FunctionDecl...
Definition SVals.cpp:45
void printJson(raw_ostream &Out, bool AddQuotes) const
printJson - Pretty-prints in JSON format.
Definition SVals.cpp:284
SValKind Kind
Definition SVals.h:70
bool isConstant() const
Definition SVals.cpp:245
SVal(SValKind Kind, const void *Data=nullptr)
Definition SVals.h:72
StringRef getKindStr() const
Definition SVals.cpp:265
void Profile(llvm::FoldingSetNodeID &ID) const
Definition SVals.h:98
std::optional< T > getAs() const
Convert to the specified SVal type, returning std::nullopt if this SVal is not of the desired type.
Definition SVals.h:88
const llvm::APSInt * getAsInteger() const
If this SVal is loc::ConcreteInt or nonloc::ConcreteInt, return a pointer to APSInt which is held in ...
Definition SVals.cpp:111
bool operator==(SVal R) const
Definition SVals.h:106
SymbolRef getAsLocSymbol(bool IncludeBaseRegions=false) const
If this SVal is a location and wraps a symbol, return that SymbolRef.
Definition SVals.cpp:67
const MemRegion * getAsRegion() const
Definition SVals.cpp:119
bool isValid() const
Definition SVals.h:117
SymbolRef getLocSymbolInBase() const
Get the symbol in the SVal or its base region.
Definition SVals.cpp:79
T castAs() const
Convert to the specified SVal type, asserting that this SVal is of the desired type.
Definition SVals.h:84
bool isUnknown() const
Definition SVals.h:111
A single-pass range of symbol_iterator that owns the worklist.
Definition SymExpr.h:123
Symbolic value.
Definition SymExpr.h:33
virtual QualType getType() const =0
TypedValueRegion - An abstract class representing regions having a typed value.
Definition MemRegion.h:570
static bool classof(SVal V)
Definition SVals.h:202
static bool classof(SVal V)
Definition SVals.h:223
static bool classof(SVal V)
Definition SVals.h:527
APSIntPtr getValue() const
Definition SVals.h:522
const LabelDecl * getLabel() const
Definition SVals.h:483
GotoLabel(const LabelDecl *Label)
Definition SVals.h:479
static bool classof(SVal V)
Definition SVals.h:485
LLVM_ATTRIBUTE_RETURNS_NONNULL const MemRegion * stripCasts(bool StripBaseCasts=true) const
Get the underlining region and strip casts.
Definition SVals.cpp:185
const REGION * getRegionAs() const
Definition SVals.h:503
MemRegionVal(const MemRegion *r)
Definition SVals.h:490
LLVM_ATTRIBUTE_RETURNS_NONNULL const MemRegion * getRegion() const
Get the underlining region.
Definition SVals.h:496
bool operator!=(const MemRegionVal &R) const
Definition SVals.h:511
bool operator==(const MemRegionVal &R) const
Definition SVals.h:507
static bool classof(SVal V)
Definition SVals.h:515
LLVM_ATTRIBUTE_RETURNS_NONNULL const CompoundValData * getValue() const
Definition SVals.h:351
static bool classof(SVal V)
Definition SVals.h:359
llvm::ImmutableList< SVal >::iterator iterator
Definition SVals.h:355
APSIntPtr getValue() const
Definition SVals.h:307
static bool classof(SVal V)
Definition SVals.h:312
LLVM_ATTRIBUTE_RETURNS_NONNULL const LazyCompoundValData * getCVData() const
Definition SVals.h:402
LLVM_ATTRIBUTE_RETURNS_NONNULL const TypedValueRegion * getRegion() const
This function itself is immaterial.
Definition SVals.cpp:193
const void * getStore() const
It might return null.
Definition SVals.cpp:189
static bool classof(SVal V)
Definition SVals.h:424
static bool classof(SVal V)
Definition SVals.h:335
unsigned getNumBits() const
Definition SVals.h:331
Value representing pointer-to-member.
Definition SVals.h:437
llvm::PointerUnion< const NamedDecl *, const PointerToMemberData * > PTMDataType
Definition SVals.h:441
llvm::ImmutableList< const CXXBaseSpecifier * >::iterator iterator
Definition SVals.h:457
const AdjustedDecl * getDeclAs() const
Definition SVals.h:453
const PTMDataType getPTMData() const
Definition SVals.h:444
const NamedDecl * getDecl() const
Definition SVals.cpp:201
static bool classof(SVal V)
Definition SVals.h:462
LLVM_ATTRIBUTE_RETURNS_NONNULL SymbolRef getSymbol() const
Definition SVals.h:291
SymbolVal(SymbolRef Sym)
Definition SVals.h:285
static bool classof(SVal V)
Definition SVals.h:299
const SymExpr * SymbolRef
Definition SymExpr.h:166
@ OS
Indicates that the tracking object is a descendant of a referenced-counted OSObject,...
raw_ostream & operator<<(raw_ostream &os, const MemRegion *R)
Definition MemRegion.h:1704
Top level wrappers for InstallAPI frontend operations.
bool isa(CodeGen::Address addr)
Definition Address.h:330
const FunctionProtoType * T
Diagnostic wrappers for TextAPI types for error reporting.
Definition Dominators.h:30
CastInfo< To, From, std::enable_if_t< std::is_base_of<::clang::ento::SVal, From >::value > > Self
Definition SVals.h:563
static data_type_ref DataOfValue(value_type_ref)
Definition SVals.h:547
static key_type_ref KeyOfValue(value_type_ref D)
Definition SVals.h:546
static bool isDataEqual(data_type_ref, data_type_ref)
Definition SVals.h:555
static bool isEqual(clang::ento::SVal L, clang::ento::SVal R)
Definition SVals.h:549
static bool isLess(clang::ento::SVal L, clang::ento::SVal R)
Definition SVals.h:553