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
diff --git a/lib/Analysis/SVals.cpp b/lib/Analysis/SVals.cpp
index b2f2e96..91674b8 100644
--- a/lib/Analysis/SVals.cpp
+++ b/lib/Analysis/SVals.cpp
@@ -42,28 +42,20 @@
SymbolRef sym = SR->getSymbol();
if (isa<SymbolConjured>(sym))
return true;
- } else if (const CodeTextRegion *CTR = dyn_cast<CodeTextRegion>(R)) {
- if (CTR->isSymbolic()) {
- SymbolRef sym = CTR->getSymbol();
- if (isa<SymbolConjured>(sym))
- return true;
- }
}
}
return false;
}
-const FunctionDecl* SVal::getAsFunctionDecl() const {
+const FunctionDecl *SVal::getAsFunctionDecl() const {
if (const loc::MemRegionVal* X = dyn_cast<loc::MemRegionVal>(this)) {
const MemRegion* R = X->getRegion();
- if (const CodeTextRegion* CTR = R->getAs<CodeTextRegion>()) {
- if (CTR->isDeclared())
- return CTR->getDecl();
- }
+ if (const CodeTextRegion *CTR = R->getAs<CodeTextRegion>())
+ return CTR->getDecl();
}
- return 0;
+ return NULL;
}
/// getAsLocSymbol - If this SVal is a location (subclasses Loc) and