[COFF] Remove finalizeContents virtual method from Chunk, NFC
This only needs to be done for MergeChunks, so just do that in a
separate pass in the Writer.
This is one small step towards eliminating the vtable in Chunk.
llvm-svn: 361573
diff --git a/lld/COFF/Chunks.cpp b/lld/COFF/Chunks.cpp
index 76b0c83..b016ac1 100644
--- a/lld/COFF/Chunks.cpp
+++ b/lld/COFF/Chunks.cpp
@@ -873,14 +873,15 @@
}
void MergeChunk::finalizeContents() {
- if (!Finalized) {
- for (SectionChunk *C : Sections)
- if (C->Live)
- Builder.add(toStringRef(C->getContents()));
- Builder.finalize();
- Finalized = true;
- }
+ assert(!Finalized && "should only finalize once");
+ for (SectionChunk *C : Sections)
+ if (C->Live)
+ Builder.add(toStringRef(C->getContents()));
+ Builder.finalize();
+ Finalized = true;
+}
+void MergeChunk::assignSubsectionRVAs() {
for (SectionChunk *C : Sections) {
if (!C->Live)
continue;