[lld] r340970 - [WebAssembly] clang-format (NFC)

Heejin Ahn via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 29 14:03:16 PDT 2018


Author: aheejin
Date: Wed Aug 29 14:03:16 2018
New Revision: 340970

URL: http://llvm.org/viewvc/llvm-project?rev=340970&view=rev
Log:
[WebAssembly] clang-format (NFC)

Summary: This patch runs clang-format on all wasm-only files.

Reviewers: sbc100

Subscribers: dschuff, jgravelle-google, sunfish, llvm-commits

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

Modified:
    lld/trunk/wasm/Driver.cpp
    lld/trunk/wasm/InputChunks.cpp
    lld/trunk/wasm/InputFiles.cpp
    lld/trunk/wasm/OutputSections.h
    lld/trunk/wasm/Writer.cpp

Modified: lld/trunk/wasm/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/wasm/Driver.cpp?rev=340970&r1=340969&r2=340970&view=diff
==============================================================================
--- lld/trunk/wasm/Driver.cpp (original)
+++ lld/trunk/wasm/Driver.cpp Wed Aug 29 14:03:16 2018
@@ -186,8 +186,7 @@ static void readImportFile(StringRef Fil
 
 // Returns slices of MB by parsing MB as an archive file.
 // Each slice consists of a member file in the archive.
-std::vector<MemoryBufferRef> static getArchiveMembers(
-    MemoryBufferRef MB) {
+std::vector<MemoryBufferRef> static getArchiveMembers(MemoryBufferRef MB) {
   std::unique_ptr<Archive> File =
       CHECK(Archive::create(MB),
             MB.getBufferIdentifier() + ": failed to parse archive");
@@ -205,8 +204,8 @@ std::vector<MemoryBufferRef> static getA
     V.push_back(MBRef);
   }
   if (Err)
-    fatal(MB.getBufferIdentifier() + ": Archive::children failed: " +
-          toString(std::move(Err)));
+    fatal(MB.getBufferIdentifier() +
+          ": Archive::children failed: " + toString(std::move(Err)));
 
   // Take ownership of memory buffers created for members of thin archives.
   for (std::unique_ptr<MemoryBuffer> &MB : File->takeThinBuffers())

Modified: lld/trunk/wasm/InputChunks.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/wasm/InputChunks.cpp?rev=340970&r1=340969&r2=340970&view=diff
==============================================================================
--- lld/trunk/wasm/InputChunks.cpp (original)
+++ lld/trunk/wasm/InputChunks.cpp Wed Aug 29 14:03:16 2018
@@ -25,7 +25,9 @@ using namespace lld::wasm;
 
 static StringRef ReloctTypeToString(uint8_t RelocType) {
   switch (RelocType) {
-#define WASM_RELOC(NAME, REL) case REL: return #NAME;
+#define WASM_RELOC(NAME, REL)                                                  \
+  case REL:                                                                    \
+    return #NAME;
 #include "llvm/BinaryFormat/WasmRelocs.def"
 #undef WASM_RELOC
   }
@@ -257,7 +259,8 @@ void InputFunction::writeTo(uint8_t *Buf
     return InputChunk::writeTo(Buf);
 
   Buf += OutputOffset;
-  uint8_t *Orig = Buf; (void)Orig;
+  uint8_t *Orig = Buf;
+  (void)Orig;
 
   const uint8_t *SecStart = File->CodeSection->Content.data();
   const uint8_t *FuncStart = SecStart + getInputSectionOffset();

Modified: lld/trunk/wasm/InputFiles.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/wasm/InputFiles.cpp?rev=340970&r1=340969&r2=340970&view=diff
==============================================================================
--- lld/trunk/wasm/InputFiles.cpp (original)
+++ lld/trunk/wasm/InputFiles.cpp Wed Aug 29 14:03:16 2018
@@ -94,16 +94,17 @@ uint32_t ObjFile::calcExpectedValue(cons
   switch (Reloc.Type) {
   case R_WEBASSEMBLY_TABLE_INDEX_I32:
   case R_WEBASSEMBLY_TABLE_INDEX_SLEB: {
-    const WasmSymbol& Sym = WasmObj->syms()[Reloc.Index];
+    const WasmSymbol &Sym = WasmObj->syms()[Reloc.Index];
     return TableEntries[Sym.Info.ElementIndex];
   }
   case R_WEBASSEMBLY_MEMORY_ADDR_SLEB:
   case R_WEBASSEMBLY_MEMORY_ADDR_I32:
   case R_WEBASSEMBLY_MEMORY_ADDR_LEB: {
-    const WasmSymbol& Sym = WasmObj->syms()[Reloc.Index];
+    const WasmSymbol &Sym = WasmObj->syms()[Reloc.Index];
     if (Sym.isUndefined())
       return 0;
-    const WasmSegment& Segment = WasmObj->dataSegments()[Sym.Info.DataRef.Segment];
+    const WasmSegment &Segment =
+        WasmObj->dataSegments()[Sym.Info.DataRef.Segment];
     return Segment.Data.Offset.Value.Int32 + Sym.Info.DataRef.Offset +
            Reloc.Addend;
   }
@@ -119,7 +120,7 @@ uint32_t ObjFile::calcExpectedValue(cons
     return Reloc.Index;
   case R_WEBASSEMBLY_FUNCTION_INDEX_LEB:
   case R_WEBASSEMBLY_GLOBAL_INDEX_LEB: {
-    const WasmSymbol& Sym = WasmObj->syms()[Reloc.Index];
+    const WasmSymbol &Sym = WasmObj->syms()[Reloc.Index];
     return Sym.Info.ElementIndex;
   }
   default:
@@ -166,14 +167,12 @@ static void setRelocs(const std::vector<
     return;
 
   ArrayRef<WasmRelocation> Relocs = Section->Relocations;
+  assert(std::is_sorted(Relocs.begin(), Relocs.end(),
+                        [](const WasmRelocation &R1, const WasmRelocation &R2) {
+                          return R1.Offset < R2.Offset;
+                        }));
   assert(std::is_sorted(
-      Relocs.begin(), Relocs.end(),
-      [](const WasmRelocation &R1, const WasmRelocation &R2) {
-        return R1.Offset < R2.Offset;
-      }));
-  assert(std::is_sorted(
-      Chunks.begin(), Chunks.end(),
-      [](InputChunk *C1, InputChunk *C2) {
+      Chunks.begin(), Chunks.end(), [](InputChunk *C1, InputChunk *C2) {
         return C1->getInputSectionOffset() < C2->getInputSectionOffset();
       }));
 
@@ -185,9 +184,9 @@ static void setRelocs(const std::vector<
   for (InputChunk *C : Chunks) {
     auto RelocsStart = std::lower_bound(RelocsNext, RelocsEnd,
                                         C->getInputSectionOffset(), RelocLess);
-    RelocsNext = std::lower_bound(RelocsStart, RelocsEnd,
-                                  C->getInputSectionOffset() + C->getInputSize(),
-                                  RelocLess);
+    RelocsNext = std::lower_bound(
+        RelocsStart, RelocsEnd, C->getInputSectionOffset() + C->getInputSize(),
+        RelocLess);
     C->setRelocations(ArrayRef<WasmRelocation>(RelocsStart, RelocsNext));
   }
 }
@@ -259,7 +258,8 @@ void ObjFile::parse() {
   Functions.reserve(Funcs.size());
 
   for (size_t I = 0, E = Funcs.size(); I != E; ++I)
-    Functions.emplace_back(make<InputFunction>(Types[FuncTypes[I]], &Funcs[I], this));
+    Functions.emplace_back(
+        make<InputFunction>(Types[FuncTypes[I]], &Funcs[I], this));
   setRelocs(Functions, CodeSection);
 
   // Populate `Globals`.

Modified: lld/trunk/wasm/OutputSections.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/wasm/OutputSections.h?rev=340970&r1=340969&r2=340970&view=diff
==============================================================================
--- lld/trunk/wasm/OutputSections.h (original)
+++ lld/trunk/wasm/OutputSections.h Wed Aug 29 14:03:16 2018
@@ -113,7 +113,7 @@ protected:
   size_t BodySize = 0;
 };
 
-// Represents a custom section in the output file.  Wasm custom sections are 
+// Represents a custom section in the output file.  Wasm custom sections are
 // used for storing user-defined metadata.  Unlike the core sections types
 // they are identified by their string name.
 // The linker combines custom sections that have the same name by simply

Modified: lld/trunk/wasm/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/wasm/Writer.cpp?rev=340970&r1=340969&r2=340970&view=diff
==============================================================================
--- lld/trunk/wasm/Writer.cpp (original)
+++ lld/trunk/wasm/Writer.cpp Wed Aug 29 14:03:16 2018
@@ -586,9 +586,9 @@ void Writer::writeSections() {
 //  - heap start / unallocated
 //
 // The --stack-first option means that stack is placed before any static data.
-// This can be useful since it means that stack overflow traps immediately rather
-// than overwriting global data, but also increases code size since all static
-// data loads and stores requires larger offsets.
+// This can be useful since it means that stack overflow traps immediately
+// rather than overwriting global data, but also increases code size since all
+// static data loads and stores requires larger offsets.
 void Writer::layoutMemory() {
   createOutputSegments();
 




More information about the llvm-commits mailing list