[clang] a026204 - Revert "[clang][dataflow] Add a test to justify skipping past references in UO_Deref"
Stanislav Gatev via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 18 22:47:09 PST 2022
Author: Stanislav Gatev
Date: 2022-01-19T06:46:37Z
New Revision: a0262043bb87fdef68c817722de320a5dd9eb9c9
URL: https://github.com/llvm/llvm-project/commit/a0262043bb87fdef68c817722de320a5dd9eb9c9
DIFF: https://github.com/llvm/llvm-project/commit/a0262043bb87fdef68c817722de320a5dd9eb9c9.diff
LOG: Revert "[clang][dataflow] Add a test to justify skipping past references in UO_Deref"
This reverts commit 68226e572f41105446413b12ee95ab5540b2b6ac.
Added:
Modified:
clang/lib/Analysis/FlowSensitive/Transfer.cpp
clang/unittests/Analysis/FlowSensitive/TransferTest.cpp
Removed:
################################################################################
diff --git a/clang/lib/Analysis/FlowSensitive/Transfer.cpp b/clang/lib/Analysis/FlowSensitive/Transfer.cpp
index 865191916e502..0979f55c5a5c8 100644
--- a/clang/lib/Analysis/FlowSensitive/Transfer.cpp
+++ b/clang/lib/Analysis/FlowSensitive/Transfer.cpp
@@ -182,7 +182,6 @@ class TransferVisitor : public ConstStmtVisitor<TransferVisitor> {
switch (S->getOpcode()) {
case UO_Deref: {
- // Skip past a reference to handle dereference of a dependent pointer.
const auto *SubExprVal = cast_or_null<PointerValue>(
Env.getValue(*SubExpr, SkipPast::Reference));
if (SubExprVal == nullptr)
diff --git a/clang/unittests/Analysis/FlowSensitive/TransferTest.cpp b/clang/unittests/Analysis/FlowSensitive/TransferTest.cpp
index d1d8705d26c0a..ea035ba013daf 100644
--- a/clang/unittests/Analysis/FlowSensitive/TransferTest.cpp
+++ b/clang/unittests/Analysis/FlowSensitive/TransferTest.cpp
@@ -1758,34 +1758,4 @@ TEST_F(TransferTest, AddrOfReference) {
});
}
-TEST_F(TransferTest, DerefDependentPtr) {
- std::string Code = R"(
- template <typename T>
- void target(T *Foo) {
- T &Bar = *Foo;
- /*[[p]]*/
- }
- )";
- runDataflow(
- Code, [](llvm::ArrayRef<
- std::pair<std::string, DataflowAnalysisState<NoopLattice>>>
- Results,
- ASTContext &ASTCtx) {
- ASSERT_THAT(Results, ElementsAre(Pair("p", _)));
- const Environment &Env = Results[0].second.Env;
-
- const ValueDecl *FooDecl = findValueDecl(ASTCtx, "Foo");
- ASSERT_THAT(FooDecl, NotNull());
-
- const ValueDecl *BarDecl = findValueDecl(ASTCtx, "Bar");
- ASSERT_THAT(BarDecl, NotNull());
-
- const auto *FooVal =
- cast<PointerValue>(Env.getValue(*FooDecl, SkipPast::None));
- const auto *BarVal =
- cast<ReferenceValue>(Env.getValue(*BarDecl, SkipPast::None));
- EXPECT_EQ(&BarVal->getPointeeLoc(), &FooVal->getPointeeLoc());
- });
-}
-
} // namespace
More information about the cfe-commits
mailing list