[lld] r326269 - [WebAssembly] Use StringRef instead of `const char *`.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 27 16:01:31 PST 2018


Author: ruiu
Date: Tue Feb 27 16:01:31 2018
New Revision: 326269

URL: http://llvm.org/viewvc/llvm-project?rev=326269&view=rev
Log:
[WebAssembly] Use StringRef instead of `const char *`.

Differential Revision: https://reviews.llvm.org/D43721

Modified:
    lld/trunk/wasm/Writer.cpp

Modified: lld/trunk/wasm/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/wasm/Writer.cpp?rev=326269&r1=326268&r2=326269&view=diff
==============================================================================
--- lld/trunk/wasm/Writer.cpp (original)
+++ lld/trunk/wasm/Writer.cpp Tue Feb 27 16:01:31 2018
@@ -357,24 +357,24 @@ void Writer::createRelocSections() {
   // 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);
   }
 }
 




More information about the llvm-commits mailing list