@@ -80,62 +80,29 @@ class SymbolRegionValue : public SymbolData {
80
80
// / A symbol representing the result of an expression in the case when we do
81
81
// / not know anything about what the expression is.
82
82
class SymbolConjured : public SymbolData {
83
- ConstCFGElementRef Elem ;
83
+ const Stmt *S ;
84
84
QualType T;
85
85
unsigned Count;
86
86
const LocationContext *LCtx;
87
87
const void *SymbolTag;
88
88
89
89
friend class SymExprAllocator ;
90
- SymbolConjured (SymbolID sym, ConstCFGElementRef elem,
91
- const LocationContext *lctx, QualType t, unsigned count,
92
- const void *symbolTag)
93
- : SymbolData(SymbolConjuredKind, sym), Elem(elem), T(t), Count(count),
90
+ SymbolConjured (SymbolID sym, const Stmt *s, const LocationContext *lctx,
91
+ QualType t, unsigned count, const void *symbolTag)
92
+ : SymbolData(SymbolConjuredKind, sym), S(s), T(t), Count(count),
94
93
LCtx (lctx), SymbolTag(symbolTag) {
94
+ // FIXME: 's' might be a nullptr if we're conducting invalidation
95
+ // that was caused by a destructor call on a temporary object,
96
+ // which has no statement associated with it.
97
+ // Due to this, we might be creating the same invalidation symbol for
98
+ // two different invalidation passes (for two different temporaries).
95
99
assert (lctx);
96
100
assert (isValidTypeForSymbol (t));
97
101
}
98
102
99
103
public:
100
- ConstCFGElementRef getCFGElementRef () const { return Elem; }
101
-
102
- // It might return null.
103
- const Stmt *getStmt () const {
104
- switch (Elem->getKind ()) {
105
- case CFGElement::Initializer:
106
- return Elem->castAs <CFGInitializer>().getInitializer ()->getInit ();
107
- case CFGElement::ScopeBegin:
108
- return Elem->castAs <CFGScopeBegin>().getTriggerStmt ();
109
- case CFGElement::ScopeEnd:
110
- return Elem->castAs <CFGScopeEnd>().getTriggerStmt ();
111
- case CFGElement::NewAllocator:
112
- return Elem->castAs <CFGNewAllocator>().getAllocatorExpr ();
113
- case CFGElement::LifetimeEnds:
114
- return Elem->castAs <CFGLifetimeEnds>().getTriggerStmt ();
115
- case CFGElement::LoopExit:
116
- return Elem->castAs <CFGLoopExit>().getLoopStmt ();
117
- case CFGElement::Statement:
118
- return Elem->castAs <CFGStmt>().getStmt ();
119
- case CFGElement::Constructor:
120
- return Elem->castAs <CFGConstructor>().getStmt ();
121
- case CFGElement::CXXRecordTypedCall:
122
- return Elem->castAs <CFGCXXRecordTypedCall>().getStmt ();
123
- case CFGElement::AutomaticObjectDtor:
124
- return Elem->castAs <CFGAutomaticObjDtor>().getTriggerStmt ();
125
- case CFGElement::DeleteDtor:
126
- return Elem->castAs <CFGDeleteDtor>().getDeleteExpr ();
127
- case CFGElement::BaseDtor:
128
- return nullptr ;
129
- case CFGElement::MemberDtor:
130
- return nullptr ;
131
- case CFGElement::TemporaryDtor:
132
- return Elem->castAs <CFGTemporaryDtor>().getBindTemporaryExpr ();
133
- case CFGElement::CleanupFunction:
134
- return nullptr ;
135
- }
136
- return nullptr ;
137
- }
138
-
104
+ // / It might return null.
105
+ const Stmt *getStmt () const { return S; }
139
106
unsigned getCount () const { return Count; }
140
107
// / It might return null.
141
108
const void *getTag () const { return SymbolTag; }
@@ -146,19 +113,19 @@ class SymbolConjured : public SymbolData {
146
113
147
114
void dumpToStream (raw_ostream &os) const override ;
148
115
149
- static void Profile (llvm::FoldingSetNodeID &profile, ConstCFGElementRef Elem ,
116
+ static void Profile (llvm::FoldingSetNodeID &profile, const Stmt *S ,
150
117
const LocationContext *LCtx, QualType T, unsigned Count,
151
118
const void *SymbolTag) {
152
119
profile.AddInteger ((unsigned )SymbolConjuredKind);
153
- profile.Add (Elem );
120
+ profile.AddPointer (S );
154
121
profile.AddPointer (LCtx);
155
122
profile.Add (T);
156
123
profile.AddInteger (Count);
157
124
profile.AddPointer (SymbolTag);
158
125
}
159
126
160
127
void Profile (llvm::FoldingSetNodeID& profile) override {
161
- Profile (profile, Elem , LCtx, T, Count, SymbolTag);
128
+ Profile (profile, S , LCtx, T, Count, SymbolTag);
162
129
}
163
130
164
131
// Implement isa<T> support.
@@ -566,12 +533,18 @@ class SymbolManager {
566
533
template <typename SymExprT, typename ... Args>
567
534
const SymExprT *acquire (Args &&...args);
568
535
569
- const SymbolConjured *conjureSymbol (ConstCFGElementRef Elem ,
536
+ const SymbolConjured *conjureSymbol (const Stmt *E ,
570
537
const LocationContext *LCtx, QualType T,
571
538
unsigned VisitCount,
572
539
const void *SymbolTag = nullptr ) {
540
+ return acquire<SymbolConjured>(E, LCtx, T, VisitCount, SymbolTag);
541
+ }
573
542
574
- return acquire<SymbolConjured>(Elem, LCtx, T, VisitCount, SymbolTag);
543
+ const SymbolConjured* conjureSymbol (const Expr *E,
544
+ const LocationContext *LCtx,
545
+ unsigned VisitCount,
546
+ const void *SymbolTag = nullptr ) {
547
+ return conjureSymbol (E, LCtx, E->getType (), VisitCount, SymbolTag);
575
548
}
576
549
577
550
QualType getType (const SymExpr *SE) const {
0 commit comments