[cfe-commits] r47304 - in /cfe/trunk: Analysis/GRSimpleVals.cpp include/clang/Analysis/PathSensitive/RValues.h

Ted Kremenek kremenek at apple.com
Mon Feb 18 18:34:18 PST 2008


Author: kremenek
Date: Mon Feb 18 20:34:18 2008
New Revision: 47304

URL: http://llvm.org/viewvc/llvm-project?rev=47304&view=rev
Log:
Fixed bug classof() bug with RValues that could cause an UninitializedVal
or UnknownVal to be interpreted as an actual NonLValue/LValue.

Modified:
    cfe/trunk/Analysis/GRSimpleVals.cpp
    cfe/trunk/include/clang/Analysis/PathSensitive/RValues.h

Modified: cfe/trunk/Analysis/GRSimpleVals.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Analysis/GRSimpleVals.cpp?rev=47304&r1=47303&r2=47304&view=diff

==============================================================================
--- cfe/trunk/Analysis/GRSimpleVals.cpp (original)
+++ cfe/trunk/Analysis/GRSimpleVals.cpp Mon Feb 18 20:34:18 2008
@@ -31,7 +31,7 @@
     CheckerState->setTransferFunctions(GRSV);
     
     // Execute the worklist algorithm.
-    Engine.ExecuteWorkList(200);
+    Engine.ExecuteWorkList(10000);
     
     // Look for explicit-Null dereferences and warn about them.
     for (GRExprEngine::null_iterator I=CheckerState->null_begin(),

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

==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/RValues.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/RValues.h Mon Feb 18 20:34:18 2008
@@ -163,7 +163,8 @@
     }
     
     static inline bool classof(const RValue* V) {
-      return isa<NonLValue>(V) && V->getSubKind() == SymbolValKind;
+      return V->getBaseKind() == NonLValueKind && 
+             V->getSubKind() == SymbolValKind;
     }
   };
   
@@ -177,7 +178,8 @@
     }
     
     static inline bool classof(const RValue* V) {
-      return isa<NonLValue>(V) && V->getSubKind() == SymIntConstraintValKind;
+      return V->getBaseKind() == NonLValueKind &&
+             V->getSubKind() == SymIntConstraintValKind;
     }    
   };
 
@@ -199,11 +201,8 @@
     
     // Implement isa<T> support.
     static inline bool classof(const RValue* V) {
-      return isa<NonLValue>(V) && V->getSubKind() == ConcreteIntKind;
-    }
-    
-    static inline bool classof(const NonLValue* V) {
-      return V->getSubKind() == ConcreteIntKind;
+      return V->getBaseKind() == NonLValueKind &&
+             V->getSubKind() == ConcreteIntKind;
     }
   };
   
@@ -232,11 +231,8 @@
     }
     
     static inline bool classof(const RValue* V) {
-      return isa<LValue>(V) && V->getSubKind() == SymbolValKind;
-    }
-    
-    static inline bool classof(const LValue* V) {
-      return V->getSubKind() == SymbolValKind;
+      return V->getBaseKind() == LValueKind &&
+             V->getSubKind() == SymbolValKind;
     }
   };
   
@@ -249,12 +245,9 @@
     }
     
     static inline bool classof(const RValue* V) {
-      return isa<LValue>(V) && V->getSubKind() == GotoLabelKind;
-    }
-    
-    static inline bool classof(const LValue* V) {
-      return V->getSubKind() == GotoLabelKind;
-    }
+      return V->getBaseKind() == LValueKind &&
+             V->getSubKind() == GotoLabelKind;
+    }    
   };
     
   
@@ -276,12 +269,9 @@
     
     // Implement isa<T> support.
     static inline bool classof(const RValue* V) {
-      return isa<LValue>(V) && V->getSubKind() == DeclValKind;
-    }
-    
-    static inline bool classof(const LValue* V) {
-      return V->getSubKind() == DeclValKind;
-    }
+      return V->getBaseKind() == LValueKind &&
+             V->getSubKind() == DeclValKind;
+    }    
   };
   
   class FuncVal : public LValue {
@@ -302,12 +292,9 @@
     
     // Implement isa<T> support.
     static inline bool classof(const RValue* V) {
-      return isa<LValue>(V) && V->getSubKind() == FuncValKind;
-    }
-    
-    static inline bool classof(const LValue* V) {
-      return V->getSubKind() == FuncValKind;
-    }
+      return V->getBaseKind() == LValueKind &&
+             V->getSubKind() == FuncValKind;
+    }    
   };
 
   class ConcreteInt : public LValue {
@@ -326,13 +313,9 @@
         
     // Implement isa<T> support.
     static inline bool classof(const RValue* V) {
-      return isa<LValue>(V) && V->getSubKind() == ConcreteIntKind;
-    }
-    
-    static inline bool classof(const LValue* V) {
-      return V->getSubKind() == ConcreteIntKind;
+      return V->getBaseKind() == LValueKind &&
+             V->getSubKind() == ConcreteIntKind;
     }
-    
   };  
 } // end clang::lval namespace
 





More information about the cfe-commits mailing list