clang  7.0.0svn
SVals.h
Go to the documentation of this file.
1 //===- SVals.h - Abstract Values for Static Analysis ------------*- 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 defines SVal, Loc, and NonLoc, classes that represent
11 // abstract r-values for use with path-sensitive value tracking.
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_SVALS_H
16 #define LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_SVALS_H
17 
18 #include "clang/AST/Expr.h"
19 #include "clang/AST/Type.h"
20 #include "clang/Basic/LLVM.h"
22 #include "llvm/ADT/FoldingSet.h"
23 #include "llvm/ADT/ImmutableList.h"
24 #include "llvm/ADT/None.h"
25 #include "llvm/ADT/Optional.h"
26 #include "llvm/ADT/PointerUnion.h"
27 #include "llvm/Support/Casting.h"
28 #include <cassert>
29 #include <cstdint>
30 #include <utility>
31 
32 //==------------------------------------------------------------------------==//
33 // Base SVal types.
34 //==------------------------------------------------------------------------==//
35 
36 namespace clang {
37 
38 class CXXBaseSpecifier;
39 class DeclaratorDecl;
40 class FunctionDecl;
41 class LabelDecl;
42 
43 namespace ento {
44 
45 class BasicValueFactory;
46 class CompoundValData;
47 class LazyCompoundValData;
48 class MemRegion;
49 class PointerToMemberData;
50 class SValBuilder;
51 class TypedValueRegion;
52 
53 namespace nonloc {
54 
55 /// Sub-kinds for NonLoc values.
56 enum Kind {
57 #define NONLOC_SVAL(Id, Parent) Id ## Kind,
58 #include "clang/StaticAnalyzer/Core/PathSensitive/SVals.def"
59 };
60 
61 } // namespace nonloc
62 
63 namespace loc {
64 
65 /// Sub-kinds for Loc values.
66 enum Kind {
67 #define LOC_SVAL(Id, Parent) Id ## Kind,
68 #include "clang/StaticAnalyzer/Core/PathSensitive/SVals.def"
69 };
70 
71 } // namespace loc
72 
73 /// SVal - This represents a symbolic expression, which can be either
74 /// an L-value or an R-value.
75 ///
76 class SVal {
77 public:
78  enum BaseKind {
79  // The enumerators must be representable using 2 bits.
80 #define BASIC_SVAL(Id, Parent) Id ## Kind,
81 #define ABSTRACT_SVAL_WITH_KIND(Id, Parent) Id ## Kind,
82 #include "clang/StaticAnalyzer/Core/PathSensitive/SVals.def"
83  };
84  enum { BaseBits = 2, BaseMask = 0x3 };
85 
86 protected:
87  const void *Data = nullptr;
88 
89  /// The lowest 2 bits are a BaseKind (0 -- 3).
90  /// The higher bits are an unsigned "kind" value.
91  unsigned Kind = 0;
92 
93  explicit SVal(const void *d, bool isLoc, unsigned ValKind)
94  : Data(d), Kind((isLoc ? LocKind : NonLocKind) | (ValKind << BaseBits)) {}
95 
96  explicit SVal(BaseKind k, const void *D = nullptr) : Data(D), Kind(k) {}
97 
98 public:
99  explicit SVal() = default;
100 
101  /// Convert to the specified SVal type, asserting that this SVal is of
102  /// the desired type.
103  template<typename T>
104  T castAs() const {
105  assert(T::isKind(*this));
106  return *static_cast<const T *>(this);
107  }
108 
109  /// Convert to the specified SVal type, returning None if this SVal is
110  /// not of the desired type.
111  template<typename T>
112  Optional<T> getAs() const {
113  if (!T::isKind(*this))
114  return None;
115  return *static_cast<const T *>(this);
116  }
117 
118  unsigned getRawKind() const { return Kind; }
119  BaseKind getBaseKind() const { return (BaseKind) (Kind & BaseMask); }
120  unsigned getSubKind() const { return (Kind & ~BaseMask) >> BaseBits; }
121 
122  // This method is required for using SVal in a FoldingSetNode. It
123  // extracts a unique signature for this SVal object.
124  void Profile(llvm::FoldingSetNodeID &ID) const {
125  ID.AddInteger((unsigned) getRawKind());
126  ID.AddPointer(Data);
127  }
128 
129  bool operator==(const SVal &R) const {
130  return getRawKind() == R.getRawKind() && Data == R.Data;
131  }
132 
133  bool operator!=(const SVal &R) const {
134  return !(*this == R);
135  }
136 
137  bool isUnknown() const {
138  return getRawKind() == UnknownValKind;
139  }
140 
141  bool isUndef() const {
142  return getRawKind() == UndefinedValKind;
143  }
144 
145  bool isUnknownOrUndef() const {
146  return getRawKind() <= UnknownValKind;
147  }
148 
149  bool isValid() const {
150  return getRawKind() > UnknownValKind;
151  }
152 
153  bool isConstant() const;
154 
155  bool isConstant(int I) const;
156 
157  bool isZeroConstant() const;
158 
159  /// hasConjuredSymbol - If this SVal wraps a conjured symbol, return true;
160  bool hasConjuredSymbol() const;
161 
162  /// getAsFunctionDecl - If this SVal is a MemRegionVal and wraps a
163  /// CodeTextRegion wrapping a FunctionDecl, return that FunctionDecl.
164  /// Otherwise return 0.
165  const FunctionDecl *getAsFunctionDecl() const;
166 
167  /// If this SVal is a location and wraps a symbol, return that
168  /// SymbolRef. Otherwise return 0.
169  ///
170  /// Casts are ignored during lookup.
171  /// \param IncludeBaseRegions The boolean that controls whether the search
172  /// should continue to the base regions if the region is not symbolic.
173  SymbolRef getAsLocSymbol(bool IncludeBaseRegions = false) const;
174 
175  /// Get the symbol in the SVal or its base region.
176  SymbolRef getLocSymbolInBase() const;
177 
178  /// If this SVal wraps a symbol return that SymbolRef.
179  /// Otherwise, return 0.
180  ///
181  /// Casts are ignored during lookup.
182  /// \param IncludeBaseRegions The boolean that controls whether the search
183  /// should continue to the base regions if the region is not symbolic.
184  SymbolRef getAsSymbol(bool IncludeBaseRegions = false) const;
185 
186  /// getAsSymbolicExpression - If this Sval wraps a symbolic expression then
187  /// return that expression. Otherwise return NULL.
188  const SymExpr *getAsSymbolicExpression() const;
189 
190  const SymExpr *getAsSymExpr() const;
191 
192  const MemRegion *getAsRegion() const;
193 
194  void dumpToStream(raw_ostream &OS) const;
195  void dump() const;
196 
198  const SymExpr *SE = getAsSymbol(/*IncludeBaseRegions=*/true);
199  if (SE)
200  return SE->symbol_begin();
201  else
202  return SymExpr::symbol_iterator();
203  }
204 
206  return SymExpr::symbol_end();
207  }
208 };
209 
210 inline raw_ostream &operator<<(raw_ostream &os, clang::ento::SVal V) {
211  V.dumpToStream(os);
212  return os;
213 }
214 
215 class UndefinedVal : public SVal {
216 public:
217  UndefinedVal() : SVal(UndefinedValKind) {}
218 
219 private:
220  friend class SVal;
221 
222  static bool isKind(const SVal& V) {
223  return V.getBaseKind() == UndefinedValKind;
224  }
225 };
226 
227 class DefinedOrUnknownSVal : public SVal {
228 public:
229  // We want calling these methods to be a compiler error since they are
230  // tautologically false.
231  bool isUndef() const = delete;
232  bool isValid() const = delete;
233 
234 protected:
235  DefinedOrUnknownSVal() = default;
236  explicit DefinedOrUnknownSVal(const void *d, bool isLoc, unsigned ValKind)
237  : SVal(d, isLoc, ValKind) {}
238  explicit DefinedOrUnknownSVal(BaseKind k, void *D = nullptr) : SVal(k, D) {}
239 
240 private:
241  friend class SVal;
242 
243  static bool isKind(const SVal& V) {
244  return !V.isUndef();
245  }
246 };
247 
249 public:
250  explicit UnknownVal() : DefinedOrUnknownSVal(UnknownValKind) {}
251 
252 private:
253  friend class SVal;
254 
255  static bool isKind(const SVal &V) {
256  return V.getBaseKind() == UnknownValKind;
257  }
258 };
259 
261 public:
262  // We want calling these methods to be a compiler error since they are
263  // tautologically true/false.
264  bool isUnknown() const = delete;
265  bool isUnknownOrUndef() const = delete;
266  bool isValid() const = delete;
267 
268 protected:
269  DefinedSVal() = default;
270  explicit DefinedSVal(const void *d, bool isLoc, unsigned ValKind)
271  : DefinedOrUnknownSVal(d, isLoc, ValKind) {}
272 
273 private:
274  friend class SVal;
275 
276  static bool isKind(const SVal& V) {
277  return !V.isUnknownOrUndef();
278  }
279 };
280 
281 /// Represents an SVal that is guaranteed to not be UnknownVal.
282 class KnownSVal : public SVal {
283  friend class SVal;
284 
285  KnownSVal() = default;
286 
287  static bool isKind(const SVal &V) {
288  return !V.isUnknown();
289  }
290 
291 public:
292  KnownSVal(const DefinedSVal &V) : SVal(V) {}
293  KnownSVal(const UndefinedVal &V) : SVal(V) {}
294 };
295 
296 class NonLoc : public DefinedSVal {
297 protected:
298  NonLoc() = default;
299  explicit NonLoc(unsigned SubKind, const void *d)
300  : DefinedSVal(d, false, SubKind) {}
301 
302 public:
303  void dumpToStream(raw_ostream &Out) const;
304 
305  static bool isCompoundType(QualType T) {
306  return T->isArrayType() || T->isRecordType() ||
307  T->isComplexType() || T->isVectorType();
308  }
309 
310 private:
311  friend class SVal;
312 
313  static bool isKind(const SVal& V) {
314  return V.getBaseKind() == NonLocKind;
315  }
316 };
317 
318 class Loc : public DefinedSVal {
319 protected:
320  Loc() = default;
321  explicit Loc(unsigned SubKind, const void *D)
322  : DefinedSVal(const_cast<void *>(D), true, SubKind) {}
323 
324 public:
325  void dumpToStream(raw_ostream &Out) const;
326 
327  static bool isLocType(QualType T) {
328  return T->isAnyPointerType() || T->isBlockPointerType() ||
329  T->isReferenceType() || T->isNullPtrType();
330  }
331 
332 private:
333  friend class SVal;
334 
335  static bool isKind(const SVal& V) {
336  return V.getBaseKind() == LocKind;
337  }
338 };
339 
340 //==------------------------------------------------------------------------==//
341 // Subclasses of NonLoc.
342 //==------------------------------------------------------------------------==//
343 
344 namespace nonloc {
345 
346 /// Represents symbolic expression.
347 class SymbolVal : public NonLoc {
348 public:
349  SymbolVal() = delete;
350  SymbolVal(SymbolRef sym) : NonLoc(SymbolValKind, sym) { assert(sym); }
351 
353  return (const SymExpr *) Data;
354  }
355 
356  bool isExpression() const {
357  return !isa<SymbolData>(getSymbol());
358  }
359 
360 private:
361  friend class SVal;
362 
363  static bool isKind(const SVal& V) {
364  return V.getBaseKind() == NonLocKind &&
365  V.getSubKind() == SymbolValKind;
366  }
367 
368  static bool isKind(const NonLoc& V) {
369  return V.getSubKind() == SymbolValKind;
370  }
371 };
372 
373 /// Value representing integer constant.
374 class ConcreteInt : public NonLoc {
375 public:
376  explicit ConcreteInt(const llvm::APSInt& V) : NonLoc(ConcreteIntKind, &V) {}
377 
378  const llvm::APSInt& getValue() const {
379  return *static_cast<const llvm::APSInt *>(Data);
380  }
381 
382  // Transfer functions for binary/unary operations on ConcreteInts.
383  SVal evalBinOp(SValBuilder &svalBuilder, BinaryOperator::Opcode Op,
384  const ConcreteInt& R) const;
385 
386  ConcreteInt evalComplement(SValBuilder &svalBuilder) const;
387 
388  ConcreteInt evalMinus(SValBuilder &svalBuilder) const;
389 
390 private:
391  friend class SVal;
392 
393  ConcreteInt() = default;
394 
395  static bool isKind(const SVal& V) {
396  return V.getBaseKind() == NonLocKind &&
397  V.getSubKind() == ConcreteIntKind;
398  }
399 
400  static bool isKind(const NonLoc& V) {
401  return V.getSubKind() == ConcreteIntKind;
402  }
403 };
404 
405 class LocAsInteger : public NonLoc {
406  friend class ento::SValBuilder;
407 
408  explicit LocAsInteger(const std::pair<SVal, uintptr_t> &data)
409  : NonLoc(LocAsIntegerKind, &data) {
410  // We do not need to represent loc::ConcreteInt as LocAsInteger,
411  // as it'd collapse into a nonloc::ConcreteInt instead.
412  assert(data.first.getBaseKind() == LocKind &&
413  (data.first.getSubKind() == loc::MemRegionValKind ||
414  data.first.getSubKind() == loc::GotoLabelKind));
415  }
416 
417 public:
418  Loc getLoc() const {
419  const std::pair<SVal, uintptr_t> *D =
420  static_cast<const std::pair<SVal, uintptr_t> *>(Data);
421  return D->first.castAs<Loc>();
422  }
423 
425  const std::pair<SVal, uintptr_t> *D =
426  static_cast<const std::pair<SVal, uintptr_t> *>(Data);
427  const SVal& V = D->first;
428  return V.castAs<Loc>();
429  }
430 
431  unsigned getNumBits() const {
432  const std::pair<SVal, uintptr_t> *D =
433  static_cast<const std::pair<SVal, uintptr_t> *>(Data);
434  return D->second;
435  }
436 
437 private:
438  friend class SVal;
439 
440  LocAsInteger() = default;
441 
442  static bool isKind(const SVal& V) {
443  return V.getBaseKind() == NonLocKind &&
444  V.getSubKind() == LocAsIntegerKind;
445  }
446 
447  static bool isKind(const NonLoc& V) {
448  return V.getSubKind() == LocAsIntegerKind;
449  }
450 };
451 
452 class CompoundVal : public NonLoc {
453  friend class ento::SValBuilder;
454 
455  explicit CompoundVal(const CompoundValData* D) : NonLoc(CompoundValKind, D) {}
456 
457 public:
458  const CompoundValData* getValue() const {
459  return static_cast<const CompoundValData *>(Data);
460  }
461 
462  using iterator = llvm::ImmutableList<SVal>::iterator;
463 
464  iterator begin() const;
465  iterator end() const;
466 
467 private:
468  friend class SVal;
469 
470  CompoundVal() = default;
471 
472  static bool isKind(const SVal& V) {
473  return V.getBaseKind() == NonLocKind && V.getSubKind() == CompoundValKind;
474  }
475 
476  static bool isKind(const NonLoc& V) {
477  return V.getSubKind() == CompoundValKind;
478  }
479 };
480 
481 class LazyCompoundVal : public NonLoc {
482  friend class ento::SValBuilder;
483 
484  explicit LazyCompoundVal(const LazyCompoundValData *D)
485  : NonLoc(LazyCompoundValKind, D) {}
486 
487 public:
489  return static_cast<const LazyCompoundValData *>(Data);
490  }
491 
492  const void *getStore() const;
493  const TypedValueRegion *getRegion() const;
494 
495 private:
496  friend class SVal;
497 
498  LazyCompoundVal() = default;
499 
500  static bool isKind(const SVal& V) {
501  return V.getBaseKind() == NonLocKind &&
502  V.getSubKind() == LazyCompoundValKind;
503  }
504 
505  static bool isKind(const NonLoc& V) {
506  return V.getSubKind() == LazyCompoundValKind;
507  }
508 };
509 
510 /// Value representing pointer-to-member.
511 ///
512 /// This value is qualified as NonLoc because neither loading nor storing
513 /// operations are applied to it. Instead, the analyzer uses the L-value coming
514 /// from pointer-to-member applied to an object.
515 /// This SVal is represented by a DeclaratorDecl which can be a member function
516 /// pointer or a member data pointer and a list of CXXBaseSpecifiers. This list
517 /// is required to accumulate the pointer-to-member cast history to figure out
518 /// the correct subobject field.
519 class PointerToMember : public NonLoc {
520  friend class ento::SValBuilder;
521 
522 public:
523  using PTMDataType =
524  llvm::PointerUnion<const DeclaratorDecl *, const PointerToMemberData *>;
525 
526  const PTMDataType getPTMData() const {
527  return PTMDataType::getFromOpaqueValue(const_cast<void *>(Data));
528  }
529 
530  bool isNullMemberPointer() const {
531  return getPTMData().isNull();
532  }
533 
534  const DeclaratorDecl *getDecl() const;
535 
536  template<typename AdjustedDecl>
537  const AdjustedDecl *getDeclAs() const {
538  return dyn_cast_or_null<AdjustedDecl>(getDecl());
539  }
540 
541  using iterator = llvm::ImmutableList<const CXXBaseSpecifier *>::iterator;
542 
543  iterator begin() const;
544  iterator end() const;
545 
546 private:
547  friend class SVal;
548 
549  PointerToMember() = default;
550  explicit PointerToMember(const PTMDataType D)
551  : NonLoc(PointerToMemberKind, D.getOpaqueValue()) {}
552 
553  static bool isKind(const SVal& V) {
554  return V.getBaseKind() == NonLocKind &&
555  V.getSubKind() == PointerToMemberKind;
556  }
557 
558  static bool isKind(const NonLoc& V) {
559  return V.getSubKind() == PointerToMemberKind;
560  }
561 };
562 
563 } // namespace nonloc
564 
565 //==------------------------------------------------------------------------==//
566 // Subclasses of Loc.
567 //==------------------------------------------------------------------------==//
568 
569 namespace loc {
570 
571 class GotoLabel : public Loc {
572 public:
573  explicit GotoLabel(const LabelDecl *Label) : Loc(GotoLabelKind, Label) {
574  assert(Label);
575  }
576 
577  const LabelDecl *getLabel() const {
578  return static_cast<const LabelDecl *>(Data);
579  }
580 
581 private:
582  friend class SVal;
583 
584  GotoLabel() = default;
585 
586  static bool isKind(const SVal& V) {
587  return V.getBaseKind() == LocKind && V.getSubKind() == GotoLabelKind;
588  }
589 
590  static bool isKind(const Loc& V) {
591  return V.getSubKind() == GotoLabelKind;
592  }
593 };
594 
595 class MemRegionVal : public Loc {
596 public:
597  explicit MemRegionVal(const MemRegion* r) : Loc(MemRegionValKind, r) {
598  assert(r);
599  }
600 
601  /// Get the underlining region.
602  const MemRegion *getRegion() const {
603  return static_cast<const MemRegion *>(Data);
604  }
605 
606  /// Get the underlining region and strip casts.
607  const MemRegion* stripCasts(bool StripBaseCasts = true) const;
608 
609  template <typename REGION>
610  const REGION* getRegionAs() const {
611  return dyn_cast<REGION>(getRegion());
612  }
613 
614  bool operator==(const MemRegionVal &R) const {
615  return getRegion() == R.getRegion();
616  }
617 
618  bool operator!=(const MemRegionVal &R) const {
619  return getRegion() != R.getRegion();
620  }
621 
622 private:
623  friend class SVal;
624 
625  MemRegionVal() = default;
626 
627  static bool isKind(const SVal& V) {
628  return V.getBaseKind() == LocKind &&
629  V.getSubKind() == MemRegionValKind;
630  }
631 
632  static bool isKind(const Loc& V) {
633  return V.getSubKind() == MemRegionValKind;
634  }
635 };
636 
637 class ConcreteInt : public Loc {
638 public:
639  explicit ConcreteInt(const llvm::APSInt& V) : Loc(ConcreteIntKind, &V) {}
640 
641  const llvm::APSInt &getValue() const {
642  return *static_cast<const llvm::APSInt *>(Data);
643  }
644 
645  // Transfer functions for binary/unary operations on ConcreteInts.
646  SVal evalBinOp(BasicValueFactory& BasicVals, BinaryOperator::Opcode Op,
647  const ConcreteInt& R) const;
648 
649 private:
650  friend class SVal;
651 
652  ConcreteInt() = default;
653 
654  static bool isKind(const SVal& V) {
655  return V.getBaseKind() == LocKind &&
656  V.getSubKind() == ConcreteIntKind;
657  }
658 
659  static bool isKind(const Loc& V) {
660  return V.getSubKind() == ConcreteIntKind;
661  }
662 };
663 
664 } // namespace loc
665 
666 } // namespace ento
667 
668 } // namespace clang
669 
670 namespace llvm {
671 
672 template <typename T> struct isPodLike;
673 template <> struct isPodLike<clang::ento::SVal> {
674  static const bool value = true;
675 };
676 
677 } // namespace llvm
678 
679 #endif // LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_SVALS_H
KnownSVal(const UndefinedVal &V)
Definition: SVals.h:293
Represents a function declaration or definition.
Definition: Decl.h:1714
TypedValueRegion - An abstract class representing regions having a typed value.
Definition: MemRegion.h:525
bool operator!=(const MemRegionVal &R) const
Definition: SVals.h:618
A (possibly-)qualified type.
Definition: Type.h:654
MemRegion - The root abstract class for all memory regions.
Definition: MemRegion.h:94
bool isBlockPointerType() const
Definition: Type.h:6056
bool isArrayType() const
Definition: Type.h:6097
SVal(BaseKind k, const void *D=nullptr)
Definition: SVals.h:96
DominatorTree GraphTraits specialization so the DominatorTree can be iterable by generic graph iterat...
Definition: Dominators.h:30
DefinedOrUnknownSVal(const void *d, bool isLoc, unsigned ValKind)
Definition: SVals.h:236
const REGION * getRegionAs() const
Definition: SVals.h:610
C Language Family Type Representation.
bool isRecordType() const
Definition: Type.h:6121
SVal(const void *d, bool isLoc, unsigned ValKind)
Definition: SVals.h:93
llvm::ImmutableList< const CXXBaseSpecifier * >::iterator iterator
Definition: SVals.h:541
Loc(unsigned SubKind, const void *D)
Definition: SVals.h:321
Value representing integer constant.
Definition: SVals.h:374
GotoLabel(const LabelDecl *Label)
Definition: SVals.h:573
static const Expr * stripCasts(ASTContext &C, const Expr *Ex)
Kind
Sub-kinds for NonLoc values.
Definition: SVals.h:56
Symbolic value.
Definition: SymExpr.h:30
const PTMDataType getPTMData() const
Definition: SVals.h:526
void dumpToStream(raw_ostream &OS) const
Definition: SVals.cpp:283
Value representing pointer-to-member.
Definition: SVals.h:519
llvm::ImmutableList< SVal >::iterator iterator
Definition: SVals.h:462
unsigned getNumBits() const
Definition: SVals.h:431
ConcreteInt(const llvm::APSInt &V)
Definition: SVals.h:376
bool isReferenceType() const
Definition: Type.h:6060
symbol_iterator symbol_begin() const
Definition: SymExpr.h:85
const LabelDecl * getLabel() const
Definition: SVals.h:577
static bool isCompoundType(QualType T)
Definition: SVals.h:305
static bool isLocType(QualType T)
Definition: SVals.h:327
BinaryOperatorKind
unsigned getRawKind() const
Definition: SVals.h:118
bool operator==(const MemRegionVal &R) const
Definition: SVals.h:614
static void dump(llvm::raw_ostream &OS, StringRef FunctionName, ArrayRef< CounterExpression > Expressions, ArrayRef< CounterMappingRegion > Regions)
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
SymbolVal(SymbolRef sym)
Definition: SVals.h:350
bool isUnknown() const
Definition: SVals.h:137
const LazyCompoundValData * getCVData() const
Definition: SVals.h:488
SymExpr::symbol_iterator symbol_end() const
Definition: SVals.h:205
#define REGION(Id, Parent)
Definition: MemRegion.h:97
bool isExpression() const
Definition: SVals.h:356
const void * Data
Definition: SVals.h:87
KnownSVal(const DefinedSVal &V)
Definition: SVals.h:292
bool isComplexType() const
isComplexType() does not include complex integers (a GCC extension).
Definition: Type.cpp:442
Represents a ValueDecl that came out of a declarator.
Definition: Decl.h:688
unsigned getSubKind() const
Definition: SVals.h:120
std::string Label
const FunctionProtoType * T
bool isNullPtrType() const
Definition: Type.h:6294
bool isValid() const
Definition: SVals.h:149
MemRegionVal(const MemRegion *r)
Definition: SVals.h:597
Optional< T > getAs() const
Convert to the specified SVal type, returning None if this SVal is not of the desired type...
Definition: SVals.h:112
const MemRegion * getRegion() const
Get the underlining region.
Definition: SVals.h:602
void Profile(llvm::FoldingSetNodeID &ID) const
Definition: SVals.h:124
#define false
Definition: stdbool.h:33
Kind
bool operator==(const SVal &R) const
Definition: SVals.h:129
NonLoc(unsigned SubKind, const void *d)
Definition: SVals.h:299
Represents the declaration of a label.
Definition: Decl.h:468
SVal - This represents a symbolic expression, which can be either an L-value or an R-value...
Definition: SVals.h:76
bool isAnyPointerType() const
Definition: Type.h:6052
bool isVectorType() const
Definition: Type.h:6133
DefinedOrUnknownSVal(BaseKind k, void *D=nullptr)
Definition: SVals.h:238
BaseKind getBaseKind() const
Definition: SVals.h:119
Dataflow Directional Tag Classes.
Kind
Sub-kinds for Loc values.
Definition: SVals.h:66
raw_ostream & operator<<(raw_ostream &Out, const CheckerBase &Checker)
Dump checker name to stream.
Definition: Checker.cpp:34
static symbol_iterator symbol_end()
Definition: SymExpr.h:86
DefinedSVal(const void *d, bool isLoc, unsigned ValKind)
Definition: SVals.h:270
Represents symbolic expression.
Definition: SVals.h:347
const llvm::APSInt & getValue() const
Definition: SVals.h:641
Represents an SVal that is guaranteed to not be UnknownVal.
Definition: SVals.h:282
T castAs() const
Convert to the specified SVal type, asserting that this SVal is of the desired type.
Definition: SVals.h:104
SymbolRef getSymbol() const
Definition: SVals.h:352
bool operator!=(const SVal &R) const
Definition: SVals.h:133
llvm::PointerUnion< const DeclaratorDecl *, const PointerToMemberData * > PTMDataType
Definition: SVals.h:524
bool isUndef() const
Definition: SVals.h:141
SymExpr::symbol_iterator symbol_begin() const
Definition: SVals.h:197
#define true
Definition: stdbool.h:32
const llvm::APSInt & getValue() const
Definition: SVals.h:378
const CompoundValData * getValue() const
Definition: SVals.h:458
ConcreteInt(const llvm::APSInt &V)
Definition: SVals.h:639
const AdjustedDecl * getDeclAs() const
Definition: SVals.h:537
bool isUnknownOrUndef() const
Definition: SVals.h:145
Iterator over symbols that the current symbol depends on.
Definition: SymExpr.h:69