summaryrefslogtreecommitdiffstats
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
commit9a92b95092a3fa76e43be96e94ce871743f9d556 (patch)
treef763120c4b68c854dc538155fb798db0cf9127af
parent6ee8f8bcb51b353d2ad2f256b3f840c39e90efe3 (diff)
downloadbcm5719-llvm-9a92b95092a3fa76e43be96e94ce871743f9d556.tar.gz
bcm5719-llvm-9a92b95092a3fa76e43be96e94ce871743f9d556.zip
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). llvm-svn: 66093
-rw-r--r--clang/include/clang/Analysis/PathSensitive/MemRegion.h10
-rw-r--r--clang/lib/Analysis/MemRegion.cpp5
2 files changed, 7 insertions, 8 deletions
diff --git a/clang/include/clang/Analysis/PathSensitive/MemRegion.h b/clang/include/clang/Analysis/PathSensitive/MemRegion.h
index 743a3b90988..2ddaa20d327 100644
--- a/clang/include/clang/Analysis/PathSensitive/MemRegion.h
+++ b/clang/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/clang/lib/Analysis/MemRegion.cpp b/clang/lib/Analysis/MemRegion.cpp
index 8dd31b54b0b..c304b659b69 100644
--- a/clang/lib/Analysis/MemRegion.cpp
+++ b/clang/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();
OpenPOWER on IntegriCloud