[PATCH] D149144: [clang][dataflow] Eliminate intermediate `ReferenceValue`s from `Environment::DeclToLoc`.
Martin Böhme via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 25 03:28:13 PDT 2023
mboehme added inline comments.
================
Comment at: clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp:43
+namespace {
+
----------------
There were a number of pre-existing declarations that were ODR violation risks. I'm adding a new file-local function below, so instead of making it static, I decided to put everything that's supposed to be file-local in an anonymous namespace.
================
Comment at: clang/unittests/Analysis/FlowSensitive/TransferTest.cpp:505
+ cast<AggregateStorageLocation>(FooRefVal->getReferentLoc());
+ EXPECT_THAT(Env.getValue(FooReferentLoc), NotNull());
+ EXPECT_THAT(Env.getValue(FooReferentLoc.getChild(*BarDecl)), IsNull());
----------------
We're creating a slightly deeper object hierarchy here because we now call `createValue()` with the non-reference type in a number of places. I believe this slightly deeper hierarchy shouldn't be a problem in practice.
================
Comment at: clang/unittests/Analysis/FlowSensitive/TransferTest.cpp:2662
+
+ ASSERT_THAT(EnvAfterLoop.getValue(*BarDecl), IsNull());
});
----------------
The changes in this test are a result of the fact that we now remove declarations from `Environment::DeclToLoc` when they go out of scope.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D149144/new/
https://reviews.llvm.org/D149144
More information about the cfe-commits
mailing list