summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h10
-rw-r--r--clang/lib/StaticAnalyzer/Core/SValBuilder.cpp12
2 files changed, 9 insertions, 13 deletions
diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h
index 9266588163c..b7b2345503e 100644
--- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h
+++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h
@@ -140,12 +140,18 @@ public:
return SymMgr.getConjuredSymbol(expr, visitCount, symbolTag);
}
- /// makeZeroVal - Construct an SVal representing '0' for the specified type.
+ /// Construct an SVal representing '0' for the specified type.
DefinedOrUnknownSVal makeZeroVal(QualType type);
- /// getRegionValueSymbolVal - make a unique symbol for value of region.
+ /// Make a unique symbol for value of region.
DefinedOrUnknownSVal getRegionValueSymbolVal(const TypedValueRegion *region);
+ /// \brief Create a new symbol with a unique 'name'.
+ ///
+ /// We resort to conjured symbols when we cannot construct a derived symbol.
+ /// The advantage of symbols derived/built from other symbols is that we
+ /// preserve the relation between related(or even equivalent) expressions, so
+ /// conjured symbols should be used sparingly.
DefinedOrUnknownSVal getConjuredSymbolVal(const void *symbolTag,
const Expr *expr, unsigned count);
DefinedOrUnknownSVal getConjuredSymbolVal(const void *symbolTag,
diff --git a/clang/lib/StaticAnalyzer/Core/SValBuilder.cpp b/clang/lib/StaticAnalyzer/Core/SValBuilder.cpp
index 778a0bf97da..331f5934b57 100644
--- a/clang/lib/StaticAnalyzer/Core/SValBuilder.cpp
+++ b/clang/lib/StaticAnalyzer/Core/SValBuilder.cpp
@@ -90,23 +90,13 @@ DefinedOrUnknownSVal SValBuilder::getConjuredSymbolVal(const void *symbolTag,
const Expr *expr,
unsigned count) {
QualType T = expr->getType();
-
- if (!SymbolManager::canSymbolicate(T))
- return UnknownVal();
-
- SymbolRef sym = SymMgr.getConjuredSymbol(expr, count, symbolTag);
-
- if (Loc::isLocType(T))
- return loc::MemRegionVal(MemMgr.getSymbolicRegion(sym));
-
- return nonloc::SymbolVal(sym);
+ return getConjuredSymbolVal(symbolTag, expr, T, count);
}
DefinedOrUnknownSVal SValBuilder::getConjuredSymbolVal(const void *symbolTag,
const Expr *expr,
QualType type,
unsigned count) {
-
if (!SymbolManager::canSymbolicate(type))
return UnknownVal();
OpenPOWER on IntegriCloud