@@ -46,7 +46,7 @@ class SymbolRegionValue : public SymbolData {
46
46
47
47
friend class SymExprAllocator ;
48
48
SymbolRegionValue (SymbolID sym, const TypedValueRegion *r)
49
- : SymbolData(SymbolRegionValueKind , sym), R(r) {
49
+ : SymbolData(ClassKind , sym), R(r) {
50
50
assert (r);
51
51
assert (isValidTypeForSymbol (r->getValueType ()));
52
52
}
@@ -56,7 +56,7 @@ class SymbolRegionValue : public SymbolData {
56
56
const TypedValueRegion *getRegion () const { return R; }
57
57
58
58
static void Profile (llvm::FoldingSetNodeID& profile, const TypedValueRegion* R) {
59
- profile.AddInteger ((unsigned ) SymbolRegionValueKind );
59
+ profile.AddInteger ((unsigned )ClassKind );
60
60
profile.AddPointer (R);
61
61
}
62
62
@@ -72,9 +72,9 @@ class SymbolRegionValue : public SymbolData {
72
72
QualType getType () const override ;
73
73
74
74
// Implement isa<T> support.
75
- static bool classof ( const SymExpr *SE) {
76
- return SE->getKind () == SymbolRegionValueKind;
77
- }
75
+ static constexpr Kind ClassKind = SymbolRegionValueKind;
76
+ static bool classof ( const SymExpr *SE) { return classof ( SE->getKind ()); }
77
+ static constexpr bool classof (Kind K) { return K == ClassKind; }
78
78
};
79
79
80
80
// / A symbol representing the result of an expression in the case when we do
@@ -90,8 +90,8 @@ class SymbolConjured : public SymbolData {
90
90
SymbolConjured (SymbolID sym, ConstCFGElementRef elem,
91
91
const LocationContext *lctx, QualType t, unsigned count,
92
92
const void *symbolTag)
93
- : SymbolData(SymbolConjuredKind , sym), Elem(elem), T(t), Count(count),
94
- LCtx (lctx), SymbolTag(symbolTag) {
93
+ : SymbolData(ClassKind , sym), Elem(elem), T(t), Count(count), LCtx(lctx ),
94
+ SymbolTag (symbolTag) {
95
95
assert (lctx);
96
96
assert (isValidTypeForSymbol (t));
97
97
}
@@ -115,7 +115,7 @@ class SymbolConjured : public SymbolData {
115
115
static void Profile (llvm::FoldingSetNodeID &profile, ConstCFGElementRef Elem,
116
116
const LocationContext *LCtx, QualType T, unsigned Count,
117
117
const void *SymbolTag) {
118
- profile.AddInteger ((unsigned )SymbolConjuredKind );
118
+ profile.AddInteger ((unsigned )ClassKind );
119
119
profile.Add (Elem);
120
120
profile.AddPointer (LCtx);
121
121
profile.Add (T);
@@ -128,9 +128,9 @@ class SymbolConjured : public SymbolData {
128
128
}
129
129
130
130
// Implement isa<T> support.
131
- static bool classof ( const SymExpr *SE) {
132
- return SE->getKind () == SymbolConjuredKind;
133
- }
131
+ static constexpr Kind ClassKind = SymbolConjuredKind;
132
+ static bool classof ( const SymExpr *SE) { return classof ( SE->getKind ()); }
133
+ static constexpr bool classof (Kind K) { return K == ClassKind; }
134
134
};
135
135
136
136
// / A symbol representing the value of a MemRegion whose parent region has
@@ -141,7 +141,7 @@ class SymbolDerived : public SymbolData {
141
141
142
142
friend class SymExprAllocator ;
143
143
SymbolDerived (SymbolID sym, SymbolRef parent, const TypedValueRegion *r)
144
- : SymbolData(SymbolDerivedKind , sym), parentSymbol(parent), R(r) {
144
+ : SymbolData(ClassKind , sym), parentSymbol(parent), R(r) {
145
145
assert (parent);
146
146
assert (r);
147
147
assert (isValidTypeForSymbol (r->getValueType ()));
@@ -162,7 +162,7 @@ class SymbolDerived : public SymbolData {
162
162
163
163
static void Profile (llvm::FoldingSetNodeID& profile, SymbolRef parent,
164
164
const TypedValueRegion *r) {
165
- profile.AddInteger ((unsigned ) SymbolDerivedKind );
165
+ profile.AddInteger ((unsigned )ClassKind );
166
166
profile.AddPointer (r);
167
167
profile.AddPointer (parent);
168
168
}
@@ -172,9 +172,9 @@ class SymbolDerived : public SymbolData {
172
172
}
173
173
174
174
// Implement isa<T> support.
175
- static bool classof ( const SymExpr *SE) {
176
- return SE->getKind () == SymbolDerivedKind;
177
- }
175
+ static constexpr Kind ClassKind = SymbolDerivedKind;
176
+ static bool classof ( const SymExpr *SE) { return classof ( SE->getKind ()); }
177
+ static constexpr bool classof (Kind K) { return K == ClassKind; }
178
178
};
179
179
180
180
// / SymbolExtent - Represents the extent (size in bytes) of a bounded region.
@@ -185,7 +185,7 @@ class SymbolExtent : public SymbolData {
185
185
186
186
friend class SymExprAllocator ;
187
187
SymbolExtent (SymbolID sym, const SubRegion *r)
188
- : SymbolData(SymbolExtentKind , sym), R(r) {
188
+ : SymbolData(ClassKind , sym), R(r) {
189
189
assert (r);
190
190
}
191
191
@@ -200,7 +200,7 @@ class SymbolExtent : public SymbolData {
200
200
void dumpToStream (raw_ostream &os) const override ;
201
201
202
202
static void Profile (llvm::FoldingSetNodeID& profile, const SubRegion *R) {
203
- profile.AddInteger ((unsigned ) SymbolExtentKind );
203
+ profile.AddInteger ((unsigned )ClassKind );
204
204
profile.AddPointer (R);
205
205
}
206
206
@@ -209,9 +209,9 @@ class SymbolExtent : public SymbolData {
209
209
}
210
210
211
211
// Implement isa<T> support.
212
- static bool classof ( const SymExpr *SE) {
213
- return SE->getKind () == SymbolExtentKind;
214
- }
212
+ static constexpr Kind ClassKind = SymbolExtentKind;
213
+ static bool classof ( const SymExpr *SE) { return classof ( SE->getKind ()); }
214
+ static constexpr bool classof (Kind K) { return K == ClassKind; }
215
215
};
216
216
217
217
// / SymbolMetadata - Represents path-dependent metadata about a specific region.
@@ -229,16 +229,16 @@ class SymbolMetadata : public SymbolData {
229
229
const void *Tag;
230
230
231
231
friend class SymExprAllocator ;
232
- SymbolMetadata (SymbolID sym, const MemRegion* r, const Stmt *s, QualType t,
232
+ SymbolMetadata (SymbolID sym, const MemRegion * r, const Stmt *s, QualType t,
233
233
const LocationContext *LCtx, unsigned count, const void *tag)
234
- : SymbolData(SymbolMetadataKind , sym), R(r), S(s), T(t), LCtx(LCtx),
235
- Count (count), Tag(tag) {
236
- assert (r);
237
- assert (s);
238
- assert (isValidTypeForSymbol (t));
239
- assert (LCtx);
240
- assert (tag);
241
- }
234
+ : SymbolData(ClassKind , sym), R(r), S(s), T(t), LCtx(LCtx), Count(count ),
235
+ Tag (tag) {
236
+ assert (r);
237
+ assert (s);
238
+ assert (isValidTypeForSymbol (t));
239
+ assert (LCtx);
240
+ assert (tag);
241
+ }
242
242
243
243
public:
244
244
LLVM_ATTRIBUTE_RETURNS_NONNULL
@@ -264,7 +264,7 @@ class SymbolMetadata : public SymbolData {
264
264
static void Profile (llvm::FoldingSetNodeID &profile, const MemRegion *R,
265
265
const Stmt *S, QualType T, const LocationContext *LCtx,
266
266
unsigned Count, const void *Tag) {
267
- profile.AddInteger ((unsigned )SymbolMetadataKind );
267
+ profile.AddInteger ((unsigned )ClassKind );
268
268
profile.AddPointer (R);
269
269
profile.AddPointer (S);
270
270
profile.Add (T);
@@ -278,9 +278,9 @@ class SymbolMetadata : public SymbolData {
278
278
}
279
279
280
280
// Implement isa<T> support.
281
- static bool classof ( const SymExpr *SE) {
282
- return SE->getKind () == SymbolMetadataKind;
283
- }
281
+ static constexpr Kind ClassKind = SymbolMetadataKind;
282
+ static bool classof ( const SymExpr *SE) { return classof ( SE->getKind ()); }
283
+ static constexpr bool classof (Kind K) { return K == ClassKind; }
284
284
};
285
285
286
286
// / Represents a cast expression.
@@ -295,7 +295,7 @@ class SymbolCast : public SymExpr {
295
295
296
296
friend class SymExprAllocator ;
297
297
SymbolCast (SymbolID Sym, const SymExpr *In, QualType From, QualType To)
298
- : SymExpr(SymbolCastKind , Sym), Operand(In), FromTy(From), ToTy(To) {
298
+ : SymExpr(ClassKind , Sym), Operand(In), FromTy(From), ToTy(To) {
299
299
assert (In);
300
300
assert (isValidTypeForSymbol (From));
301
301
// FIXME: GenericTaintChecker creates symbols of void type.
@@ -318,7 +318,7 @@ class SymbolCast : public SymExpr {
318
318
319
319
static void Profile (llvm::FoldingSetNodeID& ID,
320
320
const SymExpr *In, QualType From, QualType To) {
321
- ID.AddInteger ((unsigned ) SymbolCastKind );
321
+ ID.AddInteger ((unsigned )ClassKind );
322
322
ID.AddPointer (In);
323
323
ID.Add (From);
324
324
ID.Add (To);
@@ -329,9 +329,9 @@ class SymbolCast : public SymExpr {
329
329
}
330
330
331
331
// Implement isa<T> support.
332
- static bool classof ( const SymExpr *SE) {
333
- return SE->getKind () == SymbolCastKind;
334
- }
332
+ static constexpr Kind ClassKind = SymbolCastKind;
333
+ static bool classof ( const SymExpr *SE) { return classof ( SE->getKind ()); }
334
+ static constexpr bool classof (Kind K) { return K == ClassKind; }
335
335
};
336
336
337
337
// / Represents a symbolic expression involving a unary operator.
@@ -343,7 +343,7 @@ class UnarySymExpr : public SymExpr {
343
343
friend class SymExprAllocator ;
344
344
UnarySymExpr (SymbolID Sym, const SymExpr *In, UnaryOperator::Opcode Op,
345
345
QualType T)
346
- : SymExpr(UnarySymExprKind , Sym), Operand(In), Op(Op), T(T) {
346
+ : SymExpr(ClassKind , Sym), Operand(In), Op(Op), T(T) {
347
347
// Note, some unary operators are modeled as a binary operator. E.g. ++x is
348
348
// modeled as x + 1.
349
349
assert ((Op == UO_Minus || Op == UO_Not) && " non-supported unary expression" );
@@ -369,7 +369,7 @@ class UnarySymExpr : public SymExpr {
369
369
370
370
static void Profile (llvm::FoldingSetNodeID &ID, const SymExpr *In,
371
371
UnaryOperator::Opcode Op, QualType T) {
372
- ID.AddInteger ((unsigned )UnarySymExprKind );
372
+ ID.AddInteger ((unsigned )ClassKind );
373
373
ID.AddPointer (In);
374
374
ID.AddInteger (Op);
375
375
ID.Add (T);
@@ -380,9 +380,9 @@ class UnarySymExpr : public SymExpr {
380
380
}
381
381
382
382
// Implement isa<T> support.
383
- static bool classof ( const SymExpr *SE) {
384
- return SE->getKind () == UnarySymExprKind;
385
- }
383
+ static constexpr Kind ClassKind = UnarySymExprKind;
384
+ static bool classof ( const SymExpr *SE) { return classof ( SE->getKind ()); }
385
+ static constexpr bool classof (Kind K) { return K == ClassKind; }
386
386
};
387
387
388
388
// / Represents a symbolic expression involving a binary operator
@@ -408,9 +408,9 @@ class BinarySymExpr : public SymExpr {
408
408
BinaryOperator::Opcode getOpcode () const { return Op; }
409
409
410
410
// Implement isa<T> support.
411
- static bool classof (const SymExpr *SE) {
412
- Kind k = SE-> getKind ();
413
- return k >= BEGIN_BINARYSYMEXPRS && k <= END_BINARYSYMEXPRS;
411
+ static bool classof (const SymExpr *SE) { return classof (SE-> getKind ()); }
412
+ static constexpr bool classof (Kind K) {
413
+ return K >= BEGIN_BINARYSYMEXPRS && K <= END_BINARYSYMEXPRS;
414
414
}
415
415
416
416
protected:
@@ -430,7 +430,7 @@ class BinarySymExpr : public SymExpr {
430
430
};
431
431
432
432
// / Template implementation for all binary symbolic expressions
433
- template <class LHSTYPE , class RHSTYPE , SymExpr::Kind ClassKind >
433
+ template <class LHSTYPE , class RHSTYPE , SymExpr::Kind ClassK >
434
434
class BinarySymExprImpl : public BinarySymExpr {
435
435
LHSTYPE LHS;
436
436
RHSTYPE RHS;
@@ -474,7 +474,9 @@ class BinarySymExprImpl : public BinarySymExpr {
474
474
}
475
475
476
476
// Implement isa<T> support.
477
- static bool classof (const SymExpr *SE) { return SE->getKind () == ClassKind; }
477
+ static constexpr Kind ClassKind = ClassK;
478
+ static bool classof (const SymExpr *SE) { return classof (SE->getKind ()); }
479
+ static constexpr bool classof (Kind K) { return K == ClassKind; }
478
480
};
479
481
480
482
// / Represents a symbolic expression like 'x' + 3.
0 commit comments