aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-03-04 22:55:18 +0000
committerTed Kremenek <kremenek@apple.com>2009-03-04 22:55:18 +0000
commit1b9b883a95215e38e153d253a46a2a2fcac25896 (patch)
treefc5e17e6a8aa0da107db586c57707a15eb9d88a7
parenta880b66d6e0e446501fcbc27b87a1ec0e4ecde4c (diff)
MemRegion:
- Have 'TypedRegion::getRValueType()' return a null QualType for 'id<...>' instead of aborting. - Change 'TypedRegion::isBoundable()' to return true for all objects with a non-null RValueType (this may not be the final behavior). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66093 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/Analysis/PathSensitive/MemRegion.h10
-rw-r--r--lib/Analysis/MemRegion.cpp5
2 files changed, 7 insertions, 8 deletions
diff --git a/include/clang/Analysis/PathSensitive/MemRegion.h b/include/clang/Analysis/PathSensitive/MemRegion.h
index 743a3b9098..2ddaa20d32 100644
--- a/include/clang/Analysis/PathSensitive/MemRegion.h
+++ b/include/clang/Analysis/PathSensitive/MemRegion.h
@@ -154,18 +154,16 @@ public:
}
QualType getDesugaredRValueType(ASTContext& C) const {
- return getRValueType(C)->getDesugaredType();
+ QualType T = getRValueType(C);
+ return T.getTypePtr() ? T->getDesugaredType() : T;
}
QualType getDesugaredLValueType(ASTContext& C) const {
return getLValueType(C)->getDesugaredType();
}
-
+
bool isBoundable(ASTContext &C) const {
- // FIXME: This needs to be adjusted for structures and arrays.
- // All this will reject right now is ObjCQualifiedIdType and
- // BlockPointerType.
- return getLValueType(C)->isPointerType();
+ return !getRValueType(C).isNull();
}
static bool classof(const MemRegion* R) {
diff --git a/lib/Analysis/MemRegion.cpp b/lib/Analysis/MemRegion.cpp
index 8dd31b54b0..c304b659b6 100644
--- a/lib/Analysis/MemRegion.cpp
+++ b/lib/Analysis/MemRegion.cpp
@@ -123,8 +123,9 @@ QualType SymbolicRegion::getRValueType(ASTContext& C) const {
if (const BlockPointerType* PTy = T->getAsBlockPointerType())
return PTy->getPointeeType();
- assert(!T->getAsObjCQualifiedIdType() &&
- "There is no rvalue type for id<...>");
+ // There is no rvalue type of id<...>.
+ if (T->getAsObjCQualifiedIdType())
+ return QualType();
assert(Loc::IsLocType(T) && "Non-location type.");
return QualType();