[lld] r323623 - [WebAssembly] Add getName and getFileName methods to InputChunk base class. NFC.

Sam Clegg via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 28 11:57:03 PST 2018


Author: sbc
Date: Sun Jan 28 11:57:03 2018
New Revision: 323623

URL: http://llvm.org/viewvc/llvm-project?rev=323623&view=rev
Log:
[WebAssembly] Add getName and getFileName methods to InputChunk base class. NFC.

Summary: These are useful to upcoming addition of --gc-sections support.

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

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

Modified:
    lld/trunk/wasm/InputChunks.cpp
    lld/trunk/wasm/InputChunks.h

Modified: lld/trunk/wasm/InputChunks.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/wasm/InputChunks.cpp?rev=323623&r1=323622&r2=323623&view=diff
==============================================================================
--- lld/trunk/wasm/InputChunks.cpp (original)
+++ lld/trunk/wasm/InputChunks.cpp Sun Jan 28 11:57:03 2018
@@ -113,13 +113,13 @@ void InputChunk::calcRelocations() {
 }
 
 void InputFunction::setOutputIndex(uint32_t Index) {
-  DEBUG(dbgs() << "InputFunction::setOutputIndex: " << Index << "\n");
+  DEBUG(dbgs() << "InputFunction::setOutputIndex: " << getName() << " -> " << Index << "\n");
   assert(!hasOutputIndex());
   OutputIndex = Index;
 }
 
 void InputFunction::setTableIndex(uint32_t Index) {
-  DEBUG(dbgs() << "InputFunction::setTableIndex " << Index << "\n");
+  DEBUG(dbgs() << "InputFunction::setTableIndex: " << getName() << " -> " << Index << "\n");
   assert(!hasTableIndex());
   TableIndex = Index;
 }

Modified: lld/trunk/wasm/InputChunks.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/wasm/InputChunks.h?rev=323623&r1=323622&r2=323623&view=diff
==============================================================================
--- lld/trunk/wasm/InputChunks.h (original)
+++ lld/trunk/wasm/InputChunks.h Sun Jan 28 11:57:03 2018
@@ -51,8 +51,10 @@ public:
 
   uint32_t getOutputOffset() const { return OutputOffset; }
   ArrayRef<WasmRelocation> getRelocations() const { return Relocations; }
+  StringRef getFileName() const { return File->getName(); }
 
   virtual StringRef getComdat() const = 0;
+  virtual StringRef getName() const = 0;
 
   bool Discarded = false;
   std::vector<OutputRelocation> OutRelocations;
@@ -99,7 +101,7 @@ public:
   uint32_t getAlignment() const { return Segment.Data.Alignment; }
   uint32_t startVA() const { return Segment.Data.Offset.Value.Int32; }
   uint32_t endVA() const { return startVA() + getSize(); }
-  StringRef getName() const { return Segment.Data.Name; }
+  StringRef getName() const override { return Segment.Data.Name; }
   StringRef getComdat() const override { return Segment.Data.Comdat; }
 
   int32_t OutputSegmentOffset = 0;
@@ -126,7 +128,7 @@ public:
     return C->kind() == InputChunk::Function;
   }
 
-  virtual StringRef getName() const { return Function->Name; }
+  StringRef getName() const override { return Function->Name; }
   StringRef getComdat() const override { return Function->Comdat; }
   uint32_t getOutputIndex() const { return OutputIndex.getValue(); }
   bool hasOutputIndex() const { return OutputIndex.hasValue(); }




More information about the llvm-commits mailing list