]> granicus.if.org Git - clang/commitdiff
MemRegion:
authorTed Kremenek <kremenek@apple.com>
Wed, 4 Mar 2009 22:55:18 +0000 (22:55 +0000)
committerTed Kremenek <kremenek@apple.com>
Wed, 4 Mar 2009 22:55:18 +0000 (22:55 +0000)
- 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

include/clang/Analysis/PathSensitive/MemRegion.h
lib/Analysis/MemRegion.cpp

index 743a3b909880c5aa3b105704c2d3c437ad864dcb..2ddaa20d327763350bea96855f89ba988fe53a35 100644 (file)
@@ -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) {
index 8dd31b54b0baf8dd78684fcfeda9f9483319b352..c304b659b697332a5b1501e8d705a2bcb77bad9e 100644 (file)
@@ -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();