Skip to content

Commit bbe1b06

Browse files
authored
[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;
1 parent 61b5cc6 commit bbe1b06

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

clang/lib/CodeGen/BackendUtil.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -881,7 +881,7 @@ void EmitAssemblyHelper::RunOptimizationPipeline(
881881
<< PluginFN << toString(PassPlugin.takeError());
882882
}
883883
}
884-
for (auto PassCallback : CodeGenOpts.PassBuilderCallbacks)
884+
for (const auto &PassCallback : CodeGenOpts.PassBuilderCallbacks)
885885
PassCallback(PB);
886886
#define HANDLE_EXTENSION(Ext) \
887887
get##Ext##PluginInfo().RegisterPassBuilderCallbacks(PB);

0 commit comments

Comments
 (0)