[cfe-commits] r74853 - /cfe/trunk/lib/Analysis/Store.cpp

Ted Kremenek kremenek at apple.com
Mon Jul 6 14:01:17 PDT 2009


Author: kremenek
Date: Mon Jul  6 16:01:16 2009
New Revision: 74853

URL: http://llvm.org/viewvc/llvm-project?rev=74853&view=rev
Log:
NewCastRegion:
- Have test for 'CodeTextRegion' dominate other region tests.
- Use 'getAsRecordType' instead of isa<RecordType>

Modified:
    cfe/trunk/lib/Analysis/Store.cpp

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

==============================================================================
--- cfe/trunk/lib/Analysis/Store.cpp (original)
+++ cfe/trunk/lib/Analysis/Store.cpp Mon Jul  6 16:01:16 2009
@@ -30,13 +30,7 @@
   
   // We need to know the real type of CastToTy.
   QualType ToTy = Ctx.getCanonicalType(CastToTy);
-  
-  // Check cast to ObjCQualifiedID type.
-  if (ToTy->isObjCQualifiedIdType()) {
-    // FIXME: Record the type information aside.
-    return CastResult(state, R);
-  }
-  
+    
   // CodeTextRegion should be cast to only function pointer type.
   if (isa<CodeTextRegion>(R)) {
     assert(CastToTy->isFunctionPointerType() || CastToTy->isBlockPointerType()
@@ -45,6 +39,12 @@
     return CastResult(state, R);
   }
   
+  // Check cast to ObjCQualifiedID type.
+  if (ToTy->isObjCQualifiedIdType()) {
+    // FIXME: Record the type information aside.
+    return CastResult(state, R);
+  }
+  
   // Now assume we are casting from pointer to pointer. Other cases should
   // already be handled.
   QualType PointeeTy = cast<PointerType>(ToTy.getTypePtr())->getPointeeType();
@@ -65,7 +65,7 @@
       || isa<ObjCIvarRegion>(R) || isa<CompoundLiteralRegion>(R)) {
     // If the pointee type is incomplete, do not compute its size, and return
     // the original region.
-    if (const RecordType *RT = dyn_cast<RecordType>(PointeeTy.getTypePtr())) {
+    if (const RecordType *RT = PointeeTy->getAsRecordType()) {
       const RecordDecl *D = RT->getDecl();
       if (!D->getDefinition(Ctx))
         return CastResult(state, R);
@@ -121,7 +121,6 @@
     // FIXME: Handle arbitrary upcasts.
     QualType Pointee = PTy->getPointeeType();
     if (Pointee->isVoidType()) {
-
       while (true) {
         if (const TypedViewRegion *TR = dyn_cast<TypedViewRegion>(R)) {
           // Casts to void* removes TypedViewRegion. This happens when:
@@ -149,8 +148,8 @@
           R = ER->getSuperRegion();
           continue;
         }
-        else
-          break;
+
+        break;
       }
       
       return CastResult(state, R);
@@ -178,7 +177,6 @@
   // FIXME: Handle the case where a TypedViewRegion (layering a SymbolicRegion
   //         or an AllocaRegion is cast to another view, thus causing the memory
   //         to be re-used for a different purpose.
-
   if (isa<SymbolicRegion>(R) || isa<AllocaRegion>(R)) {
     const MemRegion* ViewR = MRMgr.getTypedViewRegion(CastToTy, R);  
     return CastResult(AddRegionView(state, ViewR, R), ViewR);





More information about the cfe-commits mailing list