1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00

Rename pdb::StringTable -> pdb::PDBStringTable.

With the forthcoming codeview::StringTable which a pdb::StringTable
would hold an instance of as one member, this ambiguity becomes
confusing.  Rename to PDBStringTable to avoid this.

llvm-svn: 301948
This commit is contained in:
Zachary Turner 2017-05-02 18:00:13 +00:00
parent b00fe7bacd
commit 070472dad1
15 changed files with 70 additions and 68 deletions

View File

@ -13,9 +13,9 @@
#include "llvm/DebugInfo/CodeView/ModuleDebugFragment.h"
#include "llvm/DebugInfo/MSF/MappedBlockStream.h"
#include "llvm/DebugInfo/PDB/Native/DbiModuleDescriptor.h"
#include "llvm/DebugInfo/PDB/Native/PDBStringTable.h"
#include "llvm/DebugInfo/PDB/Native/RawConstants.h"
#include "llvm/DebugInfo/PDB/Native/RawTypes.h"
#include "llvm/DebugInfo/PDB/Native/StringTable.h"
#include "llvm/DebugInfo/PDB/PDBTypes.h"
#include "llvm/Support/BinaryStreamArray.h"
#include "llvm/Support/BinaryStreamArray.h"
@ -91,7 +91,7 @@ private:
std::unique_ptr<msf::MappedBlockStream> Stream;
std::vector<ModuleInfoEx> ModuleInfos;
StringTable ECNames;
PDBStringTable ECNames;
BinaryStreamRef ModInfoSubstream;
BinaryStreamRef SecContrSubstream;

View File

@ -33,7 +33,7 @@ namespace pdb {
class DbiStream;
class GlobalsStream;
class InfoStream;
class StringTable;
class PDBStringTable;
class PDBFileBuilder;
class PublicsStream;
class SymbolStream;
@ -95,7 +95,7 @@ public:
Expected<TpiStream &> getPDBIpiStream();
Expected<PublicsStream &> getPDBPublicsStream();
Expected<SymbolStream &> getPDBSymbolStream();
Expected<StringTable &> getStringTable();
Expected<PDBStringTable &> getStringTable();
BumpPtrAllocator &getAllocator() { return Allocator; }
@ -106,7 +106,7 @@ public:
bool hasPDBPublicsStream();
bool hasPDBSymbolStream();
bool hasPDBTpiStream() const;
bool hasStringTable();
bool hasPDBStringTable();
private:
Expected<std::unique_ptr<msf::MappedBlockStream>>
@ -130,8 +130,8 @@ private:
std::unique_ptr<PublicsStream> Publics;
std::unique_ptr<SymbolStream> Symbols;
std::unique_ptr<msf::MappedBlockStream> DirectoryStream;
std::unique_ptr<msf::MappedBlockStream> StringTableStream;
std::unique_ptr<StringTable> Strings;
std::unique_ptr<msf::MappedBlockStream> PDBStringTableStream;
std::unique_ptr<PDBStringTable> Strings;
};
}
}

View File

@ -15,8 +15,8 @@
#include "llvm/ADT/Optional.h"
#include "llvm/DebugInfo/PDB/Native/NamedStreamMap.h"
#include "llvm/DebugInfo/PDB/Native/PDBFile.h"
#include "llvm/DebugInfo/PDB/Native/PDBStringTableBuilder.h"
#include "llvm/DebugInfo/PDB/Native/RawConstants.h"
#include "llvm/DebugInfo/PDB/Native/StringTableBuilder.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/Error.h"
@ -46,7 +46,7 @@ public:
DbiStreamBuilder &getDbiBuilder();
TpiStreamBuilder &getTpiBuilder();
TpiStreamBuilder &getIpiBuilder();
StringTableBuilder &getStringTableBuilder();
PDBStringTableBuilder &getStringTableBuilder();
Error commit(StringRef Filename);
@ -62,7 +62,7 @@ private:
std::unique_ptr<TpiStreamBuilder> Tpi;
std::unique_ptr<TpiStreamBuilder> Ipi;
StringTableBuilder Strings;
PDBStringTableBuilder Strings;
NamedStreamMap NamedStreams;
};
}

