[llvm] 6b42c91 - [WebAssembly] Clean up CustomMappingTraits<BBNumberMap> (NFC) (#167155)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Nov 8 10:16:43 PST 2025
Author: Kazu Hirata
Date: 2025-11-08T10:16:39-08:00
New Revision: 6b42c913fa803bf4b8054d528f823c4102d6e3a8
URL: https://github.com/llvm/llvm-project/commit/6b42c913fa803bf4b8054d528f823c4102d6e3a8
DIFF: https://github.com/llvm/llvm-project/commit/6b42c913fa803bf4b8054d528f823c4102d6e3a8.diff
LOG: [WebAssembly] Clean up CustomMappingTraits<BBNumberMap> (NFC) (#167155)
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.
Added:
Modified:
llvm/lib/Target/WebAssembly/WebAssemblyMachineFunctionInfo.h
Removed:
################################################################################
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);
}
};
More information about the llvm-commits
mailing list