mboehme created this revision. Herald added subscribers: martong, xazax.hun. Herald added a reviewer: NoQ. Herald added a project: All. mboehme requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits.
When introducing this new overload in https://reviews.llvm.org/D151183, I didn't consider that the `ASTContext` parameter was unnecessary because it could also be obtained from the `FunctionDecl`. Repository: rG LLVM Github Monorepo 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.
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.
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits