[PATCH] D149640: [clang][dataflow] Change PruneTriviallyFalseEdges for building CFG
Kinuko Yasuda via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue May 2 06:30:53 PDT 2023
kinu updated this revision to Diff 518702.
kinu added a comment.
Changing the existing test to reflect the flag change
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D149640/new/
https://reviews.llvm.org/D149640
Files:
clang/lib/Analysis/FlowSensitive/ControlFlowContext.cpp
clang/unittests/Analysis/FlowSensitive/TransferTest.cpp
Index: clang/unittests/Analysis/FlowSensitive/TransferTest.cpp
===================================================================
--- clang/unittests/Analysis/FlowSensitive/TransferTest.cpp
+++ clang/unittests/Analysis/FlowSensitive/TransferTest.cpp
@@ -2652,25 +2652,8 @@
Code,
[](const llvm::StringMap<DataflowAnalysisState<NoopLattice>> &Results,
ASTContext &ASTCtx) {
- ASSERT_THAT(Results.keys(), UnorderedElementsAre("p"));
- const Environment &Env = getEnvironmentAtAnnotation(Results, "p");
-
- 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 *FooPointeeVal =
- cast<IntegerValue>(Env.getValue(FooVal->getPointeeLoc()));
-
- const auto *BarVal = dyn_cast_or_null<IntegerValue>(
- Env.getValue(*BarDecl, SkipPast::None));
- ASSERT_THAT(BarVal, NotNull());
-
- EXPECT_EQ(BarVal, FooPointeeVal);
+ // PruneTriviallyFalseEdges prunes the unreachable node.
+ ASSERT_TRUE(Results.empty());
});
}
Index: clang/lib/Analysis/FlowSensitive/ControlFlowContext.cpp
===================================================================
--- clang/lib/Analysis/FlowSensitive/ControlFlowContext.cpp
+++ clang/lib/Analysis/FlowSensitive/ControlFlowContext.cpp
@@ -70,7 +70,7 @@
llvm::Expected<ControlFlowContext>
ControlFlowContext::build(const Decl *D, Stmt &S, ASTContext &C) {
CFG::BuildOptions Options;
- Options.PruneTriviallyFalseEdges = false;
+ Options.PruneTriviallyFalseEdges = true;
Options.AddImplicitDtors = true;
Options.AddTemporaryDtors = true;
Options.AddInitializers = true;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149640.518702.patch
Type: text/x-patch
Size: 1897 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230502/bbfac530/attachment-0001.bin>
More information about the cfe-commits
mailing list