[cfe-commits] r50493 - in /cfe/trunk/lib/Analysis: CFRefCount.cpp GRExprEngine.cpp

Ted Kremenek kremenek at apple.com
Wed Apr 30 13:01:29 PDT 2008


Author: kremenek
Date: Wed Apr 30 15:01:29 2008
New Revision: 50493

URL: http://llvm.org/viewvc/llvm-project?rev=50493&view=rev
Log:
Teach the static analysis engine about ObjCQualifiedIdType.

Modified:
    cfe/trunk/lib/Analysis/CFRefCount.cpp
    cfe/trunk/lib/Analysis/GRExprEngine.cpp

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

==============================================================================
--- cfe/trunk/lib/Analysis/CFRefCount.cpp (original)
+++ cfe/trunk/lib/Analysis/CFRefCount.cpp Wed Apr 30 15:01:29 2008
@@ -335,8 +335,7 @@
   if (strcmp("CFTypeRef", TDName) != 0)
     return NULL;
   
-  if (!ArgT->isPointerType())
-    return NULL;
+  assert (ArgT->isPointerType() || ArgT->isObjCQualifiedIdType());
 
   QualType RetTy = FT->getResultType();
   

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

==============================================================================
--- cfe/trunk/lib/Analysis/GRExprEngine.cpp (original)
+++ cfe/trunk/lib/Analysis/GRExprEngine.cpp Wed Apr 30 15:01:29 2008
@@ -28,6 +28,10 @@
 using llvm::cast;
 using llvm::APSInt;
 
+static inline bool IsPointerType(QualType T) {
+  return T->isPointerType() || T->isObjCQualifiedIdType();
+}
+
 //===----------------------------------------------------------------------===//
 // Engine construction and deletion.
 //===----------------------------------------------------------------------===//
@@ -786,7 +790,7 @@
   // abstract address of the base object.
   NodeSet Tmp;
   
-  if (Base->getType()->isPointerType()) // Base always is an LVal.
+  if (IsPointerType(Base->getType())) // Base always is an LVal.
     Visit(Base, Pred, Tmp);
   else  
     VisitLVal(Base, Pred, Tmp);
@@ -823,7 +827,7 @@
   // abstract address of the base object.
   NodeSet Tmp;
   
-  if (Base->getType()->isPointerType()) // Base always is an LVal.
+  if (IsPointerType(Base->getType())) // Base always is an LVal.
     Visit(Base, Pred, Tmp);
   else  
     VisitLVal(Base, Pred, Tmp);
@@ -1269,7 +1273,7 @@
     }
   
     // Check for casts from pointers to integers.
-    if (T->isIntegerType() && ExTy->isPointerType()) {
+    if (T->isIntegerType() && IsPointerType(ExTy)) {
       unsigned bits = getContext().getTypeSize(ExTy);
     
       // FIXME: Determine if the number of bits of the target type is 
@@ -1282,7 +1286,7 @@
     }
     
     // Check for casts from integers to pointers.
-    if (T->isPointerType() && ExTy->isIntegerType())
+    if (IsPointerType(T) && ExTy->isIntegerType())
       if (nonlval::LValAsInteger *LV = dyn_cast<nonlval::LValAsInteger>(&V)) {
         // Just unpackage the lval and return it.
         V = LV->getLVal();
@@ -1361,7 +1365,7 @@
 
         QualType T = VD->getType();
         
-        if (T->isPointerType())          
+        if (IsPointerType(T))
           St = SetRVal(St, lval::DeclVal(VD),
                        lval::ConcreteInt(BasicVals.getValue(0, T)));
         else if (T->isIntegerType())
@@ -1379,7 +1383,7 @@
 
       QualType T = VD->getType();
 
-      if (T->isPointerType() || T->isIntegerType()) {
+      if (IsPointerType(T) || T->isIntegerType()) {
         
         RVal V = Ex ? GetRVal(St, Ex) : UndefinedVal();
         
@@ -1390,7 +1394,7 @@
           unsigned Count = Builder->getCurrentBlockCount();
           SymbolID Sym = SymMgr.getConjuredSymbol(Ex, Count);
           
-          V = Ex->getType()->isPointerType()
+          V = IsPointerType(Ex->getType())
             ? cast<RVal>(lval::SymbolVal(Sym)) 
             : cast<RVal>(nonlval::SymbolVal(Sym));            
         }
@@ -1833,7 +1837,7 @@
             unsigned Count = Builder->getCurrentBlockCount();
             SymbolID Sym = SymMgr.getConjuredSymbol(B->getRHS(), Count);
             
-            RightV = B->getRHS()->getType()->isPointerType() 
+            RightV = IsPointerType(B->getRHS()->getType()) 
                    ? cast<RVal>(lval::SymbolVal(Sym)) 
                    : cast<RVal>(nonlval::SymbolVal(Sym));            
           }





More information about the cfe-commits mailing list