aboutsummaryrefslogtreecommitdiff
path: root/llvm/include/llvm/DebugInfo/CodeView
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/include/llvm/DebugInfo/CodeView')
-rw-r--r--llvm/include/llvm/DebugInfo/CodeView/AppendingTypeTableBuilder.h3
-rw-r--r--llvm/include/llvm/DebugInfo/CodeView/CodeViewRecordIO.h14
-rw-r--r--llvm/include/llvm/DebugInfo/CodeView/ContinuationRecordBuilder.h1
-rw-r--r--llvm/include/llvm/DebugInfo/CodeView/DebugSubsectionRecord.h23
-rw-r--r--llvm/include/llvm/DebugInfo/CodeView/GlobalTypeTableBuilder.h8
-rw-r--r--llvm/include/llvm/DebugInfo/CodeView/LazyRandomTypeCollection.h1
-rw-r--r--llvm/include/llvm/DebugInfo/CodeView/MergingTypeTableBuilder.h3
-rw-r--r--llvm/include/llvm/DebugInfo/CodeView/SimpleTypeSerializer.h16
-rw-r--r--llvm/include/llvm/DebugInfo/CodeView/SymbolRecord.h7
-rw-r--r--llvm/include/llvm/DebugInfo/CodeView/TypeCollection.h1
-rw-r--r--llvm/include/llvm/DebugInfo/CodeView/TypeSymbolEmitter.h4
-rw-r--r--llvm/include/llvm/DebugInfo/CodeView/TypeTableCollection.h1
12 files changed, 38 insertions, 44 deletions
diff --git a/llvm/include/llvm/DebugInfo/CodeView/AppendingTypeTableBuilder.h b/llvm/include/llvm/DebugInfo/CodeView/AppendingTypeTableBuilder.h
index 0ac8b651939d..3867d78d078a 100644
--- a/llvm/include/llvm/DebugInfo/CodeView/AppendingTypeTableBuilder.h
+++ b/llvm/include/llvm/DebugInfo/CodeView/AppendingTypeTableBuilder.h
@@ -38,7 +38,7 @@ public:
explicit AppendingTypeTableBuilder(BumpPtrAllocator &Storage);
~AppendingTypeTableBuilder();
- // TypeTableCollection overrides
+ // TypeCollection overrides
Optional<TypeIndex> getFirst() override;
Optional<TypeIndex> getNext(TypeIndex Prev) override;
CVType getType(TypeIndex Index) override;
@@ -46,6 +46,7 @@ public:
bool contains(TypeIndex Index) override;
uint32_t size() override;
uint32_t capacity() override;
+ bool replaceType(TypeIndex &Index, CVType Data, bool Stabilize) override;
// public interface
void reset();
diff --git a/llvm/include/llvm/DebugInfo/CodeView/CodeViewRecordIO.h b/llvm/include/llvm/DebugInfo/CodeView/CodeViewRecordIO.h
index 60829a51dc25..f26e80ebe2a9 100644
--- a/llvm/include/llvm/DebugInfo/CodeView/CodeViewRecordIO.h
+++ b/llvm/include/llvm/DebugInfo/CodeView/CodeViewRecordIO.h
@@ -29,9 +29,9 @@ namespace codeview {
class CodeViewRecordStreamer {
public:
- virtual void EmitBytes(StringRef Data) = 0;
- virtual void EmitIntValue(uint64_t Value, unsigned Size) = 0;
- virtual void EmitBinaryData(StringRef Data) = 0;
+ virtual void emitBytes(StringRef Data) = 0;
+ virtual void emitIntValue(uint64_t Value, unsigned Size) = 0;
+ virtual void emitBinaryData(StringRef Data) = 0;
virtual void AddComment(const Twine &T) = 0;
virtual void AddRawComment(const Twine &T) = 0;
virtual bool isVerboseAsm() = 0;
@@ -81,7 +81,7 @@ public:
if (isStreaming()) {
StringRef BytesSR =
StringRef((reinterpret_cast<const char *>(&Value)), sizeof(Value));
- Streamer->EmitBytes(BytesSR);
+ Streamer->emitBytes(BytesSR);
incrStreamedLen(sizeof(T));
return Error::success();
}
@@ -99,7 +99,7 @@ public:
template <typename T> Error mapInteger(T &Value, const Twine &Comment = "") {
if (isStreaming()) {
emitComment(Comment);
- Streamer->EmitIntValue((int)Value, sizeof(T));
+ Streamer->emitIntValue((int)Value, sizeof(T));
incrStreamedLen(sizeof(T));
return Error::success();
}
@@ -114,7 +114,7 @@ public:
if (!isStreaming() && sizeof(Value) > maxFieldLength())
return make_error<CodeViewError>(cv_error_code::insufficient_buffer);
- using U = typename std::underlying_type<T>::type;
+ using U = std::underlying_type_t<T>;
U X;
if (isWriting() || isStreaming())
@@ -145,7 +145,7 @@ public:
if (isStreaming()) {
Size = static_cast<SizeType>(Items.size());
emitComment(Comment);
- Streamer->EmitIntValue(Size, sizeof(Size));
+ Streamer->emitIntValue(Size, sizeof(Size));
incrStreamedLen(sizeof(Size)); // add 1 for the delimiter
for (auto &X : Items) {
diff --git a/llvm/include/llvm/DebugInfo/CodeView/ContinuationRecordBuilder.h b/llvm/include/llvm/DebugInfo/CodeView/ContinuationRecordBuilder.h
index 53ab2dd04aa7..0e2f5d90e243 100644
--- a/llvm/include/llvm/DebugInfo/CodeView/ContinuationRecordBuilder.h
+++ b/llvm/include/llvm/DebugInfo/CodeView/ContinuationRecordBuilder.h
@@ -18,7 +18,6 @@
#include "llvm/DebugInfo/CodeView/TypeRecord.h"
#include "llvm/DebugInfo/CodeView/TypeRecordMapping.h"
#include "llvm/DebugInfo/CodeView/TypeVisitorCallbacks.h"
-#include "llvm/Support/Allocator.h"
#include "llvm/Support/BinaryByteStream.h"
#include "llvm/Support/BinaryStreamWriter.h"
#include "llvm/Support/Error.h"
diff --git a/llvm/include/llvm/DebugInfo/CodeView/DebugSubsectionRecord.h b/llvm/include/llvm/DebugInfo/CodeView/DebugSubsectionRecord.h
index bcb379f00d68..e915d8a5830c 100644
--- a/llvm/include/llvm/DebugInfo/CodeView/DebugSubsectionRecord.h
+++ b/llvm/include/llvm/DebugInfo/CodeView/DebugSubsectionRecord.h
@@ -35,44 +35,38 @@ struct DebugSubsectionHeader {
class DebugSubsectionRecord {
public:
DebugSubsectionRecord();
- DebugSubsectionRecord(DebugSubsectionKind Kind, BinaryStreamRef Data,
- CodeViewContainer Container);
+ DebugSubsectionRecord(DebugSubsectionKind Kind, BinaryStreamRef Data);
- static Error initialize(BinaryStreamRef Stream, DebugSubsectionRecord &Info,
- CodeViewContainer Container);
+ static Error initialize(BinaryStreamRef Stream, DebugSubsectionRecord &Info);
uint32_t getRecordLength() const;
DebugSubsectionKind kind() const;
BinaryStreamRef getRecordData() const;
private:
- CodeViewContainer Container = CodeViewContainer::ObjectFile;
DebugSubsectionKind Kind = DebugSubsectionKind::None;
BinaryStreamRef Data;
};
class DebugSubsectionRecordBuilder {
public:
- DebugSubsectionRecordBuilder(std::shared_ptr<DebugSubsection> Subsection,
- CodeViewContainer Container);
+ DebugSubsectionRecordBuilder(std::shared_ptr<DebugSubsection> Subsection);
/// Use this to copy existing subsections directly from source to destination.
/// For example, line table subsections in an object file only need to be
/// relocated before being copied into the PDB.
- DebugSubsectionRecordBuilder(const DebugSubsectionRecord &Contents,
- CodeViewContainer Container);
+ DebugSubsectionRecordBuilder(const DebugSubsectionRecord &Contents);
- uint32_t calculateSerializedLength();
- Error commit(BinaryStreamWriter &Writer) const;
+ uint32_t calculateSerializedLength() const;
+ Error commit(BinaryStreamWriter &Writer, CodeViewContainer Container) const;
private:
/// The subsection to build. Will be null if Contents is non-empty.
std::shared_ptr<DebugSubsection> Subsection;
/// The bytes of the subsection. Only non-empty if Subsection is null.
+ /// FIXME: Reduce the size of this.
DebugSubsectionRecord Contents;
-
- CodeViewContainer Container;
};
} // end namespace codeview
@@ -83,8 +77,7 @@ template <> struct VarStreamArrayExtractor<codeview::DebugSubsectionRecord> {
// FIXME: We need to pass the container type through to this function. In
// practice this isn't super important since the subsection header describes
// its length and we can just skip it. It's more important when writing.
- if (auto EC = codeview::DebugSubsectionRecord::initialize(
- Stream, Info, codeview::CodeViewContainer::Pdb))
+ if (auto EC = codeview::DebugSubsectionRecord::initialize(Stream, Info))
return EC;
Length = alignTo(Info.getRecordLength(), 4);
return Error::success();
diff --git a/llvm/include/llvm/DebugInfo/CodeView/GlobalTypeTableBuilder.h b/llvm/include/llvm/DebugInfo/CodeView/GlobalTypeTableBuilder.h
index 3b103c227708..8c22eaf8b2d7 100644
--- a/llvm/include/llvm/DebugInfo/CodeView/GlobalTypeTableBuilder.h
+++ b/llvm/include/llvm/DebugInfo/CodeView/GlobalTypeTableBuilder.h
@@ -50,7 +50,7 @@ public:
explicit GlobalTypeTableBuilder(BumpPtrAllocator &Storage);
~GlobalTypeTableBuilder();
- // TypeTableCollection overrides
+ // TypeCollection overrides
Optional<TypeIndex> getFirst() override;
Optional<TypeIndex> getNext(TypeIndex Prev) override;
CVType getType(TypeIndex Index) override;
@@ -58,6 +58,7 @@ public:
bool contains(TypeIndex Index) override;
uint32_t size() override;
uint32_t capacity() override;
+ bool replaceType(TypeIndex &Index, CVType Data, bool Stabilize) override;
// public interface
void reset();
@@ -71,6 +72,11 @@ public:
template <typename CreateFunc>
TypeIndex insertRecordAs(GloballyHashedType Hash, size_t RecordSize,
CreateFunc Create) {
+ assert(RecordSize < UINT32_MAX && "Record too big");
+ assert(RecordSize % 4 == 0 &&
+ "RecordSize is not a multiple of 4 bytes which will cause "
+ "misalignment in the output TPI stream!");
+
auto Result = HashedRecords.try_emplace(Hash, nextTypeIndex());
if (LLVM_UNLIKELY(Result.second /*inserted*/ ||
diff --git a/llvm/include/llvm/DebugInfo/CodeView/LazyRandomTypeCollection.h b/llvm/include/llvm/DebugInfo/CodeView/LazyRandomTypeCollection.h
index 4e03627e9580..35eeef5a327e 100644
--- a/llvm/include/llvm/DebugInfo/CodeView/LazyRandomTypeCollection.h
+++ b/llvm/include/llvm/DebugInfo/CodeView/LazyRandomTypeCollection.h
@@ -79,6 +79,7 @@ public:
uint32_t capacity() override;
Optional<TypeIndex> getFirst() override;
Optional<TypeIndex> getNext(TypeIndex Prev) override;
+ bool replaceType(TypeIndex &Index, CVType Data, bool Stabilize) override;
private:
Error ensureTypeExists(TypeIndex Index);
diff --git a/llvm/include/llvm/DebugInfo/CodeView/MergingTypeTableBuilder.h b/llvm/include/llvm/DebugInfo/CodeView/MergingTypeTableBuilder.h
index 1b2f6d29a9b6..2f3d7a98e989 100644
--- a/llvm/include/llvm/DebugInfo/CodeView/MergingTypeTableBuilder.h
+++ b/llvm/include/llvm/DebugInfo/CodeView/MergingTypeTableBuilder.h
@@ -47,7 +47,7 @@ public:
explicit MergingTypeTableBuilder(BumpPtrAllocator &Storage);
~MergingTypeTableBuilder();
- // TypeTableCollection overrides
+ // TypeCollection overrides
Optional<TypeIndex> getFirst() override;
Optional<TypeIndex> getNext(TypeIndex Prev) override;
CVType getType(TypeIndex Index) override;
@@ -55,6 +55,7 @@ public:
bool contains(TypeIndex Index) override;
uint32_t size() override;
uint32_t capacity() override;
+ bool replaceType(TypeIndex &Index, CVType Data, bool Stabilize) override;
// public interface
void reset();
diff --git a/llvm/include/llvm/DebugInfo/CodeView/SimpleTypeSerializer.h b/llvm/include/llvm/DebugInfo/CodeView/SimpleTypeSerializer.h
index 3ca09b445a30..fcc0452a6ae9 100644
--- a/llvm/include/llvm/DebugInfo/CodeView/SimpleTypeSerializer.h
+++ b/llvm/include/llvm/DebugInfo/CodeView/SimpleTypeSerializer.h
@@ -10,25 +10,11 @@
#define LLVM_DEBUGINFO_CODEVIEW_SIMPLETYPESERIALIZER_H
#include "llvm/ADT/ArrayRef.h"
-#include "llvm/ADT/Optional.h"
-#include "llvm/ADT/SmallVector.h"
-#include "llvm/DebugInfo/CodeView/CodeView.h"
-#include "llvm/DebugInfo/CodeView/RecordSerialization.h"
-#include "llvm/DebugInfo/CodeView/TypeIndex.h"
-#include "llvm/DebugInfo/CodeView/TypeRecord.h"
-#include "llvm/DebugInfo/CodeView/TypeRecordMapping.h"
-#include "llvm/DebugInfo/CodeView/TypeVisitorCallbacks.h"
-#include "llvm/Support/Allocator.h"
-#include "llvm/Support/BinaryByteStream.h"
-#include "llvm/Support/BinaryStreamWriter.h"
-#include "llvm/Support/Error.h"
-#include <cassert>
-#include <cstdint>
-#include <memory>
#include <vector>
namespace llvm {
namespace codeview {
+class FieldListRecord;
class SimpleTypeSerializer {
std::vector<uint8_t> ScratchBuffer;
diff --git a/llvm/include/llvm/DebugInfo/CodeView/SymbolRecord.h b/llvm/include/llvm/DebugInfo/CodeView/SymbolRecord.h
index 1fcef9dd06c8..4383534b0db2 100644
--- a/llvm/include/llvm/DebugInfo/CodeView/SymbolRecord.h
+++ b/llvm/include/llvm/DebugInfo/CodeView/SymbolRecord.h
@@ -350,6 +350,13 @@ public:
uint32_t RecordOffset = 0;
};
+struct PublicSym32Header {
+ ulittle32_t Flags;
+ ulittle32_t Offset;
+ ulittle16_t Segment;
+ // char Name[];
+};
+
// S_PUB32
class PublicSym32 : public SymbolRecord {
public:
diff --git a/llvm/include/llvm/DebugInfo/CodeView/TypeCollection.h b/llvm/include/llvm/DebugInfo/CodeView/TypeCollection.h
index 58b1dd058c1a..102d68c3fb2a 100644
--- a/llvm/include/llvm/DebugInfo/CodeView/TypeCollection.h
+++ b/llvm/include/llvm/DebugInfo/CodeView/TypeCollection.h
@@ -30,6 +30,7 @@ public:
virtual bool contains(TypeIndex Index) = 0;
virtual uint32_t size() = 0;
virtual uint32_t capacity() = 0;
+ virtual bool replaceType(TypeIndex &Index, CVType Data, bool Stabilize) = 0;
template <typename TFunc> void ForEachRecord(TFunc Func) {
Optional<TypeIndex> Next = getFirst();
diff --git a/llvm/include/llvm/DebugInfo/CodeView/TypeSymbolEmitter.h b/llvm/include/llvm/DebugInfo/CodeView/TypeSymbolEmitter.h
index 4f2e5deb10b4..01525d06d1cd 100644
--- a/llvm/include/llvm/DebugInfo/CodeView/TypeSymbolEmitter.h
+++ b/llvm/include/llvm/DebugInfo/CodeView/TypeSymbolEmitter.h
@@ -9,13 +9,11 @@
#ifndef LLVM_DEBUGINFO_CODEVIEW_TYPESYMBOLEMITTER_H
#define LLVM_DEBUGINFO_CODEVIEW_TYPESYMBOLEMITTER_H
-#include "llvm/DebugInfo/CodeView/CodeView.h"
-#include "llvm/DebugInfo/CodeView/TypeIndex.h"
-
namespace llvm {
class StringRef;
namespace codeview {
+class TypeIndex;
class TypeSymbolEmitter {
private:
diff --git a/llvm/include/llvm/DebugInfo/CodeView/TypeTableCollection.h b/llvm/include/llvm/DebugInfo/CodeView/TypeTableCollection.h
index 5cbe3400e029..c3008742d2e1 100644
--- a/llvm/include/llvm/DebugInfo/CodeView/TypeTableCollection.h
+++ b/llvm/include/llvm/DebugInfo/CodeView/TypeTableCollection.h
@@ -29,6 +29,7 @@ public:
bool contains(TypeIndex Index) override;
uint32_t size() override;
uint32_t capacity() override;
+ bool replaceType(TypeIndex &Index, CVType Data, bool Stabilize) override;
private:
BumpPtrAllocator Allocator;