]> granicus.if.org Git - clang/commitdiff
Fixed bug classof() bug with RValues that could cause an UninitializedVal
authorTed Kremenek <kremenek@apple.com>
Tue, 19 Feb 2008 02:34:18 +0000 (02:34 +0000)
committerTed Kremenek <kremenek@apple.com>
Tue, 19 Feb 2008 02:34:18 +0000 (02:34 +0000)
or UnknownVal to be interpreted as an actual NonLValue/LValue.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47304 91177308-0d34-0410-b5e6-96231b3b80d8

Analysis/GRSimpleVals.cpp
include/clang/Analysis/PathSensitive/RValues.h

index c7fdfd050de7d8673a0b313b8d8ade0cf88ae516..443a7ddb7599dd4c5bfda4e928dd3076bc3f897e 100644 (file)
@@ -31,7 +31,7 @@ namespace clang {
     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(),
index d4a2766ce66dcafda84cd4e5aa72e1ea5cbe98f2..cd78008aae88a75f1701653b14bb1eb11633933d 100644 (file)
@@ -163,7 +163,8 @@ namespace nonlval {
     }
     
     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 @@ namespace nonlval {
     }
     
     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 @@ namespace nonlval {
     
     // 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 @@ namespace lval {
     }
     
     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 @@ namespace lval {
     }
     
     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 @@ namespace lval {
     
     // 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 @@ namespace lval {
     
     // 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 @@ namespace lval {
         
     // 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