[llvm] Add StringMap::lookup() overload to take a default value and return a reference to the value to avoid a copy (PR #115469)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 8 04:20:34 PST 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 31af00fda73df8e85e30c71f66e096d486ec8c8b 468007d5bdcaf4308697dce682a4454c970272d9 --extensions h,cpp -- llvm/include/llvm/ADT/StringMap.h llvm/lib/CodeGen/MachineOutliner.cpp llvm/tools/llvm-rc/ResourceScriptStmt.cpp llvm/unittests/ADT/StringMapTest.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/include/llvm/ADT/StringMap.h b/llvm/include/llvm/ADT/StringMap.h
index be57cce851..0c3e30fa00 100644
--- a/llvm/include/llvm/ADT/StringMap.h
+++ b/llvm/include/llvm/ADT/StringMap.h
@@ -259,7 +259,7 @@ public:
/// lookup - Return the entry for the specified key, or a default
/// provided value if no such entry exists.
- const ValueTy &lookup(StringRef Key, const ValueTy& Value) const {
+ const ValueTy &lookup(StringRef Key, const ValueTy &Value) const {
const_iterator Iter = find(Key);
if (Iter != end())
return Iter->second;
``````````
</details>
https://github.com/llvm/llvm-project/pull/115469
More information about the llvm-commits
mailing list