/Users/buildslave/jenkins/workspace/coverage/llvm-project/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h
Line | Count | Source (jump to first uncovered line) |
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" |
20 | | #include "clang/StaticAnalyzer/Core/PathSensitive/SymExpr.h" |
21 | | #include "llvm/ADT/FoldingSet.h" |
22 | | #include "llvm/ADT/ImmutableList.h" |
23 | | #include "llvm/ADT/None.h" |
24 | | #include "llvm/ADT/Optional.h" |
25 | | #include "llvm/ADT/PointerUnion.h" |
26 | | #include "llvm/Support/Casting.h" |
27 | | #include <cassert> |
28 | | #include <cstdint> |
29 | | #include <utility> |
30 | | |
31 | | //==------------------------------------------------------------------------==// |
32 | | // Base SVal types. |
33 | | //==------------------------------------------------------------------------==// |
34 | | |
35 | | namespace clang { |
36 | | |
37 | | class CXXBaseSpecifier; |
38 | | class FunctionDecl; |
39 | | class LabelDecl; |
40 | | |
41 | | namespace ento { |
42 | | |
43 | | class BasicValueFactory; |
44 | | class CompoundValData; |
45 | | class LazyCompoundValData; |
46 | | class MemRegion; |
47 | | class PointerToMemberData; |
48 | | class SValBuilder; |
49 | | class TypedValueRegion; |
50 | | |
51 | | namespace nonloc { |
52 | | |
53 | | /// Sub-kinds for NonLoc values. |
54 | | enum Kind { |
55 | | #define NONLOC_SVAL(Id, Parent) Id ## Kind, |
56 | | #include "clang/StaticAnalyzer/Core/PathSensitive/SVals.def" |
57 | | }; |
58 | | |
59 | | } // namespace nonloc |
60 | | |
61 | | namespace loc { |
62 | | |
63 | | /// Sub-kinds for Loc values. |
64 | | enum Kind { |
65 | | #define LOC_SVAL(Id, Parent) Id ## Kind, |
66 | | #include "clang/StaticAnalyzer/Core/PathSensitive/SVals.def" |
67 | | }; |
68 | | |
69 | | } // namespace loc |
70 | | |
71 | | /// SVal - This represents a symbolic expression, which can be either |
72 | | /// an L-value or an R-value. |
73 | | /// |
74 | | class SVal { |
75 | | public: |
76 | | enum BaseKind { |
77 | | // The enumerators must be representable using 2 bits. |
78 | | #define BASIC_SVAL(Id, Parent) Id ## Kind, |
79 | | #define ABSTRACT_SVAL_WITH_KIND(Id, Parent) Id ## Kind, |
80 | | #include "clang/StaticAnalyzer/Core/PathSensitive/SVals.def" |
81 | | }; |
82 | | enum { BaseBits = 2, BaseMask = 0b11 }; |
83 | | |
84 | | protected: |
85 | | const void *Data = nullptr; |
86 | | |
87 | | /// The lowest 2 bits are a BaseKind (0 -- 3). |
88 | | /// The higher bits are an unsigned "kind" value. |
89 | | unsigned Kind = 0; |
90 | | |
91 | | explicit SVal(const void *d, bool isLoc, unsigned ValKind) |
92 | 12.2M | : Data(d), Kind((isLoc ? LocKind : NonLocKind) | (ValKind << BaseBits)) {} |
93 | | |
94 | 6.74M | explicit SVal(BaseKind k, const void *D = nullptr) : Data(D), Kind(k) {} |
95 | | |
96 | | public: |
97 | 4.05M | explicit SVal() = default; |
98 | | |
99 | | /// Convert to the specified SVal type, asserting that this SVal is of |
100 | | /// the desired type. |
101 | 14.4M | template <typename T> T castAs() const { return llvm::cast<T>(*this); } clang::ento::DefinedSVal clang::ento::SVal::castAs<clang::ento::DefinedSVal>() const Line | Count | Source | 101 | 2.10M | template <typename T> T castAs() const { return llvm::cast<T>(*this); } |
clang::ento::NonLoc clang::ento::SVal::castAs<clang::ento::NonLoc>() const Line | Count | Source | 101 | 3.39M | template <typename T> T castAs() const { return llvm::cast<T>(*this); } |
clang::ento::Loc clang::ento::SVal::castAs<clang::ento::Loc>() const Line | Count | Source | 101 | 1.68M | template <typename T> T castAs() const { return llvm::cast<T>(*this); } |
clang::ento::nonloc::ConcreteInt clang::ento::SVal::castAs<clang::ento::nonloc::ConcreteInt>() const Line | Count | Source | 101 | 1.78M | template <typename T> T castAs() const { return llvm::cast<T>(*this); } |
clang::ento::KnownSVal clang::ento::SVal::castAs<clang::ento::KnownSVal>() const Line | Count | Source | 101 | 18 | template <typename T> T castAs() const { return llvm::cast<T>(*this); } |
clang::ento::loc::MemRegionVal clang::ento::SVal::castAs<clang::ento::loc::MemRegionVal>() const Line | Count | Source | 101 | 2.14M | template <typename T> T castAs() const { return llvm::cast<T>(*this); } |
clang::ento::DefinedOrUnknownSVal clang::ento::SVal::castAs<clang::ento::DefinedOrUnknownSVal>() const Line | Count | Source | 101 | 1.02M | template <typename T> T castAs() const { return llvm::cast<T>(*this); } |
clang::ento::nonloc::CompoundVal clang::ento::SVal::castAs<clang::ento::nonloc::CompoundVal>() const Line | Count | Source | 101 | 2.35k | template <typename T> T castAs() const { return llvm::cast<T>(*this); } |
clang::ento::nonloc::SymbolVal clang::ento::SVal::castAs<clang::ento::nonloc::SymbolVal>() const Line | Count | Source | 101 | 2.08M | template <typename T> T castAs() const { return llvm::cast<T>(*this); } |
clang::ento::UndefinedVal clang::ento::SVal::castAs<clang::ento::UndefinedVal>() const Line | Count | Source | 101 | 104k | template <typename T> T castAs() const { return llvm::cast<T>(*this); } |
clang::ento::UnknownVal clang::ento::SVal::castAs<clang::ento::UnknownVal>() const Line | Count | Source | 101 | 19.3k | template <typename T> T castAs() const { return llvm::cast<T>(*this); } |
clang::ento::loc::ConcreteInt clang::ento::SVal::castAs<clang::ento::loc::ConcreteInt>() const Line | Count | Source | 101 | 87.8k | template <typename T> T castAs() const { return llvm::cast<T>(*this); } |
clang::ento::loc::GotoLabel clang::ento::SVal::castAs<clang::ento::loc::GotoLabel>() const Line | Count | Source | 101 | 189 | template <typename T> T castAs() const { return llvm::cast<T>(*this); } |
clang::ento::nonloc::LazyCompoundVal clang::ento::SVal::castAs<clang::ento::nonloc::LazyCompoundVal>() const Line | Count | Source | 101 | 42 | template <typename T> T castAs() const { return llvm::cast<T>(*this); } |
clang::ento::nonloc::LocAsInteger clang::ento::SVal::castAs<clang::ento::nonloc::LocAsInteger>() const Line | Count | Source | 101 | 1.26k | template <typename T> T castAs() const { return llvm::cast<T>(*this); } |
clang::ento::nonloc::PointerToMember clang::ento::SVal::castAs<clang::ento::nonloc::PointerToMember>() const Line | Count | Source | 101 | 139 | template <typename T> T castAs() const { return llvm::cast<T>(*this); } |
|
102 | | |
103 | | /// Convert to the specified SVal type, returning None if this SVal is |
104 | | /// not of the desired type. |
105 | 34.3M | template <typename T> Optional<T> getAs() const { |
106 | 34.3M | return llvm::dyn_cast<T>(*this); |
107 | 34.3M | } llvm::Optional<clang::ento::Loc> clang::ento::SVal::getAs<clang::ento::Loc>() const Line | Count | Source | 105 | 1.72M | template <typename T> Optional<T> getAs() const { | 106 | 1.72M | return llvm::dyn_cast<T>(*this); | 107 | 1.72M | } |
llvm::Optional<clang::ento::NonLoc> clang::ento::SVal::getAs<clang::ento::NonLoc>() const Line | Count | Source | 105 | 987k | template <typename T> Optional<T> getAs() const { | 106 | 987k | return llvm::dyn_cast<T>(*this); | 107 | 987k | } |
llvm::Optional<clang::ento::UndefinedVal> clang::ento::SVal::getAs<clang::ento::UndefinedVal>() const Line | Count | Source | 105 | 200 | template <typename T> Optional<T> getAs() const { | 106 | 200 | return llvm::dyn_cast<T>(*this); | 107 | 200 | } |
llvm::Optional<clang::ento::KnownSVal> clang::ento::SVal::getAs<clang::ento::KnownSVal>() const Line | Count | Source | 105 | 3.25k | template <typename T> Optional<T> getAs() const { | 106 | 3.25k | return llvm::dyn_cast<T>(*this); | 107 | 3.25k | } |
llvm::Optional<clang::ento::DefinedSVal> clang::ento::SVal::getAs<clang::ento::DefinedSVal>() const Line | Count | Source | 105 | 62.9k | template <typename T> Optional<T> getAs() const { | 106 | 62.9k | return llvm::dyn_cast<T>(*this); | 107 | 62.9k | } |
llvm::Optional<clang::ento::DefinedOrUnknownSVal> clang::ento::SVal::getAs<clang::ento::DefinedOrUnknownSVal>() const Line | Count | Source | 105 | 2.20k | template <typename T> Optional<T> getAs() const { | 106 | 2.20k | return llvm::dyn_cast<T>(*this); | 107 | 2.20k | } |
llvm::Optional<clang::ento::loc::GotoLabel> clang::ento::SVal::getAs<clang::ento::loc::GotoLabel>() const Line | Count | Source | 105 | 30 | template <typename T> Optional<T> getAs() const { | 106 | 30 | return llvm::dyn_cast<T>(*this); | 107 | 30 | } |
llvm::Optional<clang::ento::loc::MemRegionVal> clang::ento::SVal::getAs<clang::ento::loc::MemRegionVal>() const Line | Count | Source | 105 | 8.97M | template <typename T> Optional<T> getAs() const { | 106 | 8.97M | return llvm::dyn_cast<T>(*this); | 107 | 8.97M | } |
llvm::Optional<clang::ento::nonloc::SymbolVal> clang::ento::SVal::getAs<clang::ento::nonloc::SymbolVal>() const Line | Count | Source | 105 | 12.3M | template <typename T> Optional<T> getAs() const { | 106 | 12.3M | return llvm::dyn_cast<T>(*this); | 107 | 12.3M | } |
llvm::Optional<clang::ento::nonloc::PointerToMember> clang::ento::SVal::getAs<clang::ento::nonloc::PointerToMember>() const Line | Count | Source | 105 | 3.03k | template <typename T> Optional<T> getAs() const { | 106 | 3.03k | return llvm::dyn_cast<T>(*this); | 107 | 3.03k | } |
llvm::Optional<clang::ento::nonloc::LazyCompoundVal> clang::ento::SVal::getAs<clang::ento::nonloc::LazyCompoundVal>() const Line | Count | Source | 105 | 2.73M | template <typename T> Optional<T> getAs() const { | 106 | 2.73M | return llvm::dyn_cast<T>(*this); | 107 | 2.73M | } |
llvm::Optional<clang::ento::nonloc::LocAsInteger> clang::ento::SVal::getAs<clang::ento::nonloc::LocAsInteger>() const Line | Count | Source | 105 | 3.54M | template <typename T> Optional<T> getAs() const { | 106 | 3.54M | return llvm::dyn_cast<T>(*this); | 107 | 3.54M | } |
llvm::Optional<clang::ento::nonloc::CompoundVal> clang::ento::SVal::getAs<clang::ento::nonloc::CompoundVal>() const Line | Count | Source | 105 | 397k | template <typename T> Optional<T> getAs() const { | 106 | 397k | return llvm::dyn_cast<T>(*this); | 107 | 397k | } |
llvm::Optional<clang::ento::loc::ConcreteInt> clang::ento::SVal::getAs<clang::ento::loc::ConcreteInt>() const Line | Count | Source | 105 | 1.59M | template <typename T> Optional<T> getAs() const { | 106 | 1.59M | return llvm::dyn_cast<T>(*this); | 107 | 1.59M | } |
llvm::Optional<clang::ento::nonloc::ConcreteInt> clang::ento::SVal::getAs<clang::ento::nonloc::ConcreteInt>() const Line | Count | Source | 105 | 1.98M | template <typename T> Optional<T> getAs() const { | 106 | 1.98M | return llvm::dyn_cast<T>(*this); | 107 | 1.98M | } |
|
108 | | |
109 | 42.0M | unsigned getRawKind() const { return Kind; } |
110 | 52.1M | BaseKind getBaseKind() const { return (BaseKind) (Kind & BaseMask); } |
111 | 36.2M | unsigned getSubKind() const { return Kind >> BaseBits; } |
112 | | |
113 | | // This method is required for using SVal in a FoldingSetNode. It |
114 | | // extracts a unique signature for this SVal object. |
115 | 6.55M | void Profile(llvm::FoldingSetNodeID &ID) const { |
116 | 6.55M | ID.AddInteger((unsigned) getRawKind()); |
117 | 6.55M | ID.AddPointer(Data); |
118 | 6.55M | } |
119 | | |
120 | 10.3M | bool operator==(SVal R) const { |
121 | 10.3M | return getRawKind() == R.getRawKind() && Data == R.Data10.0M ; |
122 | 10.3M | } |
123 | | |
124 | 2.26M | bool operator!=(SVal R) const { return !(*this == R); } |
125 | | |
126 | 2.69M | bool isUnknown() const { |
127 | 2.69M | return getRawKind() == UnknownValKind; |
128 | 2.69M | } |
129 | | |
130 | 8.84M | bool isUndef() const { |
131 | 8.84M | return getRawKind() == UndefinedValKind; |
132 | 8.84M | } |
133 | | |
134 | 2.90M | bool isUnknownOrUndef() const { |
135 | 2.90M | return getRawKind() <= UnknownValKind; |
136 | 2.90M | } |
137 | | |
138 | 445k | bool isValid() const { |
139 | 445k | return getRawKind() > UnknownValKind; |
140 | 445k | } |
141 | | |
142 | | bool isConstant() const; |
143 | | |
144 | | bool isConstant(int I) const; |
145 | | |
146 | | bool isZeroConstant() const; |
147 | | |
148 | | /// getAsFunctionDecl - If this SVal is a MemRegionVal and wraps a |
149 | | /// CodeTextRegion wrapping a FunctionDecl, return that FunctionDecl. |
150 | | /// Otherwise return 0. |
151 | | const FunctionDecl *getAsFunctionDecl() const; |
152 | | |
153 | | /// If this SVal is a location and wraps a symbol, return that |
154 | | /// SymbolRef. Otherwise return 0. |
155 | | /// |
156 | | /// Casts are ignored during lookup. |
157 | | /// \param IncludeBaseRegions The boolean that controls whether the search |
158 | | /// should continue to the base regions if the region is not symbolic. |
159 | | SymbolRef getAsLocSymbol(bool IncludeBaseRegions = false) const; |
160 | | |
161 | | /// Get the symbol in the SVal or its base region. |
162 | | SymbolRef getLocSymbolInBase() const; |
163 | | |
164 | | /// If this SVal wraps a symbol return that SymbolRef. |
165 | | /// Otherwise, return 0. |
166 | | /// |
167 | | /// Casts are ignored during lookup. |
168 | | /// \param IncludeBaseRegions The boolean that controls whether the search |
169 | | /// should continue to the base regions if the region is not symbolic. |
170 | | SymbolRef getAsSymbol(bool IncludeBaseRegions = false) const; |
171 | | |
172 | | /// If this SVal is loc::ConcreteInt or nonloc::ConcreteInt, |
173 | | /// return a pointer to APSInt which is held in it. |
174 | | /// Otherwise, return nullptr. |
175 | | const llvm::APSInt *getAsInteger() const; |
176 | | |
177 | | const MemRegion *getAsRegion() const; |
178 | | |
179 | | /// printJson - Pretty-prints in JSON format. |
180 | | void printJson(raw_ostream &Out, bool AddQuotes) const; |
181 | | |
182 | | void dumpToStream(raw_ostream &OS) const; |
183 | | void dump() const; |
184 | | |
185 | 1.90M | SymExpr::symbol_iterator symbol_begin() const { |
186 | 1.90M | const SymExpr *SE = getAsSymbol(/*IncludeBaseRegions=*/true); |
187 | 1.90M | if (SE) |
188 | 1.05M | return SE->symbol_begin(); |
189 | 851k | else |
190 | 851k | return SymExpr::symbol_iterator(); |
191 | 1.90M | } |
192 | | |
193 | 1.90M | SymExpr::symbol_iterator symbol_end() const { |
194 | 1.90M | return SymExpr::symbol_end(); |
195 | 1.90M | } |
196 | | |
197 | | /// Try to get a reasonable type for the given value. |
198 | | /// |
199 | | /// \returns The best approximation of the value type or Null. |
200 | | /// In theory, all symbolic values should be typed, but this function |
201 | | /// is still a WIP and might have a few blind spots. |
202 | | /// |
203 | | /// \note This function should not be used when the user has access to the |
204 | | /// bound expression AST node as well, since AST always has exact types. |
205 | | /// |
206 | | /// \note Loc values are interpreted as pointer rvalues for the purposes of |
207 | | /// this method. |
208 | | QualType getType(const ASTContext &) const; |
209 | | }; |
210 | | |
211 | 3.43k | inline raw_ostream &operator<<(raw_ostream &os, clang::ento::SVal V) { |
212 | 3.43k | V.dumpToStream(os); |
213 | 3.43k | return os; |
214 | 3.43k | } |
215 | | |
216 | | class UndefinedVal : public SVal { |
217 | | public: |
218 | 6.32M | UndefinedVal() : SVal(UndefinedValKind) {} |
219 | 778k | static bool classof(SVal V) { return V.getBaseKind() == UndefinedValKind; } |
220 | | }; |
221 | | |
222 | | class DefinedOrUnknownSVal : public SVal { |
223 | | public: |
224 | | // We want calling these methods to be a compiler error since they are |
225 | | // tautologically false. |
226 | | bool isUndef() const = delete; |
227 | | bool isValid() const = delete; |
228 | | |
229 | 1.03M | static bool classof(SVal V) { return !V.isUndef(); } |
230 | | |
231 | | protected: |
232 | | explicit DefinedOrUnknownSVal(const void *d, bool isLoc, unsigned ValKind) |
233 | 12.2M | : SVal(d, isLoc, ValKind) {} |
234 | 416k | explicit DefinedOrUnknownSVal(BaseKind k, void *D = nullptr) : SVal(k, D) {} |
235 | | }; |
236 | | |
237 | | class UnknownVal : public DefinedOrUnknownSVal { |
238 | | public: |
239 | 416k | explicit UnknownVal() : DefinedOrUnknownSVal(UnknownValKind) {} |
240 | | |
241 | 693k | static bool classof(SVal V) { return V.getBaseKind() == UnknownValKind; } |
242 | | }; |
243 | | |
244 | | class DefinedSVal : public DefinedOrUnknownSVal { |
245 | | public: |
246 | | // We want calling these methods to be a compiler error since they are |
247 | | // tautologically true/false. |
248 | | bool isUnknown() const = delete; |
249 | | bool isUnknownOrUndef() const = delete; |
250 | | bool isValid() const = delete; |
251 | | |
252 | 2.17M | static bool classof(SVal V) { return !V.isUnknownOrUndef(); } |
253 | | |
254 | | protected: |
255 | | explicit DefinedSVal(const void *d, bool isLoc, unsigned ValKind) |
256 | 12.2M | : DefinedOrUnknownSVal(d, isLoc, ValKind) {} |
257 | | }; |
258 | | |
259 | | /// Represents an SVal that is guaranteed to not be UnknownVal. |
260 | | class KnownSVal : public SVal { |
261 | | public: |
262 | 0 | KnownSVal(const DefinedSVal &V) : SVal(V) {} |
263 | 6 | KnownSVal(const UndefinedVal &V) : SVal(V) {} |
264 | 3.27k | static bool classof(SVal V) { return !V.isUnknown(); } |
265 | | }; |
266 | | |
267 | | class NonLoc : public DefinedSVal { |
268 | | protected: |
269 | | explicit NonLoc(unsigned SubKind, const void *d) |
270 | 10.6M | : DefinedSVal(d, false, SubKind) {} |
271 | | |
272 | | public: |
273 | | void dumpToStream(raw_ostream &Out) const; |
274 | | |
275 | 21.6k | static bool isCompoundType(QualType T) { |
276 | 21.6k | return T->isArrayType() || T->isRecordType()20.0k || |
277 | 21.6k | T->isAnyComplexType()11 || T->isVectorType()6 ; |
278 | 21.6k | } |
279 | | |
280 | 4.74M | static bool classof(SVal V) { return V.getBaseKind() == NonLocKind; } |
281 | | }; |
282 | | |
283 | | class Loc : public DefinedSVal { |
284 | | protected: |
285 | | explicit Loc(unsigned SubKind, const void *D) |
286 | 1.55M | : DefinedSVal(const_cast<void *>(D), true, SubKind) {} |
287 | | |
288 | | public: |
289 | | void dumpToStream(raw_ostream &Out) const; |
290 | | |
291 | 24.4M | static bool isLocType(QualType T) { |
292 | 24.4M | return T->isAnyPointerType() || T->isBlockPointerType()23.2M || |
293 | 24.4M | T->isReferenceType()23.2M || T->isNullPtrType()23.2M ; |
294 | 24.4M | } |
295 | | |
296 | 3.95M | static bool classof(SVal V) { return V.getBaseKind() == LocKind; } |
297 | | }; |
298 | | |
299 | | //==------------------------------------------------------------------------==// |
300 | | // Subclasses of NonLoc. |
301 | | //==------------------------------------------------------------------------==// |
302 | | |
303 | | namespace nonloc { |
304 | | |
305 | | /// Represents symbolic expression that isn't a location. |
306 | | class SymbolVal : public NonLoc { |
307 | | public: |
308 | | SymbolVal() = delete; |
309 | 9.10M | SymbolVal(SymbolRef sym) : NonLoc(SymbolValKind, sym) { |
310 | 9.10M | assert(sym); |
311 | 0 | assert(!Loc::isLocType(sym->getType())); |
312 | 9.10M | } |
313 | | |
314 | | LLVM_ATTRIBUTE_RETURNS_NONNULL |
315 | 11.4M | SymbolRef getSymbol() const { |
316 | 11.4M | return (const SymExpr *) Data; |
317 | 11.4M | } |
318 | | |
319 | 276k | bool isExpression() const { |
320 | 276k | return !isa<SymbolData>(getSymbol()); |
321 | 276k | } |
322 | | |
323 | 14.4M | static bool classof(SVal V) { |
324 | 14.4M | return V.getBaseKind() == NonLocKind && V.getSubKind() == SymbolValKind13.2M ; |
325 | 14.4M | } |
326 | | |
327 | 0 | static bool classof(NonLoc V) { return V.getSubKind() == SymbolValKind; } |
328 | | }; |
329 | | |
330 | | /// Value representing integer constant. |
331 | | class ConcreteInt : public NonLoc { |
332 | | public: |
333 | 1.50M | explicit ConcreteInt(const llvm::APSInt& V) : NonLoc(ConcreteIntKind, &V) {} |
334 | | |
335 | 1.65M | const llvm::APSInt& getValue() const { |
336 | 1.65M | return *static_cast<const llvm::APSInt *>(Data); |
337 | 1.65M | } |
338 | | |
339 | 3.79M | static bool classof(SVal V) { |
340 | 3.79M | return V.getBaseKind() == NonLocKind && V.getSubKind() == ConcreteIntKind3.58M ; |
341 | 3.79M | } |
342 | | |
343 | 0 | static bool classof(NonLoc V) { return V.getSubKind() == ConcreteIntKind; } |
344 | | }; |
345 | | |
346 | | class LocAsInteger : public NonLoc { |
347 | | friend class ento::SValBuilder; |
348 | | |
349 | | explicit LocAsInteger(const std::pair<SVal, uintptr_t> &data) |
350 | 406 | : NonLoc(LocAsIntegerKind, &data) { |
351 | | // We do not need to represent loc::ConcreteInt as LocAsInteger, |
352 | | // as it'd collapse into a nonloc::ConcreteInt instead. |
353 | 406 | assert(data.first.getBaseKind() == LocKind && |
354 | 406 | (data.first.getSubKind() == loc::MemRegionValKind || |
355 | 406 | data.first.getSubKind() == loc::GotoLabelKind)); |
356 | 406 | } |
357 | | |
358 | | public: |
359 | 3.87k | Loc getLoc() const { |
360 | 3.87k | const std::pair<SVal, uintptr_t> *D = |
361 | 3.87k | static_cast<const std::pair<SVal, uintptr_t> *>(Data); |
362 | 3.87k | return D->first.castAs<Loc>(); |
363 | 3.87k | } |
364 | | |
365 | 643 | unsigned getNumBits() const { |
366 | 643 | const std::pair<SVal, uintptr_t> *D = |
367 | 643 | static_cast<const std::pair<SVal, uintptr_t> *>(Data); |
368 | 643 | return D->second; |
369 | 643 | } |
370 | | |
371 | 3.54M | static bool classof(SVal V) { |
372 | 3.54M | return V.getBaseKind() == NonLocKind && V.getSubKind() == LocAsIntegerKind2.88M ; |
373 | 3.54M | } |
374 | | |
375 | 0 | static bool classof(NonLoc V) { return V.getSubKind() == LocAsIntegerKind; } |
376 | | }; |
377 | | |
378 | | class CompoundVal : public NonLoc { |
379 | | friend class ento::SValBuilder; |
380 | | |
381 | 1.27k | explicit CompoundVal(const CompoundValData *D) : NonLoc(CompoundValKind, D) { |
382 | 1.27k | assert(D); |
383 | 1.27k | } |
384 | | |
385 | | public: |
386 | | LLVM_ATTRIBUTE_RETURNS_NONNULL |
387 | 7.28k | const CompoundValData* getValue() const { |
388 | 7.28k | return static_cast<const CompoundValData *>(Data); |
389 | 7.28k | } |
390 | | |
391 | | using iterator = llvm::ImmutableList<SVal>::iterator; |
392 | | |
393 | | iterator begin() const; |
394 | | iterator end() const; |
395 | | |
396 | 400k | static bool classof(SVal V) { |
397 | 400k | return V.getBaseKind() == NonLocKind && V.getSubKind() == CompoundValKind277k ; |
398 | 400k | } |
399 | | |
400 | 0 | static bool classof(NonLoc V) { return V.getSubKind() == CompoundValKind; } |
401 | | }; |
402 | | |
403 | | class LazyCompoundVal : public NonLoc { |
404 | | friend class ento::SValBuilder; |
405 | | |
406 | | explicit LazyCompoundVal(const LazyCompoundValData *D) |
407 | 57.3k | : NonLoc(LazyCompoundValKind, D) { |
408 | 57.3k | assert(D); |
409 | 57.3k | } |
410 | | |
411 | | public: |
412 | | LLVM_ATTRIBUTE_RETURNS_NONNULL |
413 | 72.8k | const LazyCompoundValData *getCVData() const { |
414 | 72.8k | return static_cast<const LazyCompoundValData *>(Data); |
415 | 72.8k | } |
416 | | |
417 | | /// It might return null. |
418 | | const void *getStore() const; |
419 | | |
420 | | LLVM_ATTRIBUTE_RETURNS_NONNULL |
421 | | const TypedValueRegion *getRegion() const; |
422 | | |
423 | 3.17M | static bool classof(SVal V) { |
424 | 3.17M | return V.getBaseKind() == NonLocKind && |
425 | 3.17M | V.getSubKind() == LazyCompoundValKind2.35M ; |
426 | 3.17M | } |
427 | | |
428 | 0 | static bool classof(NonLoc V) { |
429 | 0 | return V.getSubKind() == LazyCompoundValKind; |
430 | 0 | } |
431 | | }; |
432 | | |
433 | | /// Value representing pointer-to-member. |
434 | | /// |
435 | | /// This value is qualified as NonLoc because neither loading nor storing |
436 | | /// operations are applied to it. Instead, the analyzer uses the L-value coming |
437 | | /// from pointer-to-member applied to an object. |
438 | | /// This SVal is represented by a NamedDecl which can be a member function |
439 | | /// pointer or a member data pointer and an optional list of CXXBaseSpecifiers. |
440 | | /// This list is required to accumulate the pointer-to-member cast history to |
441 | | /// figure out the correct subobject field. In particular, implicit casts grow |
442 | | /// this list and explicit casts like static_cast shrink this list. |
443 | | class PointerToMember : public NonLoc { |
444 | | friend class ento::SValBuilder; |
445 | | |
446 | | public: |
447 | | using PTMDataType = |
448 | | llvm::PointerUnion<const NamedDecl *, const PointerToMemberData *>; |
449 | | |
450 | 629 | const PTMDataType getPTMData() const { |
451 | 629 | return PTMDataType::getFromOpaqueValue(const_cast<void *>(Data)); |
452 | 629 | } |
453 | | |
454 | | bool isNullMemberPointer() const; |
455 | | |
456 | | const NamedDecl *getDecl() const; |
457 | | |
458 | | template<typename AdjustedDecl> |
459 | 59 | const AdjustedDecl *getDeclAs() const { |
460 | 59 | return dyn_cast_or_null<AdjustedDecl>(getDecl()); |
461 | 59 | } clang::FieldDecl const* clang::ento::nonloc::PointerToMember::getDeclAs<clang::FieldDecl>() const Line | Count | Source | 459 | 36 | const AdjustedDecl *getDeclAs() const { | 460 | 36 | return dyn_cast_or_null<AdjustedDecl>(getDecl()); | 461 | 36 | } |
clang::IndirectFieldDecl const* clang::ento::nonloc::PointerToMember::getDeclAs<clang::IndirectFieldDecl>() const Line | Count | Source | 459 | 23 | const AdjustedDecl *getDeclAs() const { | 460 | 23 | return dyn_cast_or_null<AdjustedDecl>(getDecl()); | 461 | 23 | } |
|
462 | | |
463 | | using iterator = llvm::ImmutableList<const CXXBaseSpecifier *>::iterator; |
464 | | |
465 | | iterator begin() const; |
466 | | iterator end() const; |
467 | | |
468 | 27.4k | static bool classof(SVal V) { |
469 | 27.4k | return V.getBaseKind() == NonLocKind && |
470 | 27.4k | V.getSubKind() == PointerToMemberKind926 ; |
471 | 27.4k | } |
472 | | |
473 | 0 | static bool classof(NonLoc V) { |
474 | 0 | return V.getSubKind() == PointerToMemberKind; |
475 | 0 | } |
476 | | |
477 | | private: |
478 | | explicit PointerToMember(const PTMDataType D) |
479 | 98 | : NonLoc(PointerToMemberKind, D.getOpaqueValue()) {} |
480 | | }; |
481 | | |
482 | | } // namespace nonloc |
483 | | |
484 | | //==------------------------------------------------------------------------==// |
485 | | // Subclasses of Loc. |
486 | | //==------------------------------------------------------------------------==// |
487 | | |
488 | | namespace loc { |
489 | | |
490 | | class GotoLabel : public Loc { |
491 | | public: |
492 | 156 | explicit GotoLabel(const LabelDecl *Label) : Loc(GotoLabelKind, Label) { |
493 | 156 | assert(Label); |
494 | 156 | } |
495 | | |
496 | 16 | const LabelDecl *getLabel() const { |
497 | 16 | return static_cast<const LabelDecl *>(Data); |
498 | 16 | } |
499 | | |
500 | 15.5k | static bool classof(SVal V) { |
501 | 15.5k | return V.getBaseKind() == LocKind && V.getSubKind() == GotoLabelKind15.5k ; |
502 | 15.5k | } |
503 | | |
504 | 0 | static bool classof(Loc V) { return V.getSubKind() == GotoLabelKind; } |
505 | | }; |
506 | | |
507 | | class MemRegionVal : public Loc { |
508 | | public: |
509 | 1.49M | explicit MemRegionVal(const MemRegion* r) : Loc(MemRegionValKind, r) { |
510 | 1.49M | assert(r); |
511 | 1.49M | } |
512 | | |
513 | | /// Get the underlining region. |
514 | 6.51M | const MemRegion *getRegion() const { |
515 | 6.51M | return static_cast<const MemRegion *>(Data); |
516 | 6.51M | } |
517 | | |
518 | | /// Get the underlining region and strip casts. |
519 | | const MemRegion* stripCasts(bool StripBaseCasts = true) const; |
520 | | |
521 | | template <typename REGION> |
522 | 16.3k | const REGION* getRegionAs() const { |
523 | 16.3k | return dyn_cast<REGION>(getRegion()); |
524 | 16.3k | } clang::ento::FieldRegion const* clang::ento::loc::MemRegionVal::getRegionAs<clang::ento::FieldRegion>() const Line | Count | Source | 522 | 662 | const REGION* getRegionAs() const { | 523 | 662 | return dyn_cast<REGION>(getRegion()); | 524 | 662 | } |
clang::ento::TypedValueRegion const* clang::ento::loc::MemRegionVal::getRegionAs<clang::ento::TypedValueRegion>() const Line | Count | Source | 522 | 80 | const REGION* getRegionAs() const { | 523 | 80 | return dyn_cast<REGION>(getRegion()); | 524 | 80 | } |
clang::ento::SymbolicRegion const* clang::ento::loc::MemRegionVal::getRegionAs<clang::ento::SymbolicRegion>() const Line | Count | Source | 522 | 244 | const REGION* getRegionAs() const { | 523 | 244 | return dyn_cast<REGION>(getRegion()); | 524 | 244 | } |
clang::ento::AllocaRegion const* clang::ento::loc::MemRegionVal::getRegionAs<clang::ento::AllocaRegion>() const Line | Count | Source | 522 | 73 | const REGION* getRegionAs() const { | 523 | 73 | return dyn_cast<REGION>(getRegion()); | 524 | 73 | } |
clang::ento::SubRegion const* clang::ento::loc::MemRegionVal::getRegionAs<clang::ento::SubRegion>() const Line | Count | Source | 522 | 15.2k | const REGION* getRegionAs() const { | 523 | 15.2k | return dyn_cast<REGION>(getRegion()); | 524 | 15.2k | } |
|
525 | | |
526 | 0 | bool operator==(const MemRegionVal &R) const { |
527 | 0 | return getRegion() == R.getRegion(); |
528 | 0 | } |
529 | | |
530 | 0 | bool operator!=(const MemRegionVal &R) const { |
531 | 0 | return getRegion() != R.getRegion(); |
532 | 0 | } |
533 | | |
534 | 11.1M | static bool classof(SVal V) { |
535 | 11.1M | return V.getBaseKind() == LocKind && V.getSubKind() == MemRegionValKind7.59M ; |
536 | 11.1M | } |
537 | | |
538 | 0 | static bool classof(Loc V) { return V.getSubKind() == MemRegionValKind; } |
539 | | }; |
540 | | |
541 | | class ConcreteInt : public Loc { |
542 | | public: |
543 | 57.4k | explicit ConcreteInt(const llvm::APSInt& V) : Loc(ConcreteIntKind, &V) {} |
544 | | |
545 | 97.3k | const llvm::APSInt &getValue() const { |
546 | 97.3k | return *static_cast<const llvm::APSInt *>(Data); |
547 | 97.3k | } |
548 | | |
549 | 1.71M | static bool classof(SVal V) { |
550 | 1.71M | return V.getBaseKind() == LocKind && V.getSubKind() == ConcreteIntKind1.12M ; |
551 | 1.71M | } |
552 | | |
553 | 0 | static bool classof(Loc V) { return V.getSubKind() == ConcreteIntKind; } |
554 | | }; |
555 | | |
556 | | } // namespace loc |
557 | | } // namespace ento |
558 | | } // namespace clang |
559 | | |
560 | | namespace llvm { |
561 | | template <typename To, typename From> |
562 | | struct CastInfo< |
563 | | To, From, |
564 | | std::enable_if_t<std::is_base_of<::clang::ento::SVal, From>::value>> |
565 | | : public CastIsPossible<To, ::clang::ento::SVal> { |
566 | | using Self = CastInfo< |
567 | | To, From, |
568 | | std::enable_if_t<std::is_base_of<::clang::ento::SVal, From>::value>>; |
569 | 51.6M | static bool isPossible(const From &V) { |
570 | 51.6M | return To::classof(*static_cast<const ::clang::ento::SVal *>(&V)); |
571 | 51.6M | } llvm::CastInfo<clang::ento::DefinedSVal, clang::ento::SVal const, void>::isPossible(clang::ento::SVal const&) Line | Count | Source | 569 | 2.17M | static bool isPossible(const From &V) { | 570 | 2.17M | return To::classof(*static_cast<const ::clang::ento::SVal *>(&V)); | 571 | 2.17M | } |
llvm::CastInfo<clang::ento::NonLoc, clang::ento::DefinedOrUnknownSVal const, void>::isPossible(clang::ento::DefinedOrUnknownSVal const&) Line | Count | Source | 569 | 76.5k | static bool isPossible(const From &V) { | 570 | 76.5k | return To::classof(*static_cast<const ::clang::ento::SVal *>(&V)); | 571 | 76.5k | } |
llvm::CastInfo<clang::ento::NonLoc, clang::ento::SVal const, void>::isPossible(clang::ento::SVal const&) Line | Count | Source | 569 | 4.66M | static bool isPossible(const From &V) { | 570 | 4.66M | return To::classof(*static_cast<const ::clang::ento::SVal *>(&V)); | 571 | 4.66M | } |
llvm::CastInfo<clang::ento::Loc, clang::ento::DefinedSVal const, void>::isPossible(clang::ento::DefinedSVal const&) Line | Count | Source | 569 | 34.5k | static bool isPossible(const From &V) { | 570 | 34.5k | return To::classof(*static_cast<const ::clang::ento::SVal *>(&V)); | 571 | 34.5k | } |
llvm::CastInfo<clang::ento::Loc, clang::ento::SVal const, void>::isPossible(clang::ento::SVal const&) Line | Count | Source | 569 | 3.67M | static bool isPossible(const From &V) { | 570 | 3.67M | return To::classof(*static_cast<const ::clang::ento::SVal *>(&V)); | 571 | 3.67M | } |
llvm::CastInfo<clang::ento::nonloc::ConcreteInt, clang::ento::NonLoc const, void>::isPossible(clang::ento::NonLoc const&) Line | Count | Source | 569 | 21.3k | static bool isPossible(const From &V) { | 570 | 21.3k | return To::classof(*static_cast<const ::clang::ento::SVal *>(&V)); | 571 | 21.3k | } |
llvm::CastInfo<clang::ento::nonloc::ConcreteInt, clang::ento::SVal const, void>::isPossible(clang::ento::SVal const&) Line | Count | Source | 569 | 3.77M | static bool isPossible(const From &V) { | 570 | 3.77M | return To::classof(*static_cast<const ::clang::ento::SVal *>(&V)); | 571 | 3.77M | } |
llvm::CastInfo<clang::ento::nonloc::ConcreteInt, clang::ento::SVal, void>::isPossible(clang::ento::SVal const&) Line | Count | Source | 569 | 8 | static bool isPossible(const From &V) { | 570 | 8 | return To::classof(*static_cast<const ::clang::ento::SVal *>(&V)); | 571 | 8 | } |
llvm::CastInfo<clang::ento::Loc, clang::ento::DefinedOrUnknownSVal const, void>::isPossible(clang::ento::DefinedOrUnknownSVal const&) Line | Count | Source | 569 | 249k | static bool isPossible(const From &V) { | 570 | 249k | return To::classof(*static_cast<const ::clang::ento::SVal *>(&V)); | 571 | 249k | } |
llvm::CastInfo<clang::ento::KnownSVal, clang::ento::SVal const, void>::isPossible(clang::ento::SVal const&) Line | Count | Source | 569 | 3.27k | static bool isPossible(const From &V) { | 570 | 3.27k | return To::classof(*static_cast<const ::clang::ento::SVal *>(&V)); | 571 | 3.27k | } |
llvm::CastInfo<clang::ento::DefinedOrUnknownSVal, clang::ento::SVal const, void>::isPossible(clang::ento::SVal const&) Line | Count | Source | 569 | 1.03M | static bool isPossible(const From &V) { | 570 | 1.03M | return To::classof(*static_cast<const ::clang::ento::SVal *>(&V)); | 571 | 1.03M | } |
llvm::CastInfo<clang::ento::loc::MemRegionVal, clang::ento::SVal const, void>::isPossible(clang::ento::SVal const&) Line | Count | Source | 569 | 11.1M | static bool isPossible(const From &V) { | 570 | 11.1M | return To::classof(*static_cast<const ::clang::ento::SVal *>(&V)); | 571 | 11.1M | } |
llvm::CastInfo<clang::ento::loc::GotoLabel, clang::ento::SVal const, void>::isPossible(clang::ento::SVal const&) Line | Count | Source | 569 | 15.5k | static bool isPossible(const From &V) { | 570 | 15.5k | return To::classof(*static_cast<const ::clang::ento::SVal *>(&V)); | 571 | 15.5k | } |
llvm::CastInfo<clang::ento::UndefinedVal, clang::ento::SVal const, void>::isPossible(clang::ento::SVal const&) Line | Count | Source | 569 | 104k | static bool isPossible(const From &V) { | 570 | 104k | return To::classof(*static_cast<const ::clang::ento::SVal *>(&V)); | 571 | 104k | } |
llvm::CastInfo<clang::ento::loc::ConcreteInt, clang::ento::SVal const, void>::isPossible(clang::ento::SVal const&) Line | Count | Source | 569 | 1.70M | static bool isPossible(const From &V) { | 570 | 1.70M | return To::classof(*static_cast<const ::clang::ento::SVal *>(&V)); | 571 | 1.70M | } |
llvm::CastInfo<clang::ento::nonloc::SymbolVal, clang::ento::SVal const, void>::isPossible(clang::ento::SVal const&) Line | Count | Source | 569 | 14.4M | static bool isPossible(const From &V) { | 570 | 14.4M | return To::classof(*static_cast<const ::clang::ento::SVal *>(&V)); | 571 | 14.4M | } |
llvm::CastInfo<clang::ento::nonloc::PointerToMember, clang::ento::SVal const, void>::isPossible(clang::ento::SVal const&) Line | Count | Source | 569 | 27.4k | static bool isPossible(const From &V) { | 570 | 27.4k | return To::classof(*static_cast<const ::clang::ento::SVal *>(&V)); | 571 | 27.4k | } |
llvm::CastInfo<clang::ento::loc::MemRegionVal, clang::ento::Loc const, void>::isPossible(clang::ento::Loc const&) Line | Count | Source | 569 | 11.7k | static bool isPossible(const From &V) { | 570 | 11.7k | return To::classof(*static_cast<const ::clang::ento::SVal *>(&V)); | 571 | 11.7k | } |
llvm::CastInfo<clang::ento::nonloc::LazyCompoundVal, clang::ento::SVal const, void>::isPossible(clang::ento::SVal const&) Line | Count | Source | 569 | 3.17M | static bool isPossible(const From &V) { | 570 | 3.17M | return To::classof(*static_cast<const ::clang::ento::SVal *>(&V)); | 571 | 3.17M | } |
llvm::CastInfo<clang::ento::nonloc::LocAsInteger, clang::ento::SVal const, void>::isPossible(clang::ento::SVal const&) Line | Count | Source | 569 | 3.54M | static bool isPossible(const From &V) { | 570 | 3.54M | return To::classof(*static_cast<const ::clang::ento::SVal *>(&V)); | 571 | 3.54M | } |
llvm::CastInfo<clang::ento::nonloc::CompoundVal, clang::ento::SVal const, void>::isPossible(clang::ento::SVal const&) Line | Count | Source | 569 | 400k | static bool isPossible(const From &V) { | 570 | 400k | return To::classof(*static_cast<const ::clang::ento::SVal *>(&V)); | 571 | 400k | } |
llvm::CastInfo<clang::ento::UnknownVal, clang::ento::Loc const, void>::isPossible(clang::ento::Loc const&) Line | Count | Source | 569 | 673k | static bool isPossible(const From &V) { | 570 | 673k | return To::classof(*static_cast<const ::clang::ento::SVal *>(&V)); | 571 | 673k | } |
llvm::CastInfo<clang::ento::UndefinedVal, clang::ento::Loc const, void>::isPossible(clang::ento::Loc const&) Line | Count | Source | 569 | 673k | static bool isPossible(const From &V) { | 570 | 673k | return To::classof(*static_cast<const ::clang::ento::SVal *>(&V)); | 571 | 673k | } |
llvm::CastInfo<clang::ento::loc::ConcreteInt, clang::ento::Loc const, void>::isPossible(clang::ento::Loc const&) Line | Count | Source | 569 | 11.7k | static bool isPossible(const From &V) { | 570 | 11.7k | return To::classof(*static_cast<const ::clang::ento::SVal *>(&V)); | 571 | 11.7k | } |
llvm::CastInfo<clang::ento::loc::GotoLabel, clang::ento::Loc const, void>::isPossible(clang::ento::Loc const&) Line | Count | Source | 569 | 2 | static bool isPossible(const From &V) { | 570 | 2 | return To::classof(*static_cast<const ::clang::ento::SVal *>(&V)); | 571 | 2 | } |
llvm::CastInfo<clang::ento::UnknownVal, clang::ento::SVal const, void>::isPossible(clang::ento::SVal const&) Line | Count | Source | 569 | 19.3k | static bool isPossible(const From &V) { | 570 | 19.3k | return To::classof(*static_cast<const ::clang::ento::SVal *>(&V)); | 571 | 19.3k | } |
|
572 | 17.2M | static Optional<To> castFailed() { return Optional<To>{}; } llvm::CastInfo<clang::ento::Loc, clang::ento::SVal const, void>::castFailed() Line | Count | Source | 572 | 867k | static Optional<To> castFailed() { return Optional<To>{}; } |
llvm::CastInfo<clang::ento::NonLoc, clang::ento::SVal const, void>::castFailed() Line | Count | Source | 572 | 8.65k | static Optional<To> castFailed() { return Optional<To>{}; } |
Unexecuted instantiation: llvm::CastInfo<clang::ento::nonloc::ConcreteInt, clang::ento::SVal, void>::castFailed() llvm::CastInfo<clang::ento::UndefinedVal, clang::ento::SVal const, void>::castFailed() Line | Count | Source | 572 | 194 | static Optional<To> castFailed() { return Optional<To>{}; } |
llvm::CastInfo<clang::ento::KnownSVal, clang::ento::SVal const, void>::castFailed() Line | Count | Source | 572 | 97 | static Optional<To> castFailed() { return Optional<To>{}; } |
llvm::CastInfo<clang::ento::DefinedSVal, clang::ento::SVal const, void>::castFailed() Line | Count | Source | 572 | 801 | static Optional<To> castFailed() { return Optional<To>{}; } |
Unexecuted instantiation: llvm::CastInfo<clang::ento::DefinedOrUnknownSVal, clang::ento::SVal const, void>::castFailed() llvm::CastInfo<clang::ento::loc::GotoLabel, clang::ento::SVal const, void>::castFailed() Line | Count | Source | 572 | 14 | static Optional<To> castFailed() { return Optional<To>{}; } |
llvm::CastInfo<clang::ento::loc::MemRegionVal, clang::ento::SVal const, void>::castFailed() Line | Count | Source | 572 | 3.59M | static Optional<To> castFailed() { return Optional<To>{}; } |
llvm::CastInfo<clang::ento::nonloc::SymbolVal, clang::ento::SVal const, void>::castFailed() Line | Count | Source | 572 | 3.25M | static Optional<To> castFailed() { return Optional<To>{}; } |
llvm::CastInfo<clang::ento::nonloc::PointerToMember, clang::ento::SVal const, void>::castFailed() Line | Count | Source | 572 | 2.54k | static Optional<To> castFailed() { return Optional<To>{}; } |
llvm::CastInfo<clang::ento::nonloc::LazyCompoundVal, clang::ento::SVal const, void>::castFailed() Line | Count | Source | 572 | 2.61M | static Optional<To> castFailed() { return Optional<To>{}; } |
llvm::CastInfo<clang::ento::nonloc::LocAsInteger, clang::ento::SVal const, void>::castFailed() Line | Count | Source | 572 | 3.54M | static Optional<To> castFailed() { return Optional<To>{}; } |
llvm::CastInfo<clang::ento::nonloc::CompoundVal, clang::ento::SVal const, void>::castFailed() Line | Count | Source | 572 | 395k | static Optional<To> castFailed() { return Optional<To>{}; } |
llvm::CastInfo<clang::ento::loc::ConcreteInt, clang::ento::SVal const, void>::castFailed() Line | Count | Source | 572 | 1.58M | static Optional<To> castFailed() { return Optional<To>{}; } |
llvm::CastInfo<clang::ento::nonloc::ConcreteInt, clang::ento::SVal const, void>::castFailed() Line | Count | Source | 572 | 1.39M | static Optional<To> castFailed() { return Optional<To>{}; } |
|
573 | 31.5M | static To doCast(const From &f) { |
574 | 31.5M | return *static_cast<const To *>(cast<::clang::ento::SVal>(&f)); |
575 | 31.5M | } llvm::CastInfo<clang::ento::DefinedSVal, clang::ento::SVal const, void>::doCast(clang::ento::SVal const&) Line | Count | Source | 573 | 2.16M | static To doCast(const From &f) { | 574 | 2.16M | return *static_cast<const To *>(cast<::clang::ento::SVal>(&f)); | 575 | 2.16M | } |
llvm::CastInfo<clang::ento::NonLoc, clang::ento::SVal const, void>::doCast(clang::ento::SVal const&) Line | Count | Source | 573 | 4.36M | static To doCast(const From &f) { | 574 | 4.36M | return *static_cast<const To *>(cast<::clang::ento::SVal>(&f)); | 575 | 4.36M | } |
llvm::CastInfo<clang::ento::Loc, clang::ento::SVal const, void>::doCast(clang::ento::SVal const&) Line | Count | Source | 573 | 2.53M | static To doCast(const From &f) { | 574 | 2.53M | return *static_cast<const To *>(cast<::clang::ento::SVal>(&f)); | 575 | 2.53M | } |
llvm::CastInfo<clang::ento::nonloc::ConcreteInt, clang::ento::SVal const, void>::doCast(clang::ento::SVal const&) Line | Count | Source | 573 | 2.37M | static To doCast(const From &f) { | 574 | 2.37M | return *static_cast<const To *>(cast<::clang::ento::SVal>(&f)); | 575 | 2.37M | } |
llvm::CastInfo<clang::ento::nonloc::ConcreteInt, clang::ento::SVal, void>::doCast(clang::ento::SVal const&) Line | Count | Source | 573 | 8 | static To doCast(const From &f) { | 574 | 8 | return *static_cast<const To *>(cast<::clang::ento::SVal>(&f)); | 575 | 8 | } |
llvm::CastInfo<clang::ento::DefinedOrUnknownSVal, clang::ento::SVal, void>::doCast(clang::ento::SVal const&) Line | Count | Source | 573 | 154 | static To doCast(const From &f) { | 574 | 154 | return *static_cast<const To *>(cast<::clang::ento::SVal>(&f)); | 575 | 154 | } |
llvm::CastInfo<clang::ento::KnownSVal, clang::ento::SVal const, void>::doCast(clang::ento::SVal const&) Line | Count | Source | 573 | 3.17k | static To doCast(const From &f) { | 574 | 3.17k | return *static_cast<const To *>(cast<::clang::ento::SVal>(&f)); | 575 | 3.17k | } |
llvm::CastInfo<clang::ento::DefinedOrUnknownSVal, clang::ento::SVal const, void>::doCast(clang::ento::SVal const&) Line | Count | Source | 573 | 1.02M | static To doCast(const From &f) { | 574 | 1.02M | return *static_cast<const To *>(cast<::clang::ento::SVal>(&f)); | 575 | 1.02M | } |
llvm::CastInfo<clang::ento::loc::MemRegionVal, clang::ento::SVal const, void>::doCast(clang::ento::SVal const&) Line | Count | Source | 573 | 7.52M | static To doCast(const From &f) { | 574 | 7.52M | return *static_cast<const To *>(cast<::clang::ento::SVal>(&f)); | 575 | 7.52M | } |
llvm::CastInfo<clang::ento::loc::GotoLabel, clang::ento::SVal const, void>::doCast(clang::ento::SVal const&) Line | Count | Source | 573 | 205 | static To doCast(const From &f) { | 574 | 205 | return *static_cast<const To *>(cast<::clang::ento::SVal>(&f)); | 575 | 205 | } |
llvm::CastInfo<clang::ento::nonloc::SymbolVal, clang::ento::SVal const, void>::doCast(clang::ento::SVal const&) Line | Count | Source | 573 | 11.2M | static To doCast(const From &f) { | 574 | 11.2M | return *static_cast<const To *>(cast<::clang::ento::SVal>(&f)); | 575 | 11.2M | } |
llvm::CastInfo<clang::ento::nonloc::PointerToMember, clang::ento::SVal const, void>::doCast(clang::ento::SVal const&) Line | Count | Source | 573 | 635 | static To doCast(const From &f) { | 574 | 635 | return *static_cast<const To *>(cast<::clang::ento::SVal>(&f)); | 575 | 635 | } |
llvm::CastInfo<clang::ento::nonloc::LazyCompoundVal, clang::ento::SVal const, void>::doCast(clang::ento::SVal const&) Line | Count | Source | 573 | 117k | static To doCast(const From &f) { | 574 | 117k | return *static_cast<const To *>(cast<::clang::ento::SVal>(&f)); | 575 | 117k | } |
llvm::CastInfo<clang::ento::nonloc::LocAsInteger, clang::ento::SVal const, void>::doCast(clang::ento::SVal const&) Line | Count | Source | 573 | 4.12k | static To doCast(const From &f) { | 574 | 4.12k | return *static_cast<const To *>(cast<::clang::ento::SVal>(&f)); | 575 | 4.12k | } |
llvm::CastInfo<clang::ento::nonloc::CompoundVal, clang::ento::SVal const, void>::doCast(clang::ento::SVal const&) Line | Count | Source | 573 | 3.69k | static To doCast(const From &f) { | 574 | 3.69k | return *static_cast<const To *>(cast<::clang::ento::SVal>(&f)); | 575 | 3.69k | } |
llvm::CastInfo<clang::ento::loc::ConcreteInt, clang::ento::SVal const, void>::doCast(clang::ento::SVal const&) Line | Count | Source | 573 | 101k | static To doCast(const From &f) { | 574 | 101k | return *static_cast<const To *>(cast<::clang::ento::SVal>(&f)); | 575 | 101k | } |
llvm::CastInfo<clang::ento::UndefinedVal, clang::ento::SVal const, void>::doCast(clang::ento::SVal const&) Line | Count | Source | 573 | 104k | static To doCast(const From &f) { | 574 | 104k | return *static_cast<const To *>(cast<::clang::ento::SVal>(&f)); | 575 | 104k | } |
llvm::CastInfo<clang::ento::UnknownVal, clang::ento::SVal const, void>::doCast(clang::ento::SVal const&) Line | Count | Source | 573 | 19.3k | static To doCast(const From &f) { | 574 | 19.3k | return *static_cast<const To *>(cast<::clang::ento::SVal>(&f)); | 575 | 19.3k | } |
|
576 | 34.3M | static Optional<To> doCastIfPossible(const From &f) { |
577 | 34.3M | if (!Self::isPossible(f)) |
578 | 17.2M | return Self::castFailed(); |
579 | 17.1M | return doCast(f); |
580 | 34.3M | } llvm::CastInfo<clang::ento::Loc, clang::ento::SVal const, void>::doCastIfPossible(clang::ento::SVal const&) Line | Count | Source | 576 | 1.72M | static Optional<To> doCastIfPossible(const From &f) { | 577 | 1.72M | if (!Self::isPossible(f)) | 578 | 867k | return Self::castFailed(); | 579 | 856k | return doCast(f); | 580 | 1.72M | } |
llvm::CastInfo<clang::ento::NonLoc, clang::ento::SVal const, void>::doCastIfPossible(clang::ento::SVal const&) Line | Count | Source | 576 | 987k | static Optional<To> doCastIfPossible(const From &f) { | 577 | 987k | if (!Self::isPossible(f)) | 578 | 8.65k | return Self::castFailed(); | 579 | 979k | return doCast(f); | 580 | 987k | } |
llvm::CastInfo<clang::ento::nonloc::ConcreteInt, clang::ento::SVal, void>::doCastIfPossible(clang::ento::SVal const&) Line | Count | Source | 576 | 8 | static Optional<To> doCastIfPossible(const From &f) { | 577 | 8 | if (!Self::isPossible(f)) | 578 | 0 | return Self::castFailed(); | 579 | 8 | return doCast(f); | 580 | 8 | } |
llvm::CastInfo<clang::ento::UndefinedVal, clang::ento::SVal const, void>::doCastIfPossible(clang::ento::SVal const&) Line | Count | Source | 576 | 200 | static Optional<To> doCastIfPossible(const From &f) { | 577 | 200 | if (!Self::isPossible(f)) | 578 | 194 | return Self::castFailed(); | 579 | 6 | return doCast(f); | 580 | 200 | } |
llvm::CastInfo<clang::ento::KnownSVal, clang::ento::SVal const, void>::doCastIfPossible(clang::ento::SVal const&) Line | Count | Source | 576 | 3.25k | static Optional<To> doCastIfPossible(const From &f) { | 577 | 3.25k | if (!Self::isPossible(f)) | 578 | 97 | return Self::castFailed(); | 579 | 3.15k | return doCast(f); | 580 | 3.25k | } |
llvm::CastInfo<clang::ento::DefinedSVal, clang::ento::SVal const, void>::doCastIfPossible(clang::ento::SVal const&) Line | Count | Source | 576 | 62.9k | static Optional<To> doCastIfPossible(const From &f) { | 577 | 62.9k | if (!Self::isPossible(f)) | 578 | 801 | return Self::castFailed(); | 579 | 62.1k | return doCast(f); | 580 | 62.9k | } |
llvm::CastInfo<clang::ento::DefinedOrUnknownSVal, clang::ento::SVal const, void>::doCastIfPossible(clang::ento::SVal const&) Line | Count | Source | 576 | 2.20k | static Optional<To> doCastIfPossible(const From &f) { | 577 | 2.20k | if (!Self::isPossible(f)) | 578 | 0 | return Self::castFailed(); | 579 | 2.20k | return doCast(f); | 580 | 2.20k | } |
llvm::CastInfo<clang::ento::loc::GotoLabel, clang::ento::SVal const, void>::doCastIfPossible(clang::ento::SVal const&) Line | Count | Source | 576 | 30 | static Optional<To> doCastIfPossible(const From &f) { | 577 | 30 | if (!Self::isPossible(f)) | 578 | 14 | return Self::castFailed(); | 579 | 16 | return doCast(f); | 580 | 30 | } |
llvm::CastInfo<clang::ento::loc::MemRegionVal, clang::ento::SVal const, void>::doCastIfPossible(clang::ento::SVal const&) Line | Count | Source | 576 | 8.97M | static Optional<To> doCastIfPossible(const From &f) { | 577 | 8.97M | if (!Self::isPossible(f)) | 578 | 3.59M | return Self::castFailed(); | 579 | 5.37M | return doCast(f); | 580 | 8.97M | } |
llvm::CastInfo<clang::ento::nonloc::SymbolVal, clang::ento::SVal const, void>::doCastIfPossible(clang::ento::SVal const&) Line | Count | Source | 576 | 12.3M | static Optional<To> doCastIfPossible(const From &f) { | 577 | 12.3M | if (!Self::isPossible(f)) | 578 | 3.25M | return Self::castFailed(); | 579 | 9.13M | return doCast(f); | 580 | 12.3M | } |
llvm::CastInfo<clang::ento::nonloc::PointerToMember, clang::ento::SVal const, void>::doCastIfPossible(clang::ento::SVal const&) Line | Count | Source | 576 | 3.03k | static Optional<To> doCastIfPossible(const From &f) { | 577 | 3.03k | if (!Self::isPossible(f)) | 578 | 2.54k | return Self::castFailed(); | 579 | 496 | return doCast(f); | 580 | 3.03k | } |
llvm::CastInfo<clang::ento::nonloc::LazyCompoundVal, clang::ento::SVal const, void>::doCastIfPossible(clang::ento::SVal const&) Line | Count | Source | 576 | 2.73M | static Optional<To> doCastIfPossible(const From &f) { | 577 | 2.73M | if (!Self::isPossible(f)) | 578 | 2.61M | return Self::castFailed(); | 579 | 117k | return doCast(f); | 580 | 2.73M | } |
llvm::CastInfo<clang::ento::nonloc::LocAsInteger, clang::ento::SVal const, void>::doCastIfPossible(clang::ento::SVal const&) Line | Count | Source | 576 | 3.54M | static Optional<To> doCastIfPossible(const From &f) { | 577 | 3.54M | if (!Self::isPossible(f)) | 578 | 3.54M | return Self::castFailed(); | 579 | 2.86k | return doCast(f); | 580 | 3.54M | } |
llvm::CastInfo<clang::ento::nonloc::CompoundVal, clang::ento::SVal const, void>::doCastIfPossible(clang::ento::SVal const&) Line | Count | Source | 576 | 397k | static Optional<To> doCastIfPossible(const From &f) { | 577 | 397k | if (!Self::isPossible(f)) | 578 | 395k | return Self::castFailed(); | 579 | 1.34k | return doCast(f); | 580 | 397k | } |
llvm::CastInfo<clang::ento::loc::ConcreteInt, clang::ento::SVal const, void>::doCastIfPossible(clang::ento::SVal const&) Line | Count | Source | 576 | 1.59M | static Optional<To> doCastIfPossible(const From &f) { | 577 | 1.59M | if (!Self::isPossible(f)) | 578 | 1.58M | return Self::castFailed(); | 579 | 13.1k | return doCast(f); | 580 | 1.59M | } |
llvm::CastInfo<clang::ento::nonloc::ConcreteInt, clang::ento::SVal const, void>::doCastIfPossible(clang::ento::SVal const&) Line | Count | Source | 576 | 1.98M | static Optional<To> doCastIfPossible(const From &f) { | 577 | 1.98M | if (!Self::isPossible(f)) | 578 | 1.39M | return Self::castFailed(); | 579 | 584k | return doCast(f); | 580 | 1.98M | } |
|
581 | | }; |
582 | | } // namespace llvm |
583 | | |
584 | | #endif // LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_SVALS_H |