View File

@ -1,4 +1,5 @@
//===- StringTable.h - PDB String Table -------------------------*- C++ -*-===//
//===- PDBStringTable.h - PDB String Table -------------------------*- C++
//-*-===//
//
// The LLVM Compiler Infrastructure
//
@ -7,8 +8,8 @@
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_DEBUGINFO_PDB_RAW_STRINGTABLE_H
#define LLVM_DEBUGINFO_PDB_RAW_STRINGTABLE_H
#ifndef LLVM_DEBUGINFO_PDB_RAW_PDBSTRINGTABLE_H
#define LLVM_DEBUGINFO_PDB_RAW_PDBSTRINGTABLE_H
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringRef.h"
@ -24,9 +25,9 @@ class BinaryStreamReader;
namespace pdb {
class StringTable {
class PDBStringTable {
public:
StringTable();
PDBStringTable();
Error load(BinaryStreamReader &Stream);

View File

@ -1,4 +1,4 @@
//===- StringTableBuilder.h - PDB String Table Builder ----------*- C++ -*-===//
//===- PDBStringTableBuilder.h - PDB String Table Builder -------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@ -11,8 +11,8 @@
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_DEBUGINFO_PDB_RAW_STRINGTABLEBUILDER_H
#define LLVM_DEBUGINFO_PDB_RAW_STRINGTABLEBUILDER_H
#ifndef LLVM_DEBUGINFO_PDB_RAW_PDBSTRINGTABLEBUILDER_H
#define LLVM_DEBUGINFO_PDB_RAW_PDBSTRINGTABLEBUILDER_H
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/StringRef.h"
@ -24,7 +24,7 @@ class BinaryStreamWriter;
namespace pdb {
class StringTableBuilder {
class PDBStringTableBuilder {
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_STRINGTABLEBUILDER_H
#endif // LLVM_DEBUGINFO_PDB_RAW_PDBSTRINGTABLEBUILDER_H

View File

@ -307,13 +307,13 @@ struct InfoStreamHeader {
};
/// The header preceeding the /names stream.
struct StringTableHeader {
struct PDBStringTableHeader {
support::ulittle32_t Signature;
support::ulittle32_t HashVersion;
support::ulittle32_t ByteSize;
};
const uint32_t StringTableSignature = 0xEFFEEFFE;
const uint32_t PDBStringTableSignature = 0xEFFEEFFE;
} // namespace pdb
} // namespace llvm

View File

@ -48,11 +48,11 @@ add_pdb_impl_folder(Native
Native/NativeSession.cpp
Native/PDBFile.cpp
Native/PDBFileBuilder.cpp
Native/PDBStringTable.cpp
Native/PDBStringTableBuilder.cpp
Native/PDBTypeServerHandler.cpp
Native/PublicsStream.cpp
Native/RawError.cpp
Native/StringTable.cpp
Native/StringTableBuilder.cpp
Native/SymbolStream.cpp
Native/TpiHashing.cpp
Native/TpiStream.cpp

View File

@ -15,9 +15,9 @@
#include "llvm/DebugInfo/PDB/Native/DbiStream.h"
#include "llvm/DebugInfo/PDB/Native/GlobalsStream.h"
#include "llvm/DebugInfo/PDB/Native/InfoStream.h"
#include "llvm/DebugInfo/PDB/Native/PDBStringTable.h"
#include "llvm/DebugInfo/PDB/Native/PublicsStream.h"
#include "llvm/DebugInfo/PDB/Native/RawError.h"
#include "llvm/DebugInfo/PDB/Native/StringTable.h"
#include "llvm/DebugInfo/PDB/Native/SymbolStream.h"
#include "llvm/DebugInfo/PDB/Native/TpiStream.h"
#include "llvm/Support/BinaryStream.h"
@ -337,8 +337,8 @@ Expected<SymbolStream &> PDBFile::getPDBSymbolStream() {
return *Symbols;
}
Expected<StringTable &> PDBFile::getStringTable() {
if (!Strings || !StringTableStream) {
Expected<PDBStringTable &> PDBFile::getStringTable() {
if (!Strings || !PDBStringTableStream) {
auto IS = getPDBInfoStream();
if (!IS)
return IS.takeError();
@ -351,11 +351,11 @@ Expected<StringTable &> PDBFile::getStringTable() {
return NS.takeError();
BinaryStreamReader Reader(**NS);
auto N = llvm::make_unique<StringTable>();
auto N = llvm::make_unique<PDBStringTable>();
if (auto EC = N->load(Reader))
return std::move(EC);
Strings = std::move(N);
StringTableStream = std::move(*NS);
PDBStringTableStream = std::move(*NS);
}
return *Strings;
}
@ -389,7 +389,7 @@ bool PDBFile::hasPDBSymbolStream() {
bool PDBFile::hasPDBTpiStream() const { return StreamTPI < getNumStreams(); }
bool PDBFile::hasStringTable() {
bool PDBFile::hasPDBStringTable() {
auto IS = getPDBInfoStream();
if (!IS)
return false;

View File

@ -17,8 +17,8 @@
#include "llvm/DebugInfo/PDB/Native/DbiStreamBuilder.h"
#include "llvm/DebugInfo/PDB/Native/InfoStream.h"
#include "llvm/DebugInfo/PDB/Native/InfoStreamBuilder.h"
#include "llvm/DebugInfo/PDB/Native/PDBStringTableBuilder.h"
#include "llvm/DebugInfo/PDB/Native/RawError.h"
#include "llvm/DebugInfo/PDB/Native/StringTableBuilder.h"
#include "llvm/DebugInfo/PDB/Native/TpiStream.h"
#include "llvm/DebugInfo/PDB/Native/TpiStreamBuilder.h"
#include "llvm/Support/BinaryStream.h"
@ -67,7 +67,9 @@ TpiStreamBuilder &PDBFileBuilder::getIpiBuilder() {
return *Ipi;
}
StringTableBuilder &PDBFileBuilder::getStringTableBuilder() { return Strings; }
PDBStringTableBuilder &PDBFileBuilder::getStringTableBuilder() {
return Strings;
}
Error PDBFileBuilder::addNamedStream(StringRef Name, uint32_t Size) {
auto ExpectedStream = Msf->addStream(Size);
@ -78,9 +80,9 @@ Error PDBFileBuilder::addNamedStream(StringRef Name, uint32_t Size) {
}
Expected<msf::MSFLayout> PDBFileBuilder::finalizeMsfLayout() {
uint32_t StringTableSize = Strings.finalize();
uint32_t PDBStringTableSize = Strings.finalize();
if (auto EC = addNamedStream("/names", StringTableSize))
if (auto EC = addNamedStream("/names", PDBStringTableSize))
return std::move(EC);
if (auto EC = addNamedStream("/LinkInfo", 0))
return std::move(EC);
@ -144,12 +146,12 @@ Error PDBFileBuilder::commit(StringRef Filename) {
return EC;
}
uint32_t StringTableStreamNo = 0;
if (!NamedStreams.get("/names", StringTableStreamNo))
uint32_t PDBStringTableStreamNo = 0;
if (!NamedStreams.get("/names", PDBStringTableStreamNo))
return llvm::make_error<pdb::RawError>(raw_error_code::no_stream);
auto NS = WritableMappedBlockStream::createIndexedStream(Layout, Buffer,
StringTableStreamNo);
auto NS = WritableMappedBlockStream::createIndexedStream(
Layout, Buffer, PDBStringTableStreamNo);
BinaryStreamWriter NSWriter(*NS);
if (auto EC = Strings.commit(NSWriter))
return EC;

View File

@ -1,4 +1,5 @@
//===- StringTable.cpp - PDB String Table -----------------------*- C++ -*-===//
//===- PDBStringTable.cpp - PDB String Table -----------------------*- C++
//-*-===//
//
// The LLVM Compiler Infrastructure
//
@ -7,7 +8,7 @@
//
//===----------------------------------------------------------------------===//
#include "llvm/DebugInfo/PDB/Native/StringTable.h"
#include "llvm/DebugInfo/PDB/Native/PDBStringTable.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/DebugInfo/PDB/Native/Hash.h"
@ -20,16 +21,16 @@ using namespace llvm;
using namespace llvm::support;
using namespace llvm::pdb;
StringTable::StringTable() {}
PDBStringTable::PDBStringTable() {}
Error StringTable::load(BinaryStreamReader &Stream) {
Error PDBStringTable::load(BinaryStreamReader &Stream) {
ByteSize = Stream.getLength();
const StringTableHeader *H;
const PDBStringTableHeader *H;
if (auto EC = Stream.readObject(H))
return EC;
if (H->Signature != StringTableSignature)
if (H->Signature != PDBStringTableSignature)
return make_error<RawError>(raw_error_code::corrupt_file,
"Invalid hash table signature");
if (H->HashVersion != 1 && H->HashVersion != 2)
@ -61,16 +62,14 @@ Error StringTable::load(BinaryStreamReader &Stream) {
if (Stream.bytesRemaining() > 0)
return make_error<RawError>(raw_error_code::stream_too_long,
"Unexpected bytes found in string table");
"Unexpected bytes found in string table");
return Error::success();
}
uint32_t StringTable::getByteSize() const {
return ByteSize;
}
uint32_t PDBStringTable::getByteSize() const { return ByteSize; }
StringRef StringTable::getStringForID(uint32_t ID) const {
StringRef PDBStringTable::getStringForID(uint32_t ID) const {
if (ID == IDs[0])
return StringRef();
@ -85,7 +84,7 @@ StringRef StringTable::getStringForID(uint32_t ID) const {
return Result;
}
uint32_t StringTable::getIDForString(StringRef Str) const {
uint32_t PDBStringTable::getIDForString(StringRef Str) const {
uint32_t Hash = (HashVersion == 1) ? hashStringV1(Str) : hashStringV2(Str);
size_t Count = IDs.size();
uint32_t Start = Hash % Count;
@ -104,6 +103,6 @@ uint32_t StringTable::getIDForString(StringRef Str) const {
return IDs[0];
}
FixedStreamArray<support::ulittle32_t> StringTable::name_ids() const {
FixedStreamArray<support::ulittle32_t> PDBStringTable::name_ids() const {
return IDs;
}

View File

@ -1,4 +1,4 @@
//===- StringTableBuilder.cpp - PDB String Table ----------------*- C++ -*-===//
//===- PDBStringTableBuilder.cpp - PDB String Table -------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
#include "llvm/DebugInfo/PDB/Native/StringTableBuilder.h"
#include "llvm/DebugInfo/PDB/Native/PDBStringTableBuilder.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/DebugInfo/PDB/Native/Hash.h"
#include "llvm/DebugInfo/PDB/Native/RawTypes.h"
@ -19,7 +19,7 @@ using namespace llvm::support;
using namespace llvm::support::endian;
using namespace llvm::pdb;
uint32_t StringTableBuilder::insert(StringRef S) {
uint32_t PDBStringTableBuilder::insert(StringRef S) {
auto P = Strings.insert({S, StringSize});
// If a given string didn't exist in the string table, we want to increment
@ -29,7 +29,7 @@ uint32_t StringTableBuilder::insert(StringRef S) {
return P.first->second;
}
uint32_t StringTableBuilder::getStringIndex(StringRef S) {
uint32_t PDBStringTableBuilder::getStringIndex(StringRef S) {
auto Iter = Strings.find(S);
assert(Iter != Strings.end());
return Iter->second;
@ -44,9 +44,9 @@ static uint32_t computeBucketCount(uint32_t NumStrings) {
return (NumStrings + 1) * 1.25;
}
uint32_t StringTableBuilder::finalize() {
uint32_t PDBStringTableBuilder::finalize() {
uint32_t Size = 0;
Size += sizeof(StringTableHeader);
Size += sizeof(PDBStringTableHeader);
Size += StringSize;
Size += sizeof(uint32_t); // Hash table begins with 4-byte size field.
@ -58,10 +58,10 @@ uint32_t StringTableBuilder::finalize() {
return Size;
}
Error StringTableBuilder::commit(BinaryStreamWriter &Writer) const {
Error PDBStringTableBuilder::commit(BinaryStreamWriter &Writer) const {
// Write a header
StringTableHeader H;
H.Signature = StringTableSignature;
PDBStringTableHeader H;
H.Signature = PDBStringTableSignature;
H.HashVersion = 1;
H.ByteSize = StringSize;
if (auto EC = Writer.writeObject(H))

View File

@ -13,8 +13,8 @@
#include "llvm/DebugInfo/CodeView/ModuleDebugInlineeLinesFragment.h"
#include "llvm/DebugInfo/CodeView/ModuleDebugLineFragment.h"
#include "llvm/DebugInfo/PDB/Native/PDBFile.h"
#include "llvm/DebugInfo/PDB/Native/PDBStringTable.h"
#include "llvm/DebugInfo/PDB/Native/RawError.h"
#include "llvm/DebugInfo/PDB/Native/StringTable.h"
using namespace llvm;
using namespace llvm::codeview;

View File

@ -15,8 +15,8 @@
#include "llvm/DebugInfo/PDB/Native/Formatters.h"
#include "llvm/DebugInfo/PDB/Native/InfoStream.h"
#include "llvm/DebugInfo/PDB/Native/PDBFile.h"
#include "llvm/DebugInfo/PDB/Native/PDBStringTable.h"
#include "llvm/DebugInfo/PDB/Native/RawConstants.h"
#include "llvm/DebugInfo/PDB/Native/StringTable.h"
#include "llvm/Support/FormatAdapters.h"
#include "llvm/Support/FormatProviders.h"

View File

@ -47,9 +47,9 @@
#include "llvm/DebugInfo/PDB/Native/NativeSession.h"
#include "llvm/DebugInfo/PDB/Native/PDBFile.h"
#include "llvm/DebugInfo/PDB/Native/PDBFileBuilder.h"
#include "llvm/DebugInfo/PDB/Native/PDBStringTableBuilder.h"
#include "llvm/DebugInfo/PDB/Native/RawConstants.h"
#include "llvm/DebugInfo/PDB/Native/RawError.h"
#include "llvm/DebugInfo/PDB/Native/StringTableBuilder.h"
#include "llvm/DebugInfo/PDB/Native/TpiStream.h"
#include "llvm/DebugInfo/PDB/Native/TpiStreamBuilder.h"
#include "llvm/DebugInfo/PDB/PDB.h"
@ -427,7 +427,7 @@ static ExitOnError ExitOnErr;
static uint32_t
getFileChecksumOffset(StringRef FileName,
ModuleDebugFileChecksumFragment &Checksums,
StringTableBuilder &Strings) {
PDBStringTableBuilder &Strings) {
// The offset in the line info record is the offset of the checksum
// entry for the corresponding file. That entry then contains an
// offset into the global string table of the file name. So to

View File

@ -9,8 +9,8 @@
#include "ErrorChecking.h"
#include "llvm/DebugInfo/PDB/Native/StringTable.h"
#include "llvm/DebugInfo/PDB/Native/StringTableBuilder.h"
#include "llvm/DebugInfo/PDB/Native/PDBStringTable.h"
#include "llvm/DebugInfo/PDB/Native/PDBStringTableBuilder.h"
#include "llvm/Support/BinaryByteStream.h"
#include "llvm/Support/BinaryStreamReader.h"
#include "llvm/Support/BinaryStreamWriter.h"
@ -27,7 +27,7 @@ class StringTableBuilderTest : public ::testing::Test {};
TEST_F(StringTableBuilderTest, Simple) {
// Create /names table contents.
StringTableBuilder Builder;
PDBStringTableBuilder Builder;
EXPECT_EQ(1U, Builder.insert("foo"));
EXPECT_EQ(5U, Builder.insert("bar"));
EXPECT_EQ(1U, Builder.insert("foo"));
@ -41,7 +41,7 @@ TEST_F(StringTableBuilderTest, Simple) {
// Reads the contents back.
BinaryByteStream InStream(Buffer, little);
BinaryStreamReader Reader(InStream);
StringTable Table;
PDBStringTable Table;
EXPECT_NO_ERROR(Table.load(Reader));
EXPECT_EQ(3U, Table.getNameCount());