From: Zachary Turner Date: Fri, 20 Jan 2017 22:41:15 +0000 (+0000) Subject: [PDB] Rename some files to be more intuitive. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f213f1173e99ff3cb714f3c4b76c3b8ce53cab65;p=llvm [PDB] Rename some files to be more intuitive. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@292663 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/DebugInfo/PDB/Raw/DbiStream.h b/include/llvm/DebugInfo/PDB/Raw/DbiStream.h index c97ca32ab43..2228ca9e640 100644 --- a/include/llvm/DebugInfo/PDB/Raw/DbiStream.h +++ b/include/llvm/DebugInfo/PDB/Raw/DbiStream.h @@ -16,9 +16,9 @@ #include "llvm/DebugInfo/MSF/StreamRef.h" #include "llvm/DebugInfo/PDB/PDBTypes.h" #include "llvm/DebugInfo/PDB/Raw/ModInfo.h" -#include "llvm/DebugInfo/PDB/Raw/NameHashTable.h" #include "llvm/DebugInfo/PDB/Raw/RawConstants.h" #include "llvm/DebugInfo/PDB/Raw/RawTypes.h" +#include "llvm/DebugInfo/PDB/Raw/StringTable.h" #include "llvm/Support/Endian.h" #include "llvm/Support/Error.h" @@ -89,7 +89,7 @@ private: std::unique_ptr Stream; std::vector ModuleInfos; - NameHashTable ECNames; + StringTable ECNames; msf::ReadableStreamRef ModInfoSubstream; msf::ReadableStreamRef SecContrSubstream; diff --git a/include/llvm/DebugInfo/PDB/Raw/InfoStream.h b/include/llvm/DebugInfo/PDB/Raw/InfoStream.h index 6b8b94ff1a3..11c7715f261 100644 --- a/include/llvm/DebugInfo/PDB/Raw/InfoStream.h +++ b/include/llvm/DebugInfo/PDB/Raw/InfoStream.h @@ -13,7 +13,7 @@ #include "llvm/ADT/StringMap.h" #include "llvm/DebugInfo/MSF/MappedBlockStream.h" #include "llvm/DebugInfo/PDB/PDBTypes.h" -#include "llvm/DebugInfo/PDB/Raw/NameMap.h" +#include "llvm/DebugInfo/PDB/Raw/NamedStreamMap.h" #include "llvm/DebugInfo/PDB/Raw/RawConstants.h" #include "llvm/Support/Endian.h" @@ -61,7 +61,7 @@ private: // universally unique. PDB_UniqueId Guid; - NameMap NamedStreams; + NamedStreamMap NamedStreams; }; } } diff --git a/include/llvm/DebugInfo/PDB/Raw/InfoStreamBuilder.h b/include/llvm/DebugInfo/PDB/Raw/InfoStreamBuilder.h index cb60b1eb69b..ab6a0c33ff0 100644 --- a/include/llvm/DebugInfo/PDB/Raw/InfoStreamBuilder.h +++ b/include/llvm/DebugInfo/PDB/Raw/InfoStreamBuilder.h @@ -14,7 +14,7 @@ #include "llvm/Support/Error.h" #include "llvm/DebugInfo/PDB/PDBTypes.h" -#include "llvm/DebugInfo/PDB/Raw/NameMapBuilder.h" +#include "llvm/DebugInfo/PDB/Raw/NamedStreamMapBuilder.h" #include "llvm/DebugInfo/PDB/Raw/PDBFile.h" #include "llvm/DebugInfo/PDB/Raw/RawConstants.h" @@ -37,7 +37,7 @@ public: void setAge(uint32_t A); void setGuid(PDB_UniqueId G); - NameMapBuilder &getNamedStreamsBuilder(); + NamedStreamMapBuilder &getNamedStreamsBuilder(); uint32_t calculateSerializedLength() const; @@ -54,7 +54,7 @@ private: uint32_t Age; PDB_UniqueId Guid; - NameMapBuilder NamedStreams; + NamedStreamMapBuilder NamedStreams; }; } } diff --git a/include/llvm/DebugInfo/PDB/Raw/NameMap.h b/include/llvm/DebugInfo/PDB/Raw/NamedStreamMap.h similarity index 70% rename from include/llvm/DebugInfo/PDB/Raw/NameMap.h rename to include/llvm/DebugInfo/PDB/Raw/NamedStreamMap.h index de1163bc307..088c53aed84 100644 --- a/include/llvm/DebugInfo/PDB/Raw/NameMap.h +++ b/include/llvm/DebugInfo/PDB/Raw/NamedStreamMap.h @@ -1,4 +1,4 @@ -//===- NameMap.h - PDB Name Map ---------------------------------*- C++ -*-===// +//===- NamedStreamMap.h - PDB Named Stream Map ------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -7,8 +7,8 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_DEBUGINFO_PDB_RAW_PDBNAMEMAP_H -#define LLVM_DEBUGINFO_PDB_RAW_PDBNAMEMAP_H +#ifndef LLVM_DEBUGINFO_PDB_RAW_PDBNAMEDSTREAMMAP_H +#define LLVM_DEBUGINFO_PDB_RAW_PDBNAMEDSTREAMMAP_H #include "llvm/ADT/StringMap.h" #include "llvm/ADT/StringRef.h" @@ -21,12 +21,12 @@ class StreamReader; class StreamWriter; } namespace pdb { -class NameMapBuilder; -class NameMap { - friend NameMapBuilder; +class NamedStreamMapBuilder; +class NamedStreamMap { + friend NamedStreamMapBuilder; public: - NameMap(); + NamedStreamMap(); Error load(msf::StreamReader &Stream); @@ -41,4 +41,4 @@ private: } // end namespace pdb } // end namespace llvm -#endif // LLVM_DEBUGINFO_PDB_RAW_PDBNAMEMAP_H +#endif // LLVM_DEBUGINFO_PDB_RAW_PDBNAMEDSTREAMMAP_H diff --git a/include/llvm/DebugInfo/PDB/Raw/NameMapBuilder.h b/include/llvm/DebugInfo/PDB/Raw/NamedStreamMapBuilder.h similarity index 77% rename from include/llvm/DebugInfo/PDB/Raw/NameMapBuilder.h rename to include/llvm/DebugInfo/PDB/Raw/NamedStreamMapBuilder.h index 048f56e5764..b53a60dd426 100644 --- a/include/llvm/DebugInfo/PDB/Raw/NameMapBuilder.h +++ b/include/llvm/DebugInfo/PDB/Raw/NamedStreamMapBuilder.h @@ -1,4 +1,4 @@ -//===- NameMapBuilder.h - PDB Name Map Builder ------------------*- C++ -*-===// +//===- NamedStreamMapBuilder.h - PDB Named Stream Map Builder ---*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -7,8 +7,8 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_DEBUGINFO_PDB_RAW_PDBNAMEMAPBUILDER_H -#define LLVM_DEBUGINFO_PDB_RAW_PDBNAMEMAPBUILDER_H +#ifndef LLVM_DEBUGINFO_PDB_RAW_PDBNAMEDSTREAMMAPBUILDER_H +#define LLVM_DEBUGINFO_PDB_RAW_PDBNAMEDSTREAMMAPBUILDER_H #include "llvm/DebugInfo/PDB/Raw/HashTable.h" #include "llvm/Support/Error.h" @@ -22,11 +22,10 @@ namespace msf { class StreamWriter; } namespace pdb { -class NameMap; -class NameMapBuilder { +class NamedStreamMapBuilder { public: - NameMapBuilder(); + NamedStreamMapBuilder(); void addMapping(StringRef Name, uint32_t Mapping); diff --git a/include/llvm/DebugInfo/PDB/Raw/PDBFile.h b/include/llvm/DebugInfo/PDB/Raw/PDBFile.h index 29f5b2163d8..07c1dcfa87e 100644 --- a/include/llvm/DebugInfo/PDB/Raw/PDBFile.h +++ b/include/llvm/DebugInfo/PDB/Raw/PDBFile.h @@ -32,7 +32,7 @@ namespace pdb { class DbiStream; class GlobalsStream; class InfoStream; -class NameHashTable; +class StringTable; class PDBFileBuilder; class PublicsStream; class SymbolStream; @@ -91,7 +91,7 @@ public: Expected getPDBIpiStream(); Expected getPDBPublicsStream(); Expected getPDBSymbolStream(); - Expected getStringTable(); + Expected getStringTable(); BumpPtrAllocator &getAllocator() { return Allocator; } @@ -125,7 +125,7 @@ public: std::unique_ptr Symbols; std::unique_ptr DirectoryStream; std::unique_ptr StringTableStream; - std::unique_ptr StringTable; + std::unique_ptr Strings; }; } } diff --git a/include/llvm/DebugInfo/PDB/Raw/RawTypes.h b/include/llvm/DebugInfo/PDB/Raw/RawTypes.h index 8497ed97954..5f0a824b4dd 100644 --- a/include/llvm/DebugInfo/PDB/Raw/RawTypes.h +++ b/include/llvm/DebugInfo/PDB/Raw/RawTypes.h @@ -303,13 +303,13 @@ struct InfoStreamHeader { }; /// The header preceeding the /names stream. -struct NameHashTableHeader { +struct StringTableHeader { support::ulittle32_t Signature; support::ulittle32_t HashVersion; support::ulittle32_t ByteSize; }; -const uint32_t NameHashTableSignature = 0xEFFEEFFE; +const uint32_t StringTableSignature = 0xEFFEEFFE; } // namespace pdb } // namespace llvm diff --git a/include/llvm/DebugInfo/PDB/Raw/NameHashTable.h b/include/llvm/DebugInfo/PDB/Raw/StringTable.h similarity index 82% rename from include/llvm/DebugInfo/PDB/Raw/NameHashTable.h rename to include/llvm/DebugInfo/PDB/Raw/StringTable.h index 00d022d4d8e..bf26b4b62c6 100644 --- a/include/llvm/DebugInfo/PDB/Raw/NameHashTable.h +++ b/include/llvm/DebugInfo/PDB/Raw/StringTable.h @@ -1,4 +1,4 @@ -//===- NameHashTable.h - PDB Name Hash Table --------------------*- C++ -*-===// +//===- StringTable.h - PDB String Table -------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -7,8 +7,8 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_DEBUGINFO_PDB_RAW_NAMEHASHTABLE_H -#define LLVM_DEBUGINFO_PDB_RAW_NAMEHASHTABLE_H +#ifndef LLVM_DEBUGINFO_PDB_RAW_STRINGTABLE_H +#define LLVM_DEBUGINFO_PDB_RAW_STRINGTABLE_H #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/StringRef.h" @@ -25,9 +25,9 @@ class StreamReader; } namespace pdb { -class NameHashTable { +class StringTable { public: - NameHashTable(); + StringTable(); Error load(msf::StreamReader &Stream); @@ -51,4 +51,4 @@ private: } // end namespace pdb } // end namespace llvm -#endif // LLVM_DEBUGINFO_PDB_RAW_NAMEHASHTABLE_H +#endif // LLVM_DEBUGINFO_PDB_RAW_STRINGTABLE_H diff --git a/include/llvm/DebugInfo/PDB/Raw/NameHashTableBuilder.h b/include/llvm/DebugInfo/PDB/Raw/StringTableBuilder.h similarity index 78% rename from include/llvm/DebugInfo/PDB/Raw/NameHashTableBuilder.h rename to include/llvm/DebugInfo/PDB/Raw/StringTableBuilder.h index d7fd4efd3ca..d16ac2c82e3 100644 --- a/include/llvm/DebugInfo/PDB/Raw/NameHashTableBuilder.h +++ b/include/llvm/DebugInfo/PDB/Raw/StringTableBuilder.h @@ -1,4 +1,4 @@ -//===- NameHashTableBuilder.h - PDB Name Hash Table Builder -----*- C++ -*-===// +//===- StringTableBuilder.h - PDB String Table Builder ----------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -11,8 +11,8 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_DEBUGINFO_PDB_RAW_NAMEHASHTABLEBUILDER_H -#define LLVM_DEBUGINFO_PDB_RAW_NAMEHASHTABLEBUILDER_H +#ifndef LLVM_DEBUGINFO_PDB_RAW_STRINGTABLEBUILDER_H +#define LLVM_DEBUGINFO_PDB_RAW_STRINGTABLEBUILDER_H #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/StringRef.h" @@ -25,7 +25,7 @@ class StreamWriter; } namespace pdb { -class NameHashTableBuilder { +class StringTableBuilder { public: // If string S does not exist in the string table, insert it. // Returns the ID for S. @@ -42,4 +42,4 @@ private: } // end namespace pdb } // end namespace llvm -#endif // LLVM_DEBUGINFO_PDB_RAW_NAMEHASHTABLEBUILDER_H +#endif // LLVM_DEBUGINFO_PDB_RAW_STRINGTABLEBUILDER_H diff --git a/lib/DebugInfo/PDB/CMakeLists.txt b/lib/DebugInfo/PDB/CMakeLists.txt index 43ae30fabb2..469886d23e8 100644 --- a/lib/DebugInfo/PDB/CMakeLists.txt +++ b/lib/DebugInfo/PDB/CMakeLists.txt @@ -39,15 +39,15 @@ add_pdb_impl_folder(Raw Raw/InfoStreamBuilder.cpp Raw/ModInfo.cpp Raw/ModStream.cpp - Raw/NameHashTable.cpp - Raw/NameHashTableBuilder.cpp - Raw/NameMap.cpp - Raw/NameMapBuilder.cpp + Raw/NamedStreamMap.cpp + Raw/NamedStreamMapBuilder.cpp Raw/PDBFile.cpp Raw/PDBFileBuilder.cpp Raw/PublicsStream.cpp Raw/RawError.cpp Raw/RawSession.cpp + Raw/StringTable.cpp + Raw/StringTableBuilder.cpp Raw/SymbolStream.cpp Raw/TpiHashing.cpp Raw/TpiStream.cpp diff --git a/lib/DebugInfo/PDB/Raw/DbiStream.cpp b/lib/DebugInfo/PDB/Raw/DbiStream.cpp index 4f4a0cf6578..cb390d2fa06 100644 --- a/lib/DebugInfo/PDB/Raw/DbiStream.cpp +++ b/lib/DebugInfo/PDB/Raw/DbiStream.cpp @@ -16,7 +16,6 @@ #include "llvm/DebugInfo/PDB/Raw/ISectionContribVisitor.h" #include "llvm/DebugInfo/PDB/Raw/InfoStream.h" #include "llvm/DebugInfo/PDB/Raw/ModInfo.h" -#include "llvm/DebugInfo/PDB/Raw/NameHashTable.h" #include "llvm/DebugInfo/PDB/Raw/PDBFile.h" #include "llvm/DebugInfo/PDB/Raw/RawConstants.h" #include "llvm/DebugInfo/PDB/Raw/RawError.h" diff --git a/lib/DebugInfo/PDB/Raw/InfoStreamBuilder.cpp b/lib/DebugInfo/PDB/Raw/InfoStreamBuilder.cpp index 73fbf853b4f..50539658819 100644 --- a/lib/DebugInfo/PDB/Raw/InfoStreamBuilder.cpp +++ b/lib/DebugInfo/PDB/Raw/InfoStreamBuilder.cpp @@ -32,7 +32,7 @@ void InfoStreamBuilder::setAge(uint32_t A) { Age = A; } void InfoStreamBuilder::setGuid(PDB_UniqueId G) { Guid = G; } -NameMapBuilder &InfoStreamBuilder::getNamedStreamsBuilder() { +NamedStreamMapBuilder &InfoStreamBuilder::getNamedStreamsBuilder() { return NamedStreams; } diff --git a/lib/DebugInfo/PDB/Raw/NameMap.cpp b/lib/DebugInfo/PDB/Raw/NamedStreamMap.cpp similarity index 85% rename from lib/DebugInfo/PDB/Raw/NameMap.cpp rename to lib/DebugInfo/PDB/Raw/NamedStreamMap.cpp index b101f90f756..77077bc3738 100644 --- a/lib/DebugInfo/PDB/Raw/NameMap.cpp +++ b/lib/DebugInfo/PDB/Raw/NamedStreamMap.cpp @@ -1,4 +1,4 @@ -//===- NameMap.cpp - PDB Name Map -------------------------------*- C++ -*-===// +//===- NamedStreamMap.cpp - PDB Named Stream Map ----------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// -#include "llvm/DebugInfo/PDB/Raw/NameMap.h" +#include "llvm/DebugInfo/PDB/Raw/NamedStreamMap.h" #include "llvm/ADT/SparseBitVector.h" #include "llvm/ADT/StringMap.h" @@ -24,9 +24,9 @@ using namespace llvm; using namespace llvm::msf; using namespace llvm::pdb; -NameMap::NameMap() = default; +NamedStreamMap::NamedStreamMap() = default; -Error NameMap::load(StreamReader &Stream) { +Error NamedStreamMap::load(StreamReader &Stream) { uint32_t StringBufferSize; if (auto EC = Stream.readInteger(StringBufferSize)) return joinErrors(std::move(EC), @@ -63,12 +63,13 @@ Error NameMap::load(StreamReader &Stream) { return Error::success(); } -iterator_range> NameMap::entries() const { +iterator_range> +NamedStreamMap::entries() const { return make_range>(Mapping.begin(), Mapping.end()); } -bool NameMap::tryGetValue(StringRef Name, uint32_t &Value) const { +bool NamedStreamMap::tryGetValue(StringRef Name, uint32_t &Value) const { auto Iter = Mapping.find(Name); if (Iter == Mapping.end()) return false; diff --git a/lib/DebugInfo/PDB/Raw/NameMapBuilder.cpp b/lib/DebugInfo/PDB/Raw/NamedStreamMapBuilder.cpp similarity index 75% rename from lib/DebugInfo/PDB/Raw/NameMapBuilder.cpp rename to lib/DebugInfo/PDB/Raw/NamedStreamMapBuilder.cpp index aead331d99d..886d2ffb331 100644 --- a/lib/DebugInfo/PDB/Raw/NameMapBuilder.cpp +++ b/lib/DebugInfo/PDB/Raw/NamedStreamMapBuilder.cpp @@ -1,4 +1,4 @@ -//===- NameMapBuilder.cpp - PDB Name Map Builder ----------------*- C++ -*-===// +//===- NamedStreamMapBuilder.cpp - PDB Named Stream Map Builder -*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -7,10 +7,10 @@ // //===----------------------------------------------------------------------===// +#include "llvm/DebugInfo/PDB/Raw/NamedStreamMapBuilder.h" #include "llvm/ADT/STLExtras.h" #include "llvm/DebugInfo/MSF/StreamWriter.h" -#include "llvm/DebugInfo/PDB/Raw/NameMap.h" -#include "llvm/DebugInfo/PDB/Raw/NameMapBuilder.h" +#include "llvm/DebugInfo/PDB/Raw/NamedStreamMap.h" #include "llvm/Support/Endian.h" #include "llvm/Support/Error.h" #include @@ -19,15 +19,15 @@ using namespace llvm; using namespace llvm::pdb; -NameMapBuilder::NameMapBuilder() = default; +NamedStreamMapBuilder::NamedStreamMapBuilder() = default; -void NameMapBuilder::addMapping(StringRef Name, uint32_t Mapping) { +void NamedStreamMapBuilder::addMapping(StringRef Name, uint32_t Mapping) { Strings.push_back(Name); Map.set(Offset, Mapping); Offset += Name.size() + 1; } -uint32_t NameMapBuilder::calculateSerializedLength() const { +uint32_t NamedStreamMapBuilder::calculateSerializedLength() const { uint32_t TotalLength = 0; // Number of bytes of string data. @@ -40,7 +40,7 @@ uint32_t NameMapBuilder::calculateSerializedLength() const { return TotalLength; } -Error NameMapBuilder::commit(msf::StreamWriter &Writer) const { +Error NamedStreamMapBuilder::commit(msf::StreamWriter &Writer) const { // The first field is the number of bytes of string data. We've already been // keeping a running total of this in `Offset`. if (auto EC = Writer.writeInteger(Offset)) // Number of bytes of string data diff --git a/lib/DebugInfo/PDB/Raw/PDBFile.cpp b/lib/DebugInfo/PDB/Raw/PDBFile.cpp index 53491518b8c..aef86c2ea99 100644 --- a/lib/DebugInfo/PDB/Raw/PDBFile.cpp +++ b/lib/DebugInfo/PDB/Raw/PDBFile.cpp @@ -7,20 +7,20 @@ // //===----------------------------------------------------------------------===// +#include "llvm/DebugInfo/PDB/Raw/PDBFile.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/STLExtras.h" -#include "llvm/DebugInfo/MSF/MappedBlockStream.h" #include "llvm/DebugInfo/MSF/MSFCommon.h" +#include "llvm/DebugInfo/MSF/MappedBlockStream.h" #include "llvm/DebugInfo/MSF/StreamArray.h" #include "llvm/DebugInfo/MSF/StreamInterface.h" #include "llvm/DebugInfo/MSF/StreamReader.h" #include "llvm/DebugInfo/PDB/Raw/DbiStream.h" #include "llvm/DebugInfo/PDB/Raw/GlobalsStream.h" #include "llvm/DebugInfo/PDB/Raw/InfoStream.h" -#include "llvm/DebugInfo/PDB/Raw/NameHashTable.h" -#include "llvm/DebugInfo/PDB/Raw/PDBFile.h" #include "llvm/DebugInfo/PDB/Raw/PublicsStream.h" #include "llvm/DebugInfo/PDB/Raw/RawError.h" +#include "llvm/DebugInfo/PDB/Raw/StringTable.h" #include "llvm/DebugInfo/PDB/Raw/SymbolStream.h" #include "llvm/DebugInfo/PDB/Raw/TpiStream.h" #include "llvm/Support/Endian.h" @@ -323,8 +323,8 @@ Expected PDBFile::getPDBSymbolStream() { return *Symbols; } -Expected PDBFile::getStringTable() { - if (!StringTable || !StringTableStream) { +Expected PDBFile::getStringTable() { + if (!Strings || !StringTableStream) { auto IS = getPDBInfoStream(); if (!IS) return IS.takeError(); @@ -336,13 +336,13 @@ Expected PDBFile::getStringTable() { if (!NS) return NS.takeError(); StreamReader Reader(**NS); - auto N = llvm::make_unique(); + auto N = llvm::make_unique(); if (auto EC = N->load(Reader)) return std::move(EC); - StringTable = std::move(N); + Strings = std::move(N); StringTableStream = std::move(*NS); } - return *StringTable; + return *Strings; } bool PDBFile::hasPDBDbiStream() const { return StreamDBI < getNumStreams(); } diff --git a/lib/DebugInfo/PDB/Raw/NameHashTable.cpp b/lib/DebugInfo/PDB/Raw/StringTable.cpp similarity index 85% rename from lib/DebugInfo/PDB/Raw/NameHashTable.cpp rename to lib/DebugInfo/PDB/Raw/StringTable.cpp index 86784a7aa75..ed78cb42da6 100644 --- a/lib/DebugInfo/PDB/Raw/NameHashTable.cpp +++ b/lib/DebugInfo/PDB/Raw/StringTable.cpp @@ -1,4 +1,4 @@ -//===- NameHashTable.cpp - PDB Name Hash Table ------------------*- C++ -*-===// +//===- StringTable.cpp - PDB String Table -----------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// -#include "llvm/DebugInfo/PDB/Raw/NameHashTable.h" +#include "llvm/DebugInfo/PDB/Raw/StringTable.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/DebugInfo/MSF/StreamReader.h" @@ -21,14 +21,14 @@ using namespace llvm::msf; using namespace llvm::support; using namespace llvm::pdb; -NameHashTable::NameHashTable() : Signature(0), HashVersion(0), NameCount(0) {} +StringTable::StringTable() : Signature(0), HashVersion(0), NameCount(0) {} -Error NameHashTable::load(StreamReader &Stream) { - const NameHashTableHeader *H; +Error StringTable::load(StreamReader &Stream) { + const StringTableHeader *H; if (auto EC = Stream.readObject(H)) return EC; - if (H->Signature != NameHashTableSignature) + if (H->Signature != StringTableSignature) return make_error(raw_error_code::corrupt_file, "Invalid hash table signature"); if (H->HashVersion != 1 && H->HashVersion != 2) @@ -60,7 +60,7 @@ Error NameHashTable::load(StreamReader &Stream) { return Error::success(); } -StringRef NameHashTable::getStringForID(uint32_t ID) const { +StringRef StringTable::getStringForID(uint32_t ID) const { if (ID == IDs[0]) return StringRef(); @@ -75,7 +75,7 @@ StringRef NameHashTable::getStringForID(uint32_t ID) const { return Result; } -uint32_t NameHashTable::getIDForString(StringRef Str) const { +uint32_t StringTable::getIDForString(StringRef Str) const { uint32_t Hash = (HashVersion == 1) ? hashStringV1(Str) : hashStringV2(Str); size_t Count = IDs.size(); uint32_t Start = Hash % Count; @@ -94,6 +94,6 @@ uint32_t NameHashTable::getIDForString(StringRef Str) const { return IDs[0]; } -FixedStreamArray NameHashTable::name_ids() const { +FixedStreamArray StringTable::name_ids() const { return IDs; } diff --git a/lib/DebugInfo/PDB/Raw/NameHashTableBuilder.cpp b/lib/DebugInfo/PDB/Raw/StringTableBuilder.cpp similarity index 87% rename from lib/DebugInfo/PDB/Raw/NameHashTableBuilder.cpp rename to lib/DebugInfo/PDB/Raw/StringTableBuilder.cpp index 2ef242515df..7284582d01a 100644 --- a/lib/DebugInfo/PDB/Raw/NameHashTableBuilder.cpp +++ b/lib/DebugInfo/PDB/Raw/StringTableBuilder.cpp @@ -1,4 +1,4 @@ -//===- NameHashTable.cpp - PDB Name Hash Table ------------------*- C++ -*-===// +//===- StringTableBuilder.cpp - PDB String Table ----------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// -#include "llvm/DebugInfo/PDB/Raw/NameHashTableBuilder.h" +#include "llvm/DebugInfo/PDB/Raw/StringTableBuilder.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/DebugInfo/MSF/StreamWriter.h" #include "llvm/DebugInfo/PDB/Raw/Hash.h" @@ -19,7 +19,7 @@ using namespace llvm::support; using namespace llvm::support::endian; using namespace llvm::pdb; -uint32_t NameHashTableBuilder::insert(StringRef S) { +uint32_t StringTableBuilder::insert(StringRef S) { auto P = Strings.insert({S, StringSize}); // If a given string didn't exist in the string table, we want to increment @@ -38,9 +38,9 @@ static uint32_t computeBucketCount(uint32_t NumStrings) { return (NumStrings + 1) * 1.25; } -uint32_t NameHashTableBuilder::calculateSerializedLength() const { +uint32_t StringTableBuilder::calculateSerializedLength() const { uint32_t Size = 0; - Size += sizeof(NameHashTableHeader); + Size += sizeof(StringTableHeader); Size += StringSize; Size += 4; // Hash table begins with 4-byte size field. @@ -51,10 +51,10 @@ uint32_t NameHashTableBuilder::calculateSerializedLength() const { return Size; } -Error NameHashTableBuilder::commit(msf::StreamWriter &Writer) const { +Error StringTableBuilder::commit(msf::StreamWriter &Writer) const { // Write a header - NameHashTableHeader H; - H.Signature = NameHashTableSignature; + StringTableHeader H; + H.Signature = StringTableSignature; H.HashVersion = 1; H.ByteSize = StringSize; if (auto EC = Writer.writeObject(H)) diff --git a/unittests/DebugInfo/PDB/CMakeLists.txt b/unittests/DebugInfo/PDB/CMakeLists.txt index 06695e3a82b..3ba3196ed1c 100644 --- a/unittests/DebugInfo/PDB/CMakeLists.txt +++ b/unittests/DebugInfo/PDB/CMakeLists.txt @@ -7,7 +7,7 @@ set(LLVM_LINK_COMPONENTS set(DebugInfoPDBSources HashTableTest.cpp MappedBlockStreamTest.cpp - NameHashTableBuilderTest.cpp + StringTableBuilderTest.cpp MSFBuilderTest.cpp PDBApiTest.cpp ) diff --git a/unittests/DebugInfo/PDB/NameHashTableBuilderTest.cpp b/unittests/DebugInfo/PDB/StringTableBuilderTest.cpp similarity index 81% rename from unittests/DebugInfo/PDB/NameHashTableBuilderTest.cpp rename to unittests/DebugInfo/PDB/StringTableBuilderTest.cpp index 4ae0e67fa20..aa4ab665fdb 100644 --- a/unittests/DebugInfo/PDB/NameHashTableBuilderTest.cpp +++ b/unittests/DebugInfo/PDB/StringTableBuilderTest.cpp @@ -1,4 +1,4 @@ -//===- NameHashTableBuilderTest.cpp ---------------------------------------===// +//===- StringTableBuilderTest.cpp -----------------------------------------===// // // The LLVM Compiler Infrastructure // @@ -12,8 +12,8 @@ #include "llvm/DebugInfo/MSF/ByteStream.h" #include "llvm/DebugInfo/MSF/StreamReader.h" #include "llvm/DebugInfo/MSF/StreamWriter.h" -#include "llvm/DebugInfo/PDB/Raw/NameHashTable.h" -#include "llvm/DebugInfo/PDB/Raw/NameHashTableBuilder.h" +#include "llvm/DebugInfo/PDB/Raw/StringTable.h" +#include "llvm/DebugInfo/PDB/Raw/StringTableBuilder.h" #include "gtest/gtest.h" @@ -21,12 +21,12 @@ using namespace llvm; using namespace llvm::pdb; namespace { -class NameHashTableBuilderTest : public ::testing::Test {}; +class StringTableBuilderTest : public ::testing::Test {}; } -TEST_F(NameHashTableBuilderTest, Simple) { +TEST_F(StringTableBuilderTest, Simple) { // Create /names table contents. - NameHashTableBuilder Builder; + StringTableBuilder Builder; EXPECT_EQ(1U, Builder.insert("foo")); EXPECT_EQ(5U, Builder.insert("bar")); EXPECT_EQ(1U, Builder.insert("foo")); @@ -40,7 +40,7 @@ TEST_F(NameHashTableBuilderTest, Simple) { // Reads the contents back. msf::ByteStream InStream(Buffer); msf::StreamReader Reader(InStream); - NameHashTable Table; + StringTable Table; EXPECT_NO_ERROR(Table.load(Reader)); EXPECT_EQ(3U, Table.getNameCount());