From 18034aee63eeac673496a88d9e90c8dd73d15927 Mon Sep 17 00:00:00 2001
From: Eric Li
Date: Thu, 4 Aug 2022 11:56:10 -0400
Subject: [PATCH] [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`.
---
.../include/clang/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.h | 2 +-
clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/clang/include/clang/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.h b/clang/include/clang/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.h
index c563a2c..3bd1c8e 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> &BlockStates,
+ llvm::ArrayRef> BlockStates,
const CFGBlock &Block, const Environment &InitEnv,
TypeErasedDataflowAnalysis &Analysis,
std::function> &BlockStates,
+ llvm::ArrayRef> BlockStates,
const CFGBlock &Block, const Environment &InitEnv,
TypeErasedDataflowAnalysis &Analysis) {
llvm::DenseSet Preds;
@@ -303,7 +303,7 @@ static void transferCFGInitializer(const CFGInitializer &CfgInit,
TypeErasedDataflowAnalysisState transferBlock(
const ControlFlowContext &CFCtx,
- std::vector> &BlockStates,
+ llvm::ArrayRef> BlockStates,
const CFGBlock &Block, const Environment &InitEnv,
TypeErasedDataflowAnalysis &Analysis,
std::function