COFF: hoist a local variable
authorSaleem Abdulrasool <compnerd@compnerd.org>
Sun, 21 Aug 2016 23:05:43 +0000 (23:05 +0000)
committerSaleem Abdulrasool <compnerd@compnerd.org>
Sun, 21 Aug 2016 23:05:43 +0000 (23:05 +0000)
Create a local variable for the rdata section.  NFC.

llvm-svn: 279407

lld/COFF/Writer.cpp

index ea0dcb4..1a1018e 100644 (file)
@@ -286,25 +286,29 @@ void Writer::createSections() {
 }
 
 void Writer::createMiscChunks() {
+  OutputSection *RData = createSection(".rdata");
+
   // Create thunks for locally-dllimported symbols.
   if (!Symtab->LocalImportChunks.empty()) {
-    OutputSection *Sec = createSection(".rdata");
     for (Chunk *C : Symtab->LocalImportChunks)
-      Sec->addChunk(C);
+      RData->addChunk(C);
   }
 
   // Create SEH table. x86-only.
   if (Config->Machine != I386)
     return;
+
   std::set<Defined *> Handlers;
+
   for (lld::coff::ObjectFile *File : Symtab->ObjectFiles) {
     if (!File->SEHCompat)
       return;
     for (SymbolBody *B : File->SEHandlers)
       Handlers.insert(cast<Defined>(B->repl()));
   }
+
   SEHTable.reset(new SEHTableChunk(Handlers));
-  createSection(".rdata")->addChunk(SEHTable.get());
+  RData->addChunk(SEHTable.get());
 }
 
 // Create .idata section for the DLL-imported symbol table.