[PATCH] D126553: [WebAssembly] Consolidate sectionTypeToString in BinaryFormat [NFC]

Derek Schuff via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 27 09:08:59 PDT 2022


dschuff updated this revision to Diff 432581.
dschuff added a comment.

also update reloc and symbol type functions


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126553/new/

https://reviews.llvm.org/D126553

Files:
  llvm/include/llvm/BinaryFormat/Wasm.h
  llvm/lib/BinaryFormat/Wasm.cpp


Index: llvm/lib/BinaryFormat/Wasm.cpp
===================================================================
--- llvm/lib/BinaryFormat/Wasm.cpp
+++ llvm/lib/BinaryFormat/Wasm.cpp
@@ -8,7 +8,7 @@
 
 #include "llvm/BinaryFormat/Wasm.h"
 
-std::string llvm::wasm::toString(wasm::WasmSymbolType Type) {
+llvm::StringRef llvm::wasm::toString(wasm::WasmSymbolType Type) {
   switch (Type) {
   case wasm::WASM_SYMBOL_TYPE_FUNCTION:
     return "WASM_SYMBOL_TYPE_FUNCTION";
@@ -26,7 +26,7 @@
   llvm_unreachable("unknown symbol type");
 }
 
-std::string llvm::wasm::relocTypetoString(uint32_t Type) {
+llvm::StringRef llvm::wasm::relocTypetoString(uint32_t Type) {
   switch (Type) {
 #define WASM_RELOC(NAME, VALUE)                                                \
   case VALUE:                                                                  \
Index: llvm/include/llvm/BinaryFormat/Wasm.h
===================================================================
--- llvm/include/llvm/BinaryFormat/Wasm.h
+++ llvm/include/llvm/BinaryFormat/Wasm.h
@@ -470,8 +470,8 @@
   return LHS.ElemType == RHS.ElemType && LHS.Limits == RHS.Limits;
 }
 
-std::string toString(WasmSymbolType type);
-std::string relocTypetoString(uint32_t type);
+llvm::StringRef toString(WasmSymbolType type);
+llvm::StringRef relocTypetoString(uint32_t type);
 llvm::StringRef sectionTypeToString(uint32_t type);
 bool relocTypeHasAddend(uint32_t type);
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126553.432581.patch
Type: text/x-patch
Size: 1414 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220527/5cfc05d2/attachment.bin>


More information about the llvm-commits mailing list