aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/MemRegion.cpp
diff options
context:
space:
mode:
authorZhongxing Xu <xuzhongxing@gmail.com>2009-02-06 08:44:27 +0000
committerZhongxing Xu <xuzhongxing@gmail.com>2009-02-06 08:44:27 +0000
commita48f7378a05095595d0f6a9c11fc8141e7a5ea61 (patch)
tree56564ba3a39cc20f21476d2a82eb142bbb59544a /lib/Analysis/MemRegion.cpp
parentf73903a1ded46748e1dfda151f5d037b7b3d31f9 (diff)
Create ElementRegion when the base is SymbolicRegion. This is like what we do
for FieldRegion. This enables us to track more values. Simplify SymbolicRegion::getRValueType(). We assume the symbol always has pointer type. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63928 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/MemRegion.cpp')
-rw-r--r--lib/Analysis/MemRegion.cpp16
1 files changed, 6 insertions, 10 deletions
diff --git a/lib/Analysis/MemRegion.cpp b/lib/Analysis/MemRegion.cpp
index e41c5f937b..779f651edb 100644
--- a/lib/Analysis/MemRegion.cpp
+++ b/lib/Analysis/MemRegion.cpp
@@ -114,18 +114,14 @@ void ElementRegion::Profile(llvm::FoldingSetNodeID& ID) const {
QualType SymbolicRegion::getRValueType(ASTContext& C) const {
const SymbolData& data = SymMgr.getSymbolData(sym);
- // FIXME: We could use the SymbolManager::getType() directly. But that
- // would hide the assumptions we made here. What is the type of a symbolic
- // region is unclear for other cases.
+ // Get the type of the symbol.
+ QualType T = data.getType(C);
- // For now we assume the symbol is a typed region rvalue.
- const TypedRegion* R
- = cast<TypedRegion>(cast<SymbolRegionRValue>(data).getRegion());
-
- // Assume the region rvalue has a pointer type, only then we could have a
- // symbolic region associated with it.
- PointerType* PTy = cast<PointerType>(R->getRValueType(C).getTypePtr());
+ // Only when the symbol has pointer type it can have a symbolic region
+ // associated with it.
+ PointerType* PTy = cast<PointerType>(T.getTypePtr()->getDesugaredType());
+ // The type of the symbolic region is the pointee type of the symbol.
return PTy->getPointeeType();
}