[clang] bbe1b06 - [NFC][CLANG] Fix static analyzer bugs about unnecessary object copies with auto keyword (#75082)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Dec 22 18:39:26 PST 2023
Author: smanna12
Date: 2023-12-22T20:39:22-06:00
New Revision: bbe1b06fbb7127d613cb4958e06c737967878388
URL: https://github.com/llvm/llvm-project/commit/bbe1b06fbb7127d613cb4958e06c737967878388
DIFF: https://github.com/llvm/llvm-project/commit/bbe1b06fbb7127d613cb4958e06c737967878388.diff
LOG: [NFC][CLANG] Fix static analyzer bugs about unnecessary object copies with auto keyword (#75082)
Reported by Static Analyzer Tool:
In ​EmitAssemblyHelper::​RunOptimizationPipeline(): Using the auto
keyword without an & causes the copy of an object of type function.
/// List of pass builder callbacks ("CodeGenOptions.h").
std::vector<std::function<void(llvm::PassBuilder &)>>
PassBuilderCallbacks;
Added:
Modified:
clang/lib/CodeGen/BackendUtil.cpp
Removed:
################################################################################
diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp
index 480410db1021b7..a6142d99f3b688 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -881,7 +881,7 @@ void EmitAssemblyHelper::RunOptimizationPipeline(
<< PluginFN << toString(PassPlugin.takeError());
}
}
- for (auto PassCallback : CodeGenOpts.PassBuilderCallbacks)
+ for (const auto &PassCallback : CodeGenOpts.PassBuilderCallbacks)
PassCallback(PB);
#define HANDLE_EXTENSION(Ext) \
get##Ext##PluginInfo().RegisterPassBuilderCallbacks(PB);
More information about the cfe-commits
mailing list