diff options
author | Reid Kleckner <rnk@google.com> | 2018-11-10 01:36:02 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2018-11-10 01:36:02 +0000 |
commit | 9ba2c72debbfc04dbef867b36bd1c65abcf68270 (patch) | |
tree | 8e35fe4fc4357bb297e7e0c5827e9ae0c80ab73a | |
parent | b79eee487d0eccbe1ad2a5b5a8f753d41a445239 (diff) | |
download | bcm5719-llvm-9ba2c72debbfc04dbef867b36bd1c65abcf68270.tar.gz bcm5719-llvm-9ba2c72debbfc04dbef867b36bd1c65abcf68270.zip |
[PDB] Simplify some ghash code, NFC
Instead of calling the same function twice with different parameters,
make the parameters depend on the condition.
llvm-svn: 346578
-rw-r--r-- | lld/COFF/PDB.cpp | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/lld/COFF/PDB.cpp b/lld/COFF/PDB.cpp index 1afae488300..2121b765a2a 100644 --- a/lld/COFF/PDB.cpp +++ b/lld/COFF/PDB.cpp @@ -158,6 +158,20 @@ public: void addSections(ArrayRef<OutputSection *> OutputSections, ArrayRef<uint8_t> SectionTable); + /// Get the type table or the global type table if /DEBUG:GHASH is enabled. + TypeCollection &getTypeTable() { + if (Config->DebugGHashes) + return GlobalTypeTable; + return TypeTable; + } + + /// Get the ID table or the global ID table if /DEBUG:GHASH is enabled. + TypeCollection &getIDTable() { + if (Config->DebugGHashes) + return GlobalIDTable; + return IDTable; + } + /// Write the PDB to disk and store the Guid generated for it in *Guid. void commit(codeview::GUID *Guid); @@ -1166,17 +1180,12 @@ void DebugSHandler::handleDebugS(lld::coff::SectionChunk &DebugS) { NewFpoFrames.push_back(std::move(FDS)); break; } - case DebugSubsectionKind::Symbols: - if (Config->DebugGHashes) { - mergeSymbolRecords(Linker.Alloc, &File, Linker.Builder.getGsiBuilder(), - IndexMap, Linker.GlobalIDTable, - StringTableReferences, SS.getRecordData()); - } else { - mergeSymbolRecords(Linker.Alloc, &File, Linker.Builder.getGsiBuilder(), - IndexMap, Linker.IDTable, StringTableReferences, - SS.getRecordData()); - } + case DebugSubsectionKind::Symbols: { + mergeSymbolRecords(Linker.Alloc, &File, Linker.Builder.getGsiBuilder(), + IndexMap, Linker.getIDTable(), StringTableReferences, + SS.getRecordData()); break; + } default: // FIXME: Process the rest of the subsections. break; @@ -1339,13 +1348,8 @@ void PDBLinker::addObjectsToPDB() { // Construct TPI and IPI stream contents. ScopedTimer T2(TpiStreamLayoutTimer); - if (Config->DebugGHashes) { - addTypeInfo(Builder.getTpiBuilder(), GlobalTypeTable); - addTypeInfo(Builder.getIpiBuilder(), GlobalIDTable); - } else { - addTypeInfo(Builder.getTpiBuilder(), TypeTable); - addTypeInfo(Builder.getIpiBuilder(), IDTable); - } + addTypeInfo(Builder.getTpiBuilder(), getTypeTable()); + addTypeInfo(Builder.getIpiBuilder(), getIDTable()); T2.stop(); ScopedTimer T3(GlobalsLayoutTimer); |