[cfe-commits] r66093 - in /cfe/trunk: include/clang/Analysis/PathSensitive/MemRegion.h lib/Analysis/MemRegion.cpp

Ted Kremenek kremenek at apple.com
Wed Mar 4 14:55:19 PST 2009


Author: kremenek
Date: Wed Mar  4 16:55:18 2009
New Revision: 66093

URL: http://llvm.org/viewvc/llvm-project?rev=66093&view=rev
Log:
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).

Modified:
    cfe/trunk/include/clang/Analysis/PathSensitive/MemRegion.h
    cfe/trunk/lib/Analysis/MemRegion.cpp

Modified: cfe/trunk/include/clang/Analysis/PathSensitive/MemRegion.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/PathSensitive/MemRegion.h?rev=66093&r1=66092&r2=66093&view=diff

==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/MemRegion.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/MemRegion.h Wed Mar  4 16:55:18 2009
@@ -154,18 +154,16 @@
   }
   
   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) {

Modified: cfe/trunk/lib/Analysis/MemRegion.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/MemRegion.cpp?rev=66093&r1=66092&r2=66093&view=diff

==============================================================================
--- cfe/trunk/lib/Analysis/MemRegion.cpp (original)
+++ cfe/trunk/lib/Analysis/MemRegion.cpp Wed Mar  4 16:55:18 2009
@@ -123,8 +123,9 @@
   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();





More information about the cfe-commits mailing list