diff --git a/clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h b/clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h --- a/clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h +++ b/clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h @@ -274,7 +274,12 @@ /// /// `E` must not be assigned a storage location in the environment. /// `E` must be a glvalue or a `BuiltinType::BuiltinFn` - void setStorageLocationStrict(const Expr &E, StorageLocation &Loc); + void setStorageLocation(const Expr &E, StorageLocation &Loc); + + /// Deprecated synonym for `setStorageLocation()`. + void setStorageLocationStrict(const Expr &E, StorageLocation &Loc) { + setStorageLocation(E, Loc); + } /// Returns the storage location assigned to the glvalue `E` in the /// environment, or null if `E` isn't assigned a storage location in the @@ -285,7 +290,12 @@ /// /// Requirements: /// `E` must be a glvalue or a `BuiltinType::BuiltinFn` - StorageLocation *getStorageLocationStrict(const Expr &E) const; + StorageLocation *getStorageLocation(const Expr &E) const; + + /// Deprecated synonym for `getStorageLocation()`. + StorageLocation *getStorageLocationStrict(const Expr &E) const { + return getStorageLocation(E); + } /// Returns the storage location assigned to the `this` pointee in the /// environment or null if the `this` pointee has no assigned storage location @@ -442,7 +452,10 @@ /// same as that of any `StructValue` that has already been associated with /// `E`. This is to guarantee that the result object initialized by a prvalue /// `StructValue` has a durable storage location. - void setValueStrict(const Expr &E, Value &Val); + void setValue(const Expr &E, Value &Val); + + /// Deprecated synonym for `setValue()`. + void setValueStrict(const Expr &E, Value &Val) { setValue(E, Val); } /// Returns the value assigned to `Loc` in the environment or null if `Loc` /// isn't assigned a value in the environment. @@ -585,11 +598,11 @@ // The copy-constructor is for use in fork() only. Environment(const Environment &) = default; - /// Internal version of `setStorageLocationStrict()` that doesn't check if the + /// Internal version of `setStorageLocation()` that doesn't check if the /// expression is a prvalue. void setStorageLocationInternal(const Expr &E, StorageLocation &Loc); - /// Internal version of `getStorageLocationStrict()` that doesn't check if the + /// Internal version of `getStorageLocation()` that doesn't check if the /// expression is a prvalue. StorageLocation *getStorageLocationInternal(const Expr &E) const; diff --git a/clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp b/clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp --- a/clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp +++ b/clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp @@ -337,7 +337,7 @@ if (const Expr *Arg = MethodCall->getImplicitObjectArgument()) { if (!isa(Arg)) Env.ThisPointeeLoc = - cast(getStorageLocationStrict(*Arg)); + cast(getStorageLocation(*Arg)); // Otherwise (when the argument is `this`), retain the current // environment's `ThisPointeeLoc`. } @@ -396,10 +396,10 @@ if (Call->isGLValue()) { if (CalleeEnv.ReturnLoc != nullptr) - setStorageLocationStrict(*Call, *CalleeEnv.ReturnLoc); + setStorageLocation(*Call, *CalleeEnv.ReturnLoc); } else if (!Call->getType()->isVoidType()) { if (CalleeEnv.ReturnVal != nullptr) - setValueStrict(*Call, *CalleeEnv.ReturnVal); + setValue(*Call, *CalleeEnv.ReturnVal); } } @@ -410,7 +410,7 @@ this->FlowConditionToken = std::move(CalleeEnv.FlowConditionToken); if (Value *Val = CalleeEnv.getValue(*CalleeEnv.ThisPointeeLoc)) { - setValueStrict(*Call, *Val); + setValue(*Call, *Val); } } @@ -618,8 +618,7 @@ return Loc; } -void Environment::setStorageLocationStrict(const Expr &E, - StorageLocation &Loc) { +void Environment::setStorageLocation(const Expr &E, StorageLocation &Loc) { // `DeclRefExpr`s to builtin function types aren't glvalues, for some reason, // but we still want to be able to associate a `StorageLocation` with them, // so allow these as an exception. @@ -628,8 +627,8 @@ setStorageLocationInternal(E, Loc); } -StorageLocation *Environment::getStorageLocationStrict(const Expr &E) const { - // See comment in `setStorageLocationStrict()`. +StorageLocation *Environment::getStorageLocation(const Expr &E) const { + // See comment in `setStorageLocation()`. assert(E.isGLValue() || E.getType()->isSpecificBuiltinType(BuiltinType::BuiltinFn)); return getStorageLocationInternal(E); @@ -663,7 +662,7 @@ LocToVal[&Loc] = &Val; } -void Environment::setValueStrict(const Expr &E, Value &Val) { +void Environment::setValue(const Expr &E, Value &Val) { assert(E.isPRValue()); if (auto *StructVal = dyn_cast(&Val)) { @@ -820,7 +819,7 @@ // can happen that we can't see the initializer, so `InitExpr` may still // be null. if (InitExpr) { - if (auto *InitExprLoc = getStorageLocationStrict(*InitExpr)) + if (auto *InitExprLoc = getStorageLocation(*InitExpr)) return *InitExprLoc; } @@ -906,7 +905,7 @@ return nullptr; } return cast_or_null( - Env.getStorageLocationStrict(*ImplicitObject)); + Env.getStorageLocation(*ImplicitObject)); } AggregateStorageLocation *getBaseObjectLocation(const MemberExpr &ME, @@ -919,8 +918,7 @@ return &cast(Val->getPointeeLoc()); return nullptr; } - return cast_or_null( - Env.getStorageLocationStrict(*Base)); + return cast_or_null(Env.getStorageLocation(*Base)); } std::vector getFieldsForInitListExpr(const RecordDecl *RD) { @@ -948,24 +946,24 @@ if (Expr.isPRValue()) { if (auto *ExistingVal = cast_or_null(Env.getValue(Expr))) { auto &NewVal = Env.create(ExistingVal->getAggregateLoc()); - Env.setValueStrict(Expr, NewVal); + Env.setValue(Expr, NewVal); return NewVal; } auto &NewVal = *cast(Env.createValue(Expr.getType())); - Env.setValueStrict(Expr, NewVal); + Env.setValue(Expr, NewVal); return NewVal; } if (auto *Loc = cast_or_null( - Env.getStorageLocationStrict(Expr))) { + Env.getStorageLocation(Expr))) { auto &NewVal = Env.create(*Loc); Env.setValue(*Loc, NewVal); return NewVal; } auto &NewVal = *cast(Env.createValue(Expr.getType())); - Env.setStorageLocationStrict(Expr, NewVal.getAggregateLoc()); + Env.setStorageLocation(Expr, NewVal.getAggregateLoc()); return NewVal; } diff --git a/clang/lib/Analysis/FlowSensitive/HTMLLogger.cpp b/clang/lib/Analysis/FlowSensitive/HTMLLogger.cpp --- a/clang/lib/Analysis/FlowSensitive/HTMLLogger.cpp +++ b/clang/lib/Analysis/FlowSensitive/HTMLLogger.cpp @@ -260,7 +260,7 @@ JOS->attributeObject( "value", [&] { ModelDumper(*JOS, State.Env).dump(*V); }); } else { - if (auto *Loc = State.Env.getStorageLocationStrict(*E)) + if (auto *Loc = State.Env.getStorageLocation(*E)) JOS->attributeObject( "value", [&] { ModelDumper(*JOS, State.Env).dump(*Loc); }); } diff --git a/clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp b/clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp --- a/clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp +++ b/clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp @@ -243,7 +243,7 @@ return Value->formula(); Value = &Env.makeAtomicBoolValue(); - Env.setValueStrict(Expr, *Value); + Env.setValue(Expr, *Value); return Value->formula(); } @@ -437,10 +437,10 @@ LatticeTransferState &State) { if (auto *OptionalVal = getValueBehindPossiblePointer(*ObjectExpr, State.Env)) { - if (State.Env.getStorageLocationStrict(*UnwrapExpr) == nullptr) + if (State.Env.getStorageLocation(*UnwrapExpr) == nullptr) if (auto *Loc = maybeInitializeOptionalValueMember( UnwrapExpr->getType(), *OptionalVal, State.Env)) - State.Env.setStorageLocationStrict(*UnwrapExpr, *Loc); + State.Env.setStorageLocation(*UnwrapExpr, *Loc); } } @@ -450,8 +450,7 @@ getValueBehindPossiblePointer(*ObjectExpr, State.Env)) { if (auto *Loc = maybeInitializeOptionalValueMember( UnwrapExpr->getType()->getPointeeType(), *OptionalVal, State.Env)) { - State.Env.setValueStrict(*UnwrapExpr, - State.Env.create(*Loc)); + State.Env.setValue(*UnwrapExpr, State.Env.create(*Loc)); } } } @@ -469,7 +468,7 @@ if (auto *HasValueVal = getHasValue( State.Env, getValueBehindPossiblePointer( *CallExpr->getImplicitObjectArgument(), State.Env))) { - State.Env.setValueStrict(*CallExpr, *HasValueVal); + State.Env.setValue(*CallExpr, *HasValueVal); } } @@ -538,11 +537,11 @@ Loc = &State.Env.getResultObjectLocation(*E); } else { Loc = cast_or_null( - State.Env.getStorageLocationStrict(*E)); + State.Env.getStorageLocation(*E)); if (Loc == nullptr) { Loc = &cast(State.Env.createStorageLocation(*E)); - State.Env.setStorageLocationStrict(*E, *Loc); + State.Env.setStorageLocation(*E, *Loc); } } @@ -552,7 +551,7 @@ void constructOptionalValue(const Expr &E, Environment &Env, BoolValue &HasValueVal) { AggregateStorageLocation &Loc = Env.getResultObjectLocation(E); - Env.setValueStrict(E, createOptionalValue(Loc, HasValueVal, Env)); + Env.setValue(E, createOptionalValue(Loc, HasValueVal, Env)); } /// Returns a symbolic value for the "has_value" property of an `optional` @@ -600,11 +599,11 @@ assert(E->getNumArgs() > 0); if (auto *Loc = cast( - State.Env.getStorageLocationStrict(*E->getArg(0)))) { + State.Env.getStorageLocation(*E->getArg(0)))) { createOptionalValue(*Loc, HasValueVal, State.Env); // Assign a storage location for the whole expression. - State.Env.setStorageLocationStrict(*E, *Loc); + State.Env.setStorageLocation(*E, *Loc); } } @@ -663,7 +662,7 @@ LatticeTransferState &State) { assert(E->getNumArgs() == 1); auto *OtherLoc = cast_or_null( - State.Env.getStorageLocationStrict(*E->getArg(0))); + State.Env.getStorageLocation(*E->getArg(0))); transferSwap(getImplicitObjectLocation(*E, State.Env), OtherLoc, State.Env); } @@ -671,9 +670,9 @@ LatticeTransferState &State) { assert(E->getNumArgs() == 2); auto *Arg0Loc = cast_or_null( - State.Env.getStorageLocationStrict(*E->getArg(0))); + State.Env.getStorageLocation(*E->getArg(0))); auto *Arg1Loc = cast_or_null( - State.Env.getStorageLocationStrict(*E->getArg(1))); + State.Env.getStorageLocation(*E->getArg(1))); transferSwap(Arg0Loc, Arg1Loc, State.Env); } @@ -681,8 +680,8 @@ LatticeTransferState &State) { assert(E->getNumArgs() == 1); - if (auto *Loc = State.Env.getStorageLocationStrict(*E->getArg(0))) - State.Env.setStorageLocationStrict(*E, *Loc); + if (auto *Loc = State.Env.getStorageLocation(*E->getArg(0))) + State.Env.setStorageLocation(*E, *Loc); } const Formula &evaluateEquality(Arena &A, const Formula &EqVal, diff --git a/clang/lib/Analysis/FlowSensitive/Transfer.cpp b/clang/lib/Analysis/FlowSensitive/Transfer.cpp --- a/clang/lib/Analysis/FlowSensitive/Transfer.cpp +++ b/clang/lib/Analysis/FlowSensitive/Transfer.cpp @@ -74,7 +74,7 @@ // value, if any unpacking occured. Also, does the lvalue-to-rvalue conversion, // by skipping past the reference. static Value *maybeUnpackLValueExpr(const Expr &E, Environment &Env) { - auto *Loc = Env.getStorageLocationStrict(E); + auto *Loc = Env.getStorageLocation(E); if (Loc == nullptr) return nullptr; auto *Val = Env.getValue(*Loc); @@ -92,13 +92,13 @@ static void propagateValue(const Expr &From, const Expr &To, Environment &Env) { if (auto *Val = Env.getValue(From)) - Env.setValueStrict(To, *Val); + Env.setValue(To, *Val); } static void propagateStorageLocation(const Expr &From, const Expr &To, Environment &Env) { - if (auto *Loc = Env.getStorageLocationStrict(From)) - Env.setStorageLocationStrict(To, *Loc); + if (auto *Loc = Env.getStorageLocation(From)) + Env.setStorageLocation(To, *Loc); } // Propagates the value or storage location of `From` to `To` in cases where @@ -129,7 +129,7 @@ switch (S->getOpcode()) { case BO_Assign: { - auto *LHSLoc = Env.getStorageLocationStrict(*LHS); + auto *LHSLoc = Env.getStorageLocation(*LHS); if (LHSLoc == nullptr) break; @@ -141,7 +141,7 @@ Env.setValue(*LHSLoc, *RHSVal); // Assign a storage location for the whole expression. - Env.setStorageLocationStrict(*S, *LHSLoc); + Env.setStorageLocation(*S, *LHSLoc); break; } case BO_LAnd: @@ -150,17 +150,16 @@ BoolValue &RHSVal = getLogicOperatorSubExprValue(*RHS); if (S->getOpcode() == BO_LAnd) - Env.setValueStrict(*S, Env.makeAnd(LHSVal, RHSVal)); + Env.setValue(*S, Env.makeAnd(LHSVal, RHSVal)); else - Env.setValueStrict(*S, Env.makeOr(LHSVal, RHSVal)); + Env.setValue(*S, Env.makeOr(LHSVal, RHSVal)); break; } case BO_NE: case BO_EQ: { auto &LHSEqRHSValue = evaluateBooleanEquality(*LHS, *RHS, Env); - Env.setValueStrict(*S, S->getOpcode() == BO_EQ - ? LHSEqRHSValue - : Env.makeNot(LHSEqRHSValue)); + Env.setValue(*S, S->getOpcode() == BO_EQ ? LHSEqRHSValue + : Env.makeNot(LHSEqRHSValue)); break; } case BO_Comma: { @@ -188,7 +187,7 @@ if (DeclLoc == nullptr) return; - Env.setStorageLocationStrict(*S, *DeclLoc); + Env.setStorageLocation(*S, *DeclLoc); } void VisitDeclStmt(const DeclStmt *S) { @@ -234,7 +233,7 @@ VisitDeclRefExpr(DE); VisitMemberExpr(ME); - if (auto *Loc = Env.getStorageLocationStrict(*ME)) + if (auto *Loc = Env.getStorageLocation(*ME)) Env.setStorageLocation(*B, *Loc); } else if (auto *VD = B->getHoldingVar()) { // Holding vars are used to back the `BindingDecl`s of tuple-like @@ -263,11 +262,11 @@ // boolean. if (auto *SubExprVal = dyn_cast_or_null(Env.getValue(*SubExpr))) - Env.setValueStrict(*S, *SubExprVal); + Env.setValue(*S, *SubExprVal); else // FIXME: If integer modeling is added, then update this code to create // the boolean based on the integer model. - Env.setValueStrict(*S, Env.makeAtomicBoolValue()); + Env.setValue(*S, Env.makeAtomicBoolValue()); break; } @@ -279,7 +278,7 @@ if (SubExprVal == nullptr) break; - Env.setValueStrict(*S, *SubExprVal); + Env.setValue(*S, *SubExprVal); break; } @@ -304,7 +303,7 @@ case CK_NullToPointer: { auto &NullPointerVal = Env.getOrCreateNullPointerValue(S->getType()->getPointeeType()); - Env.setValueStrict(*S, NullPointerVal); + Env.setValue(*S, NullPointerVal); break; } case CK_NullToMemberPointer: @@ -312,11 +311,11 @@ // with this expression. break; case CK_FunctionToPointerDecay: { - StorageLocation *PointeeLoc = Env.getStorageLocationStrict(*SubExpr); + StorageLocation *PointeeLoc = Env.getStorageLocation(*SubExpr); if (PointeeLoc == nullptr) break; - Env.setValueStrict(*S, Env.create(*PointeeLoc)); + Env.setValue(*S, Env.create(*PointeeLoc)); break; } case CK_BuiltinFnToFnPtr: @@ -341,7 +340,7 @@ if (SubExprVal == nullptr) break; - Env.setStorageLocationStrict(*S, SubExprVal->getPointeeLoc()); + Env.setStorageLocation(*S, SubExprVal->getPointeeLoc()); break; } case UO_AddrOf: { @@ -349,8 +348,8 @@ if (S->getType()->isMemberPointerType()) break; - if (StorageLocation *PointeeLoc = Env.getStorageLocationStrict(*SubExpr)) - Env.setValueStrict(*S, Env.create(*PointeeLoc)); + if (StorageLocation *PointeeLoc = Env.getStorageLocation(*SubExpr)) + Env.setValue(*S, Env.create(*PointeeLoc)); break; } case UO_LNot: { @@ -358,7 +357,7 @@ if (SubExprVal == nullptr) break; - Env.setValueStrict(*S, Env.makeNot(*SubExprVal)); + Env.setValue(*S, Env.makeNot(*SubExprVal)); break; } default: @@ -373,12 +372,12 @@ // `this` expression's pointee. return; - Env.setValueStrict(*S, Env.create(*ThisPointeeLoc)); + Env.setValue(*S, Env.create(*ThisPointeeLoc)); } void VisitCXXNewExpr(const CXXNewExpr *S) { if (Value *Val = Env.createValue(S->getType())) - Env.setValueStrict(*S, *Val); + Env.setValue(*S, *Val); } void VisitCXXDeleteExpr(const CXXDeleteExpr *S) { @@ -404,7 +403,7 @@ // FIXME: Model NRVO. Env.setReturnValue(Val); } else { - auto *Loc = Env.getStorageLocationStrict(*Ret); + auto *Loc = Env.getStorageLocation(*Ret); if (Loc == nullptr) return; @@ -431,7 +430,7 @@ if (VarDeclLoc == nullptr) return; - Env.setStorageLocationStrict(*S, *VarDeclLoc); + Env.setStorageLocation(*S, *VarDeclLoc); return; } } @@ -443,7 +442,7 @@ auto *MemberLoc = BaseLoc->getChild(*Member); if (MemberLoc == nullptr) return; - Env.setStorageLocationStrict(*S, *MemberLoc); + Env.setStorageLocation(*S, *MemberLoc); } void VisitCXXDefaultInitExpr(const CXXDefaultInitExpr *S) { @@ -464,17 +463,17 @@ const Expr *Arg = S->getArg(0); assert(Arg != nullptr); - auto *ArgLoc = cast_or_null( - Env.getStorageLocationStrict(*Arg)); + auto *ArgLoc = + cast_or_null(Env.getStorageLocation(*Arg)); if (ArgLoc == nullptr) return; if (S->isElidable()) { if (Value *Val = Env.getValue(*ArgLoc)) - Env.setValueStrict(*S, *Val); + Env.setValue(*S, *Val); } else { auto &Val = *cast(Env.createValue(S->getType())); - Env.setValueStrict(*S, Val); + Env.setValue(*S, Val); copyRecord(*ArgLoc, Val.getAggregateLoc(), Env); } return; @@ -511,14 +510,14 @@ !Method->isMoveAssignmentOperator()) return; - auto *LocSrc = cast_or_null( - Env.getStorageLocationStrict(*Arg1)); - auto *LocDst = cast_or_null( - Env.getStorageLocationStrict(*Arg0)); + auto *LocSrc = + cast_or_null(Env.getStorageLocation(*Arg1)); + auto *LocDst = + cast_or_null(Env.getStorageLocation(*Arg0)); if (LocSrc != nullptr && LocDst != nullptr) { copyRecord(*LocSrc, *LocDst, Env); - Env.setStorageLocationStrict(*S, *LocDst); + Env.setStorageLocation(*S, *LocDst); } } } @@ -534,7 +533,7 @@ void VisitCXXTemporaryObjectExpr(const CXXTemporaryObjectExpr *S) { if (Value *Val = Env.createValue(S->getType())) - Env.setValueStrict(*S, *Val); + Env.setValue(*S, *Val); } void VisitCallExpr(const CallExpr *S) { @@ -547,11 +546,11 @@ const Expr *Arg = S->getArg(0); assert(Arg != nullptr); - auto *ArgLoc = Env.getStorageLocationStrict(*Arg); + auto *ArgLoc = Env.getStorageLocation(*Arg); if (ArgLoc == nullptr) return; - Env.setStorageLocationStrict(*S, *ArgLoc); + Env.setStorageLocation(*S, *ArgLoc); } else if (S->getDirectCallee() != nullptr && S->getDirectCallee()->getBuiltinID() == Builtin::BI__builtin_expect) { @@ -560,7 +559,7 @@ auto *ArgVal = Env.getValue(*S->getArg(0)); if (ArgVal == nullptr) return; - Env.setValueStrict(*S, *ArgVal); + Env.setValue(*S, *ArgVal); } else if (const FunctionDecl *F = S->getDirectCallee()) { transferInlineCall(S, F); } @@ -575,13 +574,13 @@ return; if (StructValue *StructVal = dyn_cast(SubExprVal)) { - Env.setStorageLocationStrict(*S, StructVal->getAggregateLoc()); + Env.setStorageLocation(*S, StructVal->getAggregateLoc()); return; } StorageLocation &Loc = Env.createStorageLocation(*S); Env.setValue(Loc, *SubExprVal); - Env.setStorageLocationStrict(*S, Loc); + Env.setStorageLocation(*S, Loc); } void VisitCXXBindTemporaryExpr(const CXXBindTemporaryExpr *S) { @@ -605,9 +604,9 @@ // `a = b ? c : d` we can add `b => a == c && !b => a == d` to the flow // condition. if (S->isGLValue()) - Env.setStorageLocationStrict(*S, Env.createObject(S->getType())); + Env.setStorageLocation(*S, Env.createObject(S->getType())); else if (Value *Val = Env.createValue(S->getType())) - Env.setValueStrict(*S, *Val); + Env.setValue(*S, *Val); } void VisitInitListExpr(const InitListExpr *S) { @@ -615,7 +614,7 @@ if (!Type->isStructureOrClassType()) { if (auto *Val = Env.createValue(Type)) - Env.setValueStrict(*S, *Val); + Env.setValue(*S, *Val); return; } @@ -646,17 +645,17 @@ Env.setValue(Loc, StructVal); - Env.setValueStrict(*S, StructVal); + Env.setValue(*S, StructVal); // FIXME: Implement array initialization. } void VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *S) { - Env.setValueStrict(*S, Env.getBoolLiteralValue(S->getValue())); + Env.setValue(*S, Env.getBoolLiteralValue(S->getValue())); } void VisitIntegerLiteral(const IntegerLiteral *S) { - Env.setValueStrict(*S, Env.getIntLiteralValue(S->getValue())); + Env.setValue(*S, Env.getIntLiteralValue(S->getValue())); } void VisitParenExpr(const ParenExpr *S) { diff --git a/clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp b/clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp --- a/clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp +++ b/clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp @@ -135,7 +135,7 @@ // for the condition expression, even if just an atom. if (Val == nullptr) { Val = &Env.makeAtomicBoolValue(); - Env.setValueStrict(Cond, *Val); + Env.setValue(Cond, *Val); } bool ConditionValue = true; @@ -402,7 +402,7 @@ // the `AggregateStorageLocation` already exists. We should explore if there's // anything that we can do to change this. if (Member->getType()->isReferenceType()) { - auto *InitExprLoc = Env.getStorageLocationStrict(*InitExpr); + auto *InitExprLoc = Env.getStorageLocation(*InitExpr); if (InitExprLoc == nullptr) return; diff --git a/clang/unittests/Analysis/FlowSensitive/DataflowEnvironmentTest.cpp b/clang/unittests/Analysis/FlowSensitive/DataflowEnvironmentTest.cpp --- a/clang/unittests/Analysis/FlowSensitive/DataflowEnvironmentTest.cpp +++ b/clang/unittests/Analysis/FlowSensitive/DataflowEnvironmentTest.cpp @@ -279,9 +279,9 @@ ASSERT_THAT(DRE, NotNull()); Environment Env(DAContext, *Target); - EXPECT_THAT(Env.getStorageLocationStrict(*DRE), IsNull()); + EXPECT_THAT(Env.getStorageLocation(*DRE), IsNull()); refreshStructValue(*DRE, Env); - EXPECT_THAT(Env.getStorageLocationStrict(*DRE), NotNull()); + EXPECT_THAT(Env.getStorageLocation(*DRE), NotNull()); } } // namespace diff --git a/clang/unittests/Analysis/FlowSensitive/SignAnalysisTest.cpp b/clang/unittests/Analysis/FlowSensitive/SignAnalysisTest.cpp --- a/clang/unittests/Analysis/FlowSensitive/SignAnalysisTest.cpp +++ b/clang/unittests/Analysis/FlowSensitive/SignAnalysisTest.cpp @@ -117,7 +117,7 @@ auto *UnaryOpValue = State.Env.getValue(*UO); if (!UnaryOpValue) { UnaryOpValue = &State.Env.makeAtomicBoolValue(); - State.Env.setValueStrict(*UO, *UnaryOpValue); + State.Env.setValue(*UO, *UnaryOpValue); } // Properties for the operand (sub expression). @@ -137,7 +137,7 @@ Comp = &V->formula(); } else { Comp = &A.makeAtomRef(A.makeAtom()); - State.Env.setValueStrict(*BO, A.makeBoolValue(*Comp)); + State.Env.setValue(*BO, A.makeBoolValue(*Comp)); } // FIXME Use this as well: @@ -260,10 +260,10 @@ Value *getOrCreateValue(const Expr *E, Environment &Env) { Value *Val = nullptr; if (E->isGLValue()) { - StorageLocation *Loc = Env.getStorageLocationStrict(*E); + StorageLocation *Loc = Env.getStorageLocation(*E); if (!Loc) { Loc = &Env.createStorageLocation(*E); - Env.setStorageLocationStrict(*E, *Loc); + Env.setStorageLocation(*E, *Loc); } Val = Env.getValue(*Loc); if (!Val) { @@ -274,7 +274,7 @@ Val = Env.getValue(*E); if (!Val) { Val = Env.createValue(E->getType()); - Env.setValueStrict(*E, *Val); + Env.setValue(*E, *Val); } } assert(Val != nullptr); diff --git a/clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp b/clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp --- a/clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp +++ b/clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp @@ -1243,7 +1243,7 @@ match(callExpr(callee(functionDecl(hasName("makeTop")))).bind("top"), *S, getASTContext()); if (const auto *E = selectFirst("top", Matches)) { - Env.setValueStrict(*E, Env.makeTopBoolValue()); + Env.setValue(*E, Env.makeTopBoolValue()); } }