[flang-commits] [flang] 1fbf748 - [flang] Pass unmodified std::vector as const reference (#95050)
via flang-commits
flang-commits at lists.llvm.org
Tue Jun 11 17:15:45 PDT 2024
Author: Peter Klausler
Date: 2024-06-11T17:15:42-07:00
New Revision: 1fbf7486a5c187f0283174bbf92ee25519786ed3
URL: https://github.com/llvm/llvm-project/commit/1fbf7486a5c187f0283174bbf92ee25519786ed3
DIFF: https://github.com/llvm/llvm-project/commit/1fbf7486a5c187f0283174bbf92ee25519786ed3.diff
LOG: [flang] Pass unmodified std::vector as const reference (#95050)
cppcheck recommends that a std::vector argument be passed as a const
reference rather than by value.
Fixes https://github.com/llvm/llvm-project/issues/94929.
Added:
Modified:
flang/lib/Semantics/expression.cpp
Removed:
################################################################################
diff --git a/flang/lib/Semantics/expression.cpp b/flang/lib/Semantics/expression.cpp
index ae7e6d4cc3609..803c655b3174f 100644
--- a/flang/lib/Semantics/expression.cpp
+++ b/flang/lib/Semantics/expression.cpp
@@ -172,7 +172,8 @@ class ArgumentAnalyzer {
void Dump(llvm::raw_ostream &);
private:
- MaybeExpr TryDefinedOp(std::vector<const char *>, parser::MessageFixedText);
+ MaybeExpr TryDefinedOp(
+ const std::vector<const char *> &, parser::MessageFixedText);
MaybeExpr TryBoundOp(const Symbol &, int passIndex);
std::optional<ActualArgument> AnalyzeExpr(const parser::Expr &);
std::optional<ActualArgument> AnalyzeVariable(const parser::Variable &);
@@ -4410,7 +4411,7 @@ MaybeExpr ArgumentAnalyzer::TryDefinedOp(
}
MaybeExpr ArgumentAnalyzer::TryDefinedOp(
- std::vector<const char *> oprs, parser::MessageFixedText error) {
+ const std::vector<const char *> &oprs, parser::MessageFixedText error) {
if (oprs.size() == 1) {
return TryDefinedOp(oprs[0], error);
}
More information about the flang-commits
mailing list