[PATCH] D43721: [WebAssembly] Use StringRef instead of `const char *`.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 27 16:04:25 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL326269: [WebAssembly] Use StringRef instead of `const char *`. (authored by ruiu, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D43721?vs=135778&id=136171#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D43721

Files:
  lld/trunk/wasm/Writer.cpp


Index: lld/trunk/wasm/Writer.cpp
===================================================================
--- lld/trunk/wasm/Writer.cpp
+++ lld/trunk/wasm/Writer.cpp
@@ -357,24 +357,24 @@
   // Don't use iterator here since we are adding to OutputSection
   size_t OrigSize = OutputSections.size();
   for (size_t i = 0; i < OrigSize; i++) {
-    OutputSection *S = OutputSections[i];
-    const char *name;
-    uint32_t Count = S->numRelocations();
+    OutputSection *OSec = OutputSections[i];
+    uint32_t Count = OSec->numRelocations();
     if (!Count)
       continue;
 
-    if (S->Type == WASM_SEC_DATA)
-      name = "reloc.DATA";
-    else if (S->Type == WASM_SEC_CODE)
-      name = "reloc.CODE";
+    StringRef Name;
+    if (OSec->Type == WASM_SEC_DATA)
+      Name = "reloc.DATA";
+    else if (OSec->Type == WASM_SEC_CODE)
+      Name = "reloc.CODE";
     else
       llvm_unreachable("relocations only supported for code and data");
 
-    SyntheticSection *Section = createSyntheticSection(WASM_SEC_CUSTOM, name);
+    SyntheticSection *Section = createSyntheticSection(WASM_SEC_CUSTOM, Name);
     raw_ostream &OS = Section->getStream();
-    writeUleb128(OS, S->Type, "reloc section");
+    writeUleb128(OS, OSec->Type, "reloc section");
     writeUleb128(OS, Count, "reloc count");
-    S->writeRelocations(OS);
+    OSec->writeRelocations(OS);
   }
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43721.136171.patch
Type: text/x-patch
Size: 1372 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180228/ddfd4963/attachment.bin>


More information about the llvm-commits mailing list