Author: Eric Li Date: 2022-08-04T13:12:37-04:00 New Revision: 18034aee63eeac673496a88d9e90c8dd73d15927
URL: https://github.com/llvm/llvm-project/commit/18034aee63eeac673496a88d9e90c8dd73d15927 DIFF: https://github.com/llvm/llvm-project/commit/18034aee63eeac673496a88d9e90c8dd73d15927.diff LOG: [clang][dataflow][NFC] Convert mutable vector references to ArrayRef `transferBlock` and `computeBlockInputState` only read the `BlockStates` vector for the predecessor block(s), and do not need to mutate any of the contents. Only `runTypeErasedDataflowAnalysis` writes into the `vector`, so simply down to an `ArrayRef`. Added: Modified: clang/include/clang/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.h clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp Removed: ################################################################################ diff --git a/clang/include/clang/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.h b/clang/include/clang/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.h index c563a2cd076b0..3bd1c8e12e9b2 100644 --- a/clang/include/clang/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.h +++ b/clang/include/clang/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.h @@ -121,7 +121,7 @@ struct TypeErasedDataflowAnalysisState { /// `llvm::None` represent basic blocks that are not evaluated yet. TypeErasedDataflowAnalysisState transferBlock( const ControlFlowContext &CFCtx, - std::vector<llvm::Optional<TypeErasedDataflowAnalysisState>> &BlockStates, + llvm::ArrayRef<llvm::Optional<TypeErasedDataflowAnalysisState>> BlockStates, const CFGBlock &Block, const Environment &InitEnv, TypeErasedDataflowAnalysis &Analysis, std::function<void(const CFGStmt &, diff --git a/clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp b/clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp index f1c25f8159356..32fb48470b144 100644 --- a/clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp +++ b/clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp @@ -164,7 +164,7 @@ class TerminatorVisitor : public ConstStmtVisitor<TerminatorVisitor> { /// `llvm::None` represent basic blocks that are not evaluated yet. static TypeErasedDataflowAnalysisState computeBlockInputState( const ControlFlowContext &CFCtx, - std::vector<llvm::Optional<TypeErasedDataflowAnalysisState>> &BlockStates, + llvm::ArrayRef<llvm::Optional<TypeErasedDataflowAnalysisState>> BlockStates, const CFGBlock &Block, const Environment &InitEnv, TypeErasedDataflowAnalysis &Analysis) { llvm::DenseSet<const CFGBlock *> Preds; @@ -303,7 +303,7 @@ static void transferCFGInitializer(const CFGInitializer &CfgInit, TypeErasedDataflowAnalysisState transferBlock( const ControlFlowContext &CFCtx, - std::vector<llvm::Optional<TypeErasedDataflowAnalysisState>> &BlockStates, + llvm::ArrayRef<llvm::Optional<TypeErasedDataflowAnalysisState>> BlockStates, const CFGBlock &Block, const Environment &InitEnv, TypeErasedDataflowAnalysis &Analysis, std::function<void(const CFGStmt &, _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits