From: Ted Kremenek Date: Tue, 19 Feb 2008 02:34:18 +0000 (+0000) Subject: Fixed bug classof() bug with RValues that could cause an UninitializedVal X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e6ea2d572d8e09670c8d143e58380bf8145b123d;p=clang Fixed bug classof() bug with RValues that could cause an UninitializedVal 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 --- diff --git a/Analysis/GRSimpleVals.cpp b/Analysis/GRSimpleVals.cpp index c7fdfd050d..443a7ddb75 100644 --- a/Analysis/GRSimpleVals.cpp +++ b/Analysis/GRSimpleVals.cpp @@ -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(), diff --git a/include/clang/Analysis/PathSensitive/RValues.h b/include/clang/Analysis/PathSensitive/RValues.h index d4a2766ce6..cd78008aae 100644 --- a/include/clang/Analysis/PathSensitive/RValues.h +++ b/include/clang/Analysis/PathSensitive/RValues.h @@ -163,7 +163,8 @@ namespace nonlval { } static inline bool classof(const RValue* V) { - return isa(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(V) && V->getSubKind() == SymIntConstraintValKind; + return V->getBaseKind() == NonLValueKind && + V->getSubKind() == SymIntConstraintValKind; } }; @@ -199,11 +201,8 @@ namespace nonlval { // Implement isa support. static inline bool classof(const RValue* V) { - return isa(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(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(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 support. static inline bool classof(const RValue* V) { - return isa(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 support. static inline bool classof(const RValue* V) { - return isa(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 support. static inline bool classof(const RValue* V) { - return isa(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