From: Ted Kremenek Date: Fri, 8 Feb 2008 02:57:34 +0000 (+0000) Subject: Renamed InvalidValue to UnknownVal. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2203118815997a0efcf19217e057bd20e33303e7;p=clang Renamed InvalidValue to UnknownVal. Renamed UninitializedValue to UninitializedVal. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46874 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/Analysis/GRConstants.cpp b/Analysis/GRConstants.cpp index 858ed9360a..7e23098955 100644 --- a/Analysis/GRConstants.cpp +++ b/Analysis/GRConstants.cpp @@ -439,14 +439,14 @@ void GRConstants::VisitLogicalExpr(BinaryOperator* B, NodeTy* Pred, RValue R1 = GetValue(PrevState, B->getLHS()); RValue R2 = GetValue(PrevState, B->getRHS(), hasR2); - if (isa(R1) && - (isa(R2) || - isa(R2))) { + if (isa(R1) && + (isa(R2) || + isa(R2))) { Nodify(Dst, B, Pred, SetValue(PrevState, B, R2)); return; } - else if (isa(R1)) { + else if (isa(R1)) { Nodify(Dst, B, Pred, SetValue(PrevState, B, R1)); return; } @@ -644,7 +644,7 @@ void GRConstants::VisitDeclStmt(DeclStmt* DS, GRConstants::NodeTy* Pred, if (const VarDecl* VD = dyn_cast(D)) { const Expr* E = VD->getInit(); St = SetValue(St, lval::DeclVal(VD), - E ? GetValue(St, E) : UninitializedValue()); + E ? GetValue(St, E) : UninitializedVal()); } Nodify(Dst, DS, Pred, St); @@ -660,7 +660,7 @@ void GRConstants::VisitGuardedExpr(Stmt* S, Stmt* LHS, Stmt* RHS, StateTy St = Pred->getState(); RValue R = GetValue(St, LHS); - if (isa(R)) R = GetValue(St, RHS); + if (isa(R)) R = GetValue(St, RHS); Nodify(Dst, S, Pred, SetValue(St, S, R)); } @@ -880,7 +880,7 @@ void GRConstants::VisitBinaryOperator(BinaryOperator* B, if (Op <= BinaryOperator::Or) { - if (isa(V1) || isa(V1)) { + if (isa(V1) || isa(V1)) { Nodify(Dst, B, N2, SetValue(St, B, V1)); continue; } @@ -915,7 +915,7 @@ void GRConstants::VisitBinaryOperator(BinaryOperator* B, assert (B->isCompoundAssignmentOp()); const LValue& L1 = cast(V1); - RValue Result = cast(InvalidValue()); + RValue Result = cast(UnknownVal()); Op = (BinaryOperator::Opcode) (((unsigned) Op) - ((unsigned) BinaryOperator::MulAssign)); diff --git a/Analysis/RValues.cpp b/Analysis/RValues.cpp index 387a30cf63..9813dcb57d 100644 --- a/Analysis/RValues.cpp +++ b/Analysis/RValues.cpp @@ -149,11 +149,11 @@ NonLValue NonLValue::EvalBinaryOp(ValueManager& ValMgr, BinaryOperator::Opcode Op, const NonLValue& RHS) const { - if (isa(this) || isa(RHS)) - return cast(InvalidValue()); + if (isa(this) || isa(RHS)) + return cast(UnknownVal()); - if (isa(this) || isa(RHS)) - return cast(UninitializedValue()); + if (isa(this) || isa(RHS)) + return cast(UninitializedVal()); switch (getSubKind()) { default: @@ -166,8 +166,8 @@ NonLValue NonLValue::EvalBinaryOp(ValueManager& ValMgr, return self.EvalBinaryOp(ValMgr, Op, cast(RHS)); } - else if(isa(RHS)) - return cast(InvalidValue()); + else if(isa(RHS)) + return cast(UnknownVal()); else return RHS.EvalBinaryOp(ValMgr, Op, *this); @@ -263,7 +263,7 @@ NonLValue NonLValue::EvalComplement(ValueManager& ValMgr) const { case nonlval::ConcreteIntKind: return cast(this)->EvalComplement(ValMgr); default: - return cast(InvalidValue()); + return cast(UnknownVal()); } } @@ -276,7 +276,7 @@ nonlval::ConcreteInt::EvalComplement(ValueManager& ValMgr) const { RValue NonLValue::EvalCast(ValueManager& ValMgr, Expr* CastExpr) const { if (!isa(this)) - return InvalidValue(); + return UnknownVal(); APSInt V = cast(this)->getValue(); QualType T = CastExpr->getType(); @@ -296,7 +296,7 @@ NonLValue NonLValue::EvalMinus(ValueManager& ValMgr, UnaryOperator* U) const { case nonlval::ConcreteIntKind: return cast(this)->EvalMinus(ValMgr, U); default: - return cast(InvalidValue()); + return cast(UnknownVal()); } } @@ -345,7 +345,7 @@ NonLValue LValue::EQ(ValueManager& ValMgr, const LValue& RHS) const { switch (getSubKind()) { default: assert(false && "EQ not implemented for this LValue."); - return cast(InvalidValue()); + return cast(UnknownVal()); case lval::ConcreteIntKind: if (isa(RHS)) { @@ -398,7 +398,7 @@ NonLValue LValue::NE(ValueManager& ValMgr, const LValue& RHS) const { switch (getSubKind()) { default: assert(false && "NE not implemented for this LValue."); - return cast(InvalidValue()); + return cast(UnknownVal()); case lval::ConcreteIntKind: if (isa(RHS)) { @@ -456,7 +456,7 @@ RValue LValue::EvalCast(ValueManager& ValMgr, Expr* CastExpr) const { assert (CastExpr->getType()->isIntegerType()); if (!isa(*this)) - return InvalidValue(); + return UnknownVal(); APSInt V = cast(this)->getValue(); QualType T = CastExpr->getType(); diff --git a/Analysis/RValues.h b/Analysis/RValues.h index ce9b8a683a..92f847b8dd 100644 --- a/Analysis/RValues.h +++ b/Analysis/RValues.h @@ -244,7 +244,7 @@ public: enum BaseKind { LValueKind=0x0, NonLValueKind=0x1, UninitializedKind=0x2, - InvalidKind=0x3 }; + UnknownKind=0x3 }; enum { BaseBits = 2, BaseMask = 0x3 }; @@ -290,8 +290,8 @@ public: static RValue GetSymbolValue(SymbolManager& SymMgr, ParmVarDecl *D); - inline bool isValid() const { return getRawKind() != InvalidKind; } - inline bool isInvalid() const { return getRawKind() == InvalidKind; } + inline bool isKnown() const { return getRawKind() != UnknownKind; } + inline bool isUnknown() const { return getRawKind() == UnknownKind; } void print(std::ostream& OS) const; void print() const; @@ -300,18 +300,18 @@ public: static inline bool classof(const RValue*) { return true; } }; -class InvalidValue : public RValue { +class UnknownVal : public RValue { public: - InvalidValue() : RValue(InvalidKind) {} + UnknownVal() : RValue(UnknownKind) {} static inline bool classof(const RValue* V) { - return V->getBaseKind() == InvalidKind; + return V->getBaseKind() == UnknownKind; } }; -class UninitializedValue : public RValue { +class UninitializedVal : public RValue { public: - UninitializedValue() : RValue(UninitializedKind) {} + UninitializedVal() : RValue(UninitializedKind) {} static inline bool classof(const RValue* V) { return V->getBaseKind() == UninitializedKind; diff --git a/Analysis/ValueState.cpp b/Analysis/ValueState.cpp index 20112c8ead..d278619ab5 100644 --- a/Analysis/ValueState.cpp +++ b/Analysis/ValueState.cpp @@ -35,15 +35,15 @@ const llvm::APSInt* ValueState::getSymVal(SymbolID sym) const { RValue ValueStateManager::GetValue(const StateTy& St, const LValue& LV, QualType* T) { - if (isa(LV)) - return InvalidValue(); + if (isa(LV)) + return UnknownVal(); switch (LV.getSubKind()) { case lval::DeclValKind: { StateTy::VariableBindingsTy::TreeTy* T = St.getImpl()->VariableBindings.SlimFind(cast(LV).getDecl()); - return T ? T->getValue().second : InvalidValue(); + return T ? T->getValue().second : UnknownVal(); } // FIXME: We should bind how far a "ContentsOf" will go... @@ -63,7 +63,7 @@ RValue ValueStateManager::GetValue(const StateTy& St, const LValue& LV, break; } - return InvalidValue(); + return UnknownVal(); } ValueStateManager::StateTy @@ -160,7 +160,7 @@ RValue ValueStateManager::GetValue(const StateTy& St, Stmt* S, bool* hasVal) { } else { if (hasVal) *hasVal = false; - return InvalidValue(); + return UnknownVal(); } } @@ -185,7 +185,7 @@ ValueStateManager::SetValue(StateTy St, Stmt* S, bool isBlkExpr, const RValue& V) { assert (S); - return V.isValid() ? Add(St, VarBindKey(S, isBlkExpr), V) : St; + return V.isKnown() ? Add(St, VarBindKey(S, isBlkExpr), V) : St; } ValueStateManager::StateTy @@ -193,7 +193,7 @@ ValueStateManager::SetValue(StateTy St, const LValue& LV, const RValue& V) { switch (LV.getSubKind()) { case lval::DeclValKind: - return V.isValid() ? Add(St, cast(LV).getDecl(), V) + return V.isKnown() ? Add(St, cast(LV).getDecl(), V) : Remove(St, cast(LV).getDecl()); default: