[llvm] [WebAssembly] Clean up CustomMappingTraits<BBNumberMap> (NFC) (PR #167155)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Nov 8 08:34:13 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-webassembly
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
This patch does two things for readability:
- Use structured bindings.
- Remove extraneous .c_str().
Note that YamlIO.mapRequired takes StringRef as the key type. As
such, we can implicitly construct StringRef from std::string.
---
Full diff: https://github.com/llvm/llvm-project/pull/167155.diff
1 Files Affected:
- (modified) llvm/lib/Target/WebAssembly/WebAssemblyMachineFunctionInfo.h (+2-2)
``````````diff
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyMachineFunctionInfo.h b/llvm/lib/Target/WebAssembly/WebAssemblyMachineFunctionInfo.h
index ee575e3527673..0e913fb1ee669 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyMachineFunctionInfo.h
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyMachineFunctionInfo.h
@@ -211,8 +211,8 @@ template <> struct CustomMappingTraits<BBNumberMap> {
}
static void output(IO &YamlIO, BBNumberMap &SrcToUnwindDest) {
- for (auto KV : SrcToUnwindDest)
- YamlIO.mapRequired(std::to_string(KV.first).c_str(), KV.second);
+ for (auto [Src, Dest] : SrcToUnwindDest)
+ YamlIO.mapRequired(std::to_string(Src), Dest);
}
};
``````````
</details>
https://github.com/llvm/llvm-project/pull/167155
More information about the llvm-commits
mailing list