Skip to content

Commit 0c852dc

Browse files
committed
[clang][dataflow][NFC] Remove SkipPast param from getValue(const ValueDecl &).
This parameter was already a no-op, so removing it doesn't change behavior. Reviewed By: ymandel Differential Revision: https://reviews.llvm.org/D150137
1 parent a940c23 commit 0c852dc

File tree

8 files changed

+218
-291
lines changed

8 files changed

+218
-291
lines changed

clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -314,11 +314,7 @@ class Environment {
314314

315315
/// Equivalent to `getValue(getStorageLocation(D, SP), SkipPast::None)` if `D`
316316
/// is assigned a storage location in the environment, otherwise returns null.
317-
///
318-
/// The `SP` parameter is deprecated and has no effect. In addition, it is
319-
/// not permitted to pass `SkipPast::ReferenceThenPointer` for this parameter.
320-
/// New uses of this function should use the default argument for `SP`.
321-
Value *getValue(const ValueDecl &D, SkipPast SP = SkipPast::None) const;
317+
Value *getValue(const ValueDecl &D) const;
322318

323319
/// Equivalent to `getValue(getStorageLocation(E, SP), SkipPast::None)` if `E`
324320
/// is assigned a storage location in the environment, otherwise returns null.

clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -680,9 +680,7 @@ Value *Environment::getValue(const StorageLocation &Loc) const {
680680
return It == LocToVal.end() ? nullptr : It->second;
681681
}
682682

683-
Value *Environment::getValue(const ValueDecl &D, SkipPast SP) const {
684-
assert(SP != SkipPast::ReferenceThenPointer);
685-
683+
Value *Environment::getValue(const ValueDecl &D) const {
686684
auto *Loc = getStorageLocation(D);
687685
if (Loc == nullptr)
688686
return nullptr;

clang/unittests/Analysis/FlowSensitive/ChromiumCheckModelTest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ TEST(ChromiumCheckModelTest, CheckSuccessImpliesConditionHolds) {
158158
const ValueDecl *FooDecl = findValueDecl(ASTCtx, "Foo");
159159
ASSERT_THAT(FooDecl, NotNull());
160160

161-
auto *FooVal = cast<BoolValue>(Env.getValue(*FooDecl, SkipPast::None));
161+
auto *FooVal = cast<BoolValue>(Env.getValue(*FooDecl));
162162

163163
EXPECT_TRUE(Env.flowConditionImplies(*FooVal));
164164
};
@@ -189,7 +189,7 @@ TEST(ChromiumCheckModelTest, UnrelatedCheckIgnored) {
189189
const ValueDecl *FooDecl = findValueDecl(ASTCtx, "Foo");
190190
ASSERT_THAT(FooDecl, NotNull());
191191

192-
auto *FooVal = cast<BoolValue>(Env.getValue(*FooDecl, SkipPast::None));
192+
auto *FooVal = cast<BoolValue>(Env.getValue(*FooDecl));
193193

194194
EXPECT_FALSE(Env.flowConditionImplies(*FooVal));
195195
};

clang/unittests/Analysis/FlowSensitive/DataflowEnvironmentTest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ TEST_F(EnvironmentTest, InitGlobalVarsFun) {
124124

125125
// Verify the global variable is populated when we analyze `Target`.
126126
Environment Env(DAContext, *Fun);
127-
EXPECT_THAT(Env.getValue(*Var, SkipPast::None), NotNull());
127+
EXPECT_THAT(Env.getValue(*Var), NotNull());
128128
}
129129

130130
// Tests that fields mentioned only in default member initializers are included
@@ -255,7 +255,7 @@ TEST_F(EnvironmentTest, InitGlobalVarsConstructor) {
255255

256256
// Verify the global variable is populated when we analyze `Target`.
257257
Environment Env(DAContext, *Ctor);
258-
EXPECT_THAT(Env.getValue(*Var, SkipPast::None), NotNull());
258+
EXPECT_THAT(Env.getValue(*Var), NotNull());
259259
}
260260

261261
} // namespace

clang/unittests/Analysis/FlowSensitive/SignAnalysisTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ getValueAndSignProperties(const UnaryOperator *UO,
109109
// The DeclRefExpr refers to this variable in the operand.
110110
const auto *OperandVar = M.Nodes.getNodeAs<clang::VarDecl>(kVar);
111111
assert(OperandVar != nullptr);
112-
const auto *OperandValue = State.Env.getValue(*OperandVar, SkipPast::None);
112+
const auto *OperandValue = State.Env.getValue(*OperandVar);
113113
if (!OperandValue)
114114
return {nullptr, {}, {}};
115115

clang/unittests/Analysis/FlowSensitive/TestingSupport.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ ValueT &getValueForDecl(ASTContext &ASTCtx, const Environment &Env,
400400
llvm::StringRef Name) {
401401
const ValueDecl *VD = findValueDecl(ASTCtx, Name);
402402
assert(VD != nullptr);
403-
return *cast<ValueT>(Env.getValue(*VD, SkipPast::None));
403+
return *cast<ValueT>(Env.getValue(*VD));
404404
}
405405

406406
/// Creates and owns constraints which are boolean values.

0 commit comments

Comments
 (0)