aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/ValueManager.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-08-28 04:49:15 +0000
committerTed Kremenek <kremenek@apple.com>2009-08-28 04:49:15 +0000
commitabd46e13cfd48f2c9bf26d9759edb4366aaa6d5b (patch)
tree0fc9e1bd9f3fae64398a5da5b68c3cead87ba1de /lib/Analysis/ValueManager.cpp
parent73b39cf02eaa346c6d7a76c32bf13759de7516db (diff)
Use SymbolicRegion instead of CodeTextRegion for symbolic function
pointers. Most logic cares first about whether or not a region is symbolic, and second if represents code. This should fix a series of silent corner case bugs (as well as simplify a bunch of code). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80335 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/ValueManager.cpp')
-rw-r--r--lib/Analysis/ValueManager.cpp22
1 files changed, 3 insertions, 19 deletions
diff --git a/lib/Analysis/ValueManager.cpp b/lib/Analysis/ValueManager.cpp
index 6e6187151a..44334ce34d 100644
--- a/lib/Analysis/ValueManager.cpp
+++ b/lib/Analysis/ValueManager.cpp
@@ -80,11 +80,6 @@ SVal ValueManager::getRegionValueSymbolVal(const MemRegion* R, QualType T) {
return UnknownVal();
SymbolRef sym = SymMgr.getRegionValueSymbol(R, T);
-
- // If T is of function pointer type or a block pointer type, create a
- // CodeTextRegion wrapping that symbol.
- if (T->isFunctionPointerType() || T->isBlockPointerType())
- return loc::MemRegionVal(MemMgr.getCodeTextRegion(sym, T));
if (Loc::IsLocType(T))
return loc::MemRegionVal(MemMgr.getSymbolicRegion(sym));
@@ -92,7 +87,7 @@ SVal ValueManager::getRegionValueSymbolVal(const MemRegion* R, QualType T) {
return nonloc::SymbolVal(sym);
}
-SVal ValueManager::getConjuredSymbolVal(const Expr* E, unsigned Count) {
+SVal ValueManager::getConjuredSymbolVal(const Expr *E, unsigned Count) {
QualType T = E->getType();
if (!SymbolManager::canSymbolicate(T))
@@ -100,18 +95,13 @@ SVal ValueManager::getConjuredSymbolVal(const Expr* E, unsigned Count) {
SymbolRef sym = SymMgr.getConjuredSymbol(E, Count);
- // If T is of function pointer type or a block pointer type, create a
- // CodeTextRegion wrapping a symbol.
- if (T->isFunctionPointerType() || T->isBlockPointerType())
- return loc::MemRegionVal(MemMgr.getCodeTextRegion(sym, T));
-
if (Loc::IsLocType(T))
return loc::MemRegionVal(MemMgr.getSymbolicRegion(sym));
return nonloc::SymbolVal(sym);
}
-SVal ValueManager::getConjuredSymbolVal(const Expr* E, QualType T,
+SVal ValueManager::getConjuredSymbolVal(const Expr *E, QualType T,
unsigned Count) {
if (!SymbolManager::canSymbolicate(T))
@@ -119,11 +109,6 @@ SVal ValueManager::getConjuredSymbolVal(const Expr* E, QualType T,
SymbolRef sym = SymMgr.getConjuredSymbol(E, T, Count);
- // If T is of function pointer type or a block pointer type, create a
- // CodeTextRegion wrapping a symbol.
- if (T->isFunctionPointerType() || T->isBlockPointerType())
- return loc::MemRegionVal(MemMgr.getCodeTextRegion(sym, T));
-
if (Loc::IsLocType(T))
return loc::MemRegionVal(MemMgr.getSymbolicRegion(sym));
@@ -147,7 +132,6 @@ SVal ValueManager::getDerivedRegionValueSymbolVal(SymbolRef parentSymbol,
}
SVal ValueManager::getFunctionPointer(const FunctionDecl* FD) {
- CodeTextRegion* R
- = MemMgr.getCodeTextRegion(FD, Context.getPointerType(FD->getType()));
+ CodeTextRegion *R = MemMgr.getCodeTextRegion(FD);
return loc::MemRegionVal(R);
}