#include "llvm/DebugInfo/PDB/Native/InfoStreamBuilder.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/PDBTypeServerHandler.h"
-#include "llvm/DebugInfo/PDB/Native/StringTableBuilder.h"
#include "llvm/DebugInfo/PDB/Native/TpiStream.h"
#include "llvm/DebugInfo/PDB/Native/TpiStreamBuilder.h"
#include "llvm/Object/COFF.h"
#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"
std::unique_ptr<msf::MappedBlockStream> Stream;
std::vector<ModuleInfoEx> ModuleInfos;
- StringTable ECNames;
+ PDBStringTable ECNames;
BinaryStreamRef ModInfoSubstream;
BinaryStreamRef SecContrSubstream;
class DbiStream;
class GlobalsStream;
class InfoStream;
-class StringTable;
+class PDBStringTable;
class PDBFileBuilder;
class PublicsStream;
class SymbolStream;
Expected<TpiStream &> getPDBIpiStream();
Expected<PublicsStream &> getPDBPublicsStream();
Expected<SymbolStream &> getPDBSymbolStream();
- Expected<StringTable &> getStringTable();
+ Expected<PDBStringTable &> getStringTable();
BumpPtrAllocator &getAllocator() { return Allocator; }
bool hasPDBPublicsStream();
bool hasPDBSymbolStream();
bool hasPDBTpiStream() const;
- bool hasStringTable();
+ bool hasPDBStringTable();
private:
Expected<std::unique_ptr<msf::MappedBlockStream>>
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;
};
}
}
#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"
DbiStreamBuilder &getDbiBuilder();
TpiStreamBuilder &getTpiBuilder();
TpiStreamBuilder &getIpiBuilder();
- StringTableBuilder &getStringTableBuilder();
+ PDBStringTableBuilder &getStringTableBuilder();
Error commit(StringRef Filename);
std::unique_ptr<TpiStreamBuilder> Tpi;
std::unique_ptr<TpiStreamBuilder> Ipi;
- StringTableBuilder Strings;
+ PDBStringTableBuilder Strings;
NamedStreamMap NamedStreams;
};
}
-//===- StringTable.h - PDB String Table -------------------------*- C++ -*-===//
+//===- PDBStringTable.h - PDB String Table -------------------------*- C++
+//-*-===//
//
// The LLVM Compiler Infrastructure
//
//
//===----------------------------------------------------------------------===//
-#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"
namespace pdb {
-class StringTable {
+class PDBStringTable {
public:
- StringTable();
+ PDBStringTable();
Error load(BinaryStreamReader &Stream);
-//===- StringTableBuilder.h - PDB String Table Builder ----------*- C++ -*-===//
+//===- PDBStringTableBuilder.h - PDB String Table Builder -------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
//
//===----------------------------------------------------------------------===//
-#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"
namespace pdb {
-class StringTableBuilder {
+class PDBStringTableBuilder {
public:
// If string S does not exist in the string table, insert it.
// Returns the ID for S.
} // end namespace pdb
} // end namespace llvm
-#endif // LLVM_DEBUGINFO_PDB_RAW_STRINGTABLEBUILDER_H
+#endif // LLVM_DEBUGINFO_PDB_RAW_PDBSTRINGTABLEBUILDER_H
};
/// 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
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
#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"
return *Symbols;
}
-Expected<StringTable &> PDBFile::getStringTable() {
- if (!Strings || !StringTableStream) {
+Expected<PDBStringTable &> PDBFile::getStringTable() {
+ if (!Strings || !PDBStringTableStream) {
auto IS = getPDBInfoStream();
if (!IS)
return IS.takeError();
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;
}
bool PDBFile::hasPDBTpiStream() const { return StreamTPI < getNumStreams(); }
-bool PDBFile::hasStringTable() {
+bool PDBFile::hasPDBStringTable() {
auto IS = getPDBInfoStream();
if (!IS)
return false;
#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"
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);
}
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);
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;
-//===- StringTable.cpp - PDB String Table -----------------------*- C++ -*-===//
+//===- PDBStringTable.cpp - PDB String Table -----------------------*- C++
+//-*-===//
//
// The LLVM Compiler Infrastructure
//
//
//===----------------------------------------------------------------------===//
-#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"
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)
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();
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;
return IDs[0];
}
-FixedStreamArray<support::ulittle32_t> StringTable::name_ids() const {
+FixedStreamArray<support::ulittle32_t> PDBStringTable::name_ids() const {
return IDs;
}
-//===- StringTableBuilder.cpp - PDB String Table ----------------*- C++ -*-===//
+//===- PDBStringTableBuilder.cpp - PDB String Table -------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
//
//===----------------------------------------------------------------------===//
-#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"
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
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;
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.
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))
#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;
#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"
#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"
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
#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"
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"));
// 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());