[PATCH] D151549: [clang][dataflow] Remove unnecessary `ASTContext` parameter from `ControlFlowContext::build` overload.
Martin Böhme via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue May 30 00:06:02 PDT 2023
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG5ddb623952ca: [clang][dataflow] Remove unnecessary `ASTContext` parameter from… (authored by mboehme).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D151549/new/
https://reviews.llvm.org/D151549
Files:
clang/include/clang/Analysis/FlowSensitive/ControlFlowContext.h
clang/lib/Analysis/FlowSensitive/ControlFlowContext.cpp
clang/lib/Analysis/FlowSensitive/DataflowAnalysisContext.cpp
clang/unittests/Analysis/FlowSensitive/TestingSupport.h
clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp
Index: clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp
===================================================================
--- clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp
+++ clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp
@@ -65,7 +65,7 @@
assert(Func != nullptr);
auto CFCtx =
- llvm::cantFail(ControlFlowContext::build(*Func, AST->getASTContext()));
+ llvm::cantFail(ControlFlowContext::build(*Func));
AnalysisT Analysis = MakeAnalysis(AST->getASTContext());
DataflowAnalysisContext DACtx(std::make_unique<WatchedLiteralsSolver>());
Index: clang/unittests/Analysis/FlowSensitive/TestingSupport.h
===================================================================
--- clang/unittests/Analysis/FlowSensitive/TestingSupport.h
+++ clang/unittests/Analysis/FlowSensitive/TestingSupport.h
@@ -241,7 +241,7 @@
llvm::errc::invalid_argument, "Could not find the target function.");
// Build the control flow graph for the target function.
- auto MaybeCFCtx = ControlFlowContext::build(*Target, Context);
+ auto MaybeCFCtx = ControlFlowContext::build(*Target);
if (!MaybeCFCtx) return MaybeCFCtx.takeError();
auto &CFCtx = *MaybeCFCtx;
Index: clang/lib/Analysis/FlowSensitive/DataflowAnalysisContext.cpp
===================================================================
--- clang/lib/Analysis/FlowSensitive/DataflowAnalysisContext.cpp
+++ clang/lib/Analysis/FlowSensitive/DataflowAnalysisContext.cpp
@@ -211,7 +211,7 @@
return &It->second;
if (F->hasBody()) {
- auto CFCtx = ControlFlowContext::build(*F, F->getASTContext());
+ auto CFCtx = ControlFlowContext::build(*F);
// FIXME: Handle errors.
assert(CFCtx);
auto Result = FunctionContexts.insert({F, std::move(*CFCtx)});
Index: clang/lib/Analysis/FlowSensitive/ControlFlowContext.cpp
===================================================================
--- clang/lib/Analysis/FlowSensitive/ControlFlowContext.cpp
+++ clang/lib/Analysis/FlowSensitive/ControlFlowContext.cpp
@@ -68,13 +68,13 @@
}
llvm::Expected<ControlFlowContext>
-ControlFlowContext::build(const FunctionDecl &Func, ASTContext &C) {
+ControlFlowContext::build(const FunctionDecl &Func) {
if (!Func.hasBody())
return llvm::createStringError(
std::make_error_code(std::errc::invalid_argument),
"Cannot analyze function without a body");
- return build(Func, *Func.getBody(), C);
+ return build(Func, *Func.getBody(), Func.getASTContext());
}
llvm::Expected<ControlFlowContext>
Index: clang/include/clang/Analysis/FlowSensitive/ControlFlowContext.h
===================================================================
--- clang/include/clang/Analysis/FlowSensitive/ControlFlowContext.h
+++ clang/include/clang/Analysis/FlowSensitive/ControlFlowContext.h
@@ -33,8 +33,7 @@
public:
/// Builds a ControlFlowContext from a `FunctionDecl`.
/// `Func.hasBody()` must be true, and `Func.isTemplated()` must be false.
- static llvm::Expected<ControlFlowContext> build(const FunctionDecl &Func,
- ASTContext &C);
+ static llvm::Expected<ControlFlowContext> build(const FunctionDecl &Func);
/// Builds a ControlFlowContext from an AST node. `D` is the function in which
/// `S` resides. `D.isTemplated()` must be false.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151549.526532.patch
Type: text/x-patch
Size: 3401 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230530/a2628349/attachment-0001.bin>
More information about the cfe-commits
mailing list