summaryrefslogtreecommitdiff
path: root/include/llvm/DebugInfo
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-07-01 13:22:02 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-07-01 13:22:02 +0000
commit9df3605dea17e84f8183581f6103bd0c79e2a606 (patch)
tree70a2f36ce9eb9bb213603cd7f2f120af53fc176f /include/llvm/DebugInfo
parent08bbd35a80bf7765fe0d3043f9eb5a2f2786b649 (diff)
Notes
Diffstat (limited to 'include/llvm/DebugInfo')
-rw-r--r--include/llvm/DebugInfo/CodeView/CVSymbolVisitor.h2
-rw-r--r--include/llvm/DebugInfo/CodeView/DebugChecksumsSubsection.h32
-rw-r--r--include/llvm/DebugInfo/CodeView/DebugCrossExSubsection.h18
-rw-r--r--include/llvm/DebugInfo/CodeView/DebugCrossImpSubsection.h31
-rw-r--r--include/llvm/DebugInfo/CodeView/DebugInlineeLinesSubsection.h32
-rw-r--r--include/llvm/DebugInfo/CodeView/DebugLinesSubsection.h25
-rw-r--r--include/llvm/DebugInfo/CodeView/DebugStringTableSubsection.h14
-rw-r--r--include/llvm/DebugInfo/CodeView/DebugSubsectionRecord.h30
-rw-r--r--include/llvm/DebugInfo/CodeView/DebugSymbolRVASubsection.h18
-rw-r--r--include/llvm/DebugInfo/CodeView/EnumTables.h11
-rw-r--r--include/llvm/DebugInfo/CodeView/Formatters.h24
-rw-r--r--include/llvm/DebugInfo/CodeView/LazyRandomTypeCollection.h11
-rw-r--r--include/llvm/DebugInfo/CodeView/StringsAndChecksums.h22
-rw-r--r--include/llvm/DebugInfo/CodeView/SymbolDeserializer.h4
-rw-r--r--include/llvm/DebugInfo/CodeView/SymbolRecord.h19
-rw-r--r--include/llvm/DebugInfo/CodeView/SymbolSerializer.h32
-rw-r--r--include/llvm/DebugInfo/CodeView/SymbolVisitorCallbackPipeline.h8
-rw-r--r--include/llvm/DebugInfo/CodeView/SymbolVisitorCallbacks.h6
-rw-r--r--include/llvm/DebugInfo/CodeView/TypeIndexDiscovery.h2
-rw-r--r--include/llvm/DebugInfo/CodeView/TypeRecord.h30
-rw-r--r--include/llvm/DebugInfo/CodeView/TypeSerializer.h29
-rw-r--r--include/llvm/DebugInfo/CodeView/TypeServerHandler.h12
-rw-r--r--include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h23
-rw-r--r--include/llvm/DebugInfo/DWARF/DWARFCompileUnit.h4
-rw-r--r--include/llvm/DebugInfo/DWARF/DWARFContext.h20
-rw-r--r--include/llvm/DebugInfo/DWARF/DWARFDataExtractor.h48
-rw-r--r--include/llvm/DebugInfo/DWARF/DWARFDebugInfoEntry.h4
-rw-r--r--include/llvm/DebugInfo/DWARF/DWARFDebugLine.h13
-rw-r--r--include/llvm/DebugInfo/DWARF/DWARFDebugLoc.h11
-rw-r--r--include/llvm/DebugInfo/DWARF/DWARFDebugRangeList.h4
-rw-r--r--include/llvm/DebugInfo/DWARF/DWARFFormValue.h11
-rw-r--r--include/llvm/DebugInfo/DWARF/DWARFTypeUnit.h2
-rw-r--r--include/llvm/DebugInfo/DWARF/DWARFUnit.h21
-rw-r--r--include/llvm/DebugInfo/PDB/IPDBDataStream.h16
-rw-r--r--include/llvm/DebugInfo/PDB/IPDBEnumChildren.h4
-rw-r--r--include/llvm/DebugInfo/PDB/Native/DbiModuleList.h22
-rw-r--r--include/llvm/DebugInfo/PDB/Native/Hash.h14
-rw-r--r--include/llvm/DebugInfo/PDB/Native/HashTable.h25
-rw-r--r--include/llvm/DebugInfo/PDB/Native/ModuleDebugStream.h23
-rw-r--r--include/llvm/DebugInfo/PDB/Native/ModuleDebugStreamBuilder.h0
-rw-r--r--include/llvm/DebugInfo/PDB/Native/NamedStreamMap.h15
-rw-r--r--include/llvm/DebugInfo/PDB/Native/NativeRawSymbol.h12
-rw-r--r--include/llvm/DebugInfo/PDB/Native/NativeSession.h10
-rw-r--r--include/llvm/DebugInfo/PDB/PDB.h16
-rw-r--r--include/llvm/DebugInfo/PDB/PDBExtras.h18
-rw-r--r--include/llvm/DebugInfo/PDB/PDBTypes.h45
-rw-r--r--include/llvm/DebugInfo/PDB/UDTLayout.h43
47 files changed, 500 insertions, 336 deletions
diff --git a/include/llvm/DebugInfo/CodeView/CVSymbolVisitor.h b/include/llvm/DebugInfo/CodeView/CVSymbolVisitor.h
index b2d3f5ea34a84..7c8cd121751a2 100644
--- a/include/llvm/DebugInfo/CodeView/CVSymbolVisitor.h
+++ b/include/llvm/DebugInfo/CodeView/CVSymbolVisitor.h
@@ -25,7 +25,9 @@ public:
CVSymbolVisitor(SymbolVisitorCallbacks &Callbacks);
Error visitSymbolRecord(CVSymbol &Record);
+ Error visitSymbolRecord(CVSymbol &Record, uint32_t Offset);
Error visitSymbolStream(const CVSymbolArray &Symbols);
+ Error visitSymbolStream(const CVSymbolArray &Symbols, uint32_t InitialOffset);
private:
SymbolVisitorCallbacks &Callbacks;
diff --git a/include/llvm/DebugInfo/CodeView/DebugChecksumsSubsection.h b/include/llvm/DebugInfo/CodeView/DebugChecksumsSubsection.h
index 9fc90f13d3473..78b284563afd9 100644
--- a/include/llvm/DebugInfo/CodeView/DebugChecksumsSubsection.h
+++ b/include/llvm/DebugInfo/CodeView/DebugChecksumsSubsection.h
@@ -12,13 +12,19 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/DebugInfo/CodeView/CodeView.h"
#include "llvm/DebugInfo/CodeView/DebugSubsection.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/BinaryStreamArray.h"
#include "llvm/Support/BinaryStreamReader.h"
-#include "llvm/Support/Endian.h"
+#include "llvm/Support/BinaryStreamRef.h"
+#include "llvm/Support/Error.h"
+#include <cstdint>
+#include <vector>
namespace llvm {
+
namespace codeview {
class DebugStringTableSubsection;
@@ -28,24 +34,22 @@ struct FileChecksumEntry {
FileChecksumKind Kind; // The type of checksum.
ArrayRef<uint8_t> Checksum; // The bytes of the checksum.
};
-}
-}
-namespace llvm {
+} // end namespace codeview
+
template <> struct VarStreamArrayExtractor<codeview::FileChecksumEntry> {
public:
- typedef void ContextType;
+ using ContextType = void;
Error operator()(BinaryStreamRef Stream, uint32_t &Len,
codeview::FileChecksumEntry &Item);
};
-}
-namespace llvm {
namespace codeview {
+
class DebugChecksumsSubsectionRef final : public DebugSubsectionRef {
- typedef VarStreamArray<codeview::FileChecksumEntry> FileChecksumArray;
- typedef FileChecksumArray::Iterator Iterator;
+ using FileChecksumArray = VarStreamArray<codeview::FileChecksumEntry>;
+ using Iterator = FileChecksumArray::Iterator;
public:
DebugChecksumsSubsectionRef()
@@ -89,10 +93,12 @@ private:
DenseMap<uint32_t, uint32_t> OffsetMap;
uint32_t SerializedSize = 0;
- llvm::BumpPtrAllocator Storage;
+ BumpPtrAllocator Storage;
std::vector<FileChecksumEntry> Checksums;
};
-}
-}
-#endif
+} // end namespace codeview
+
+} // end namespace llvm
+
+#endif // LLVM_DEBUGINFO_CODEVIEW_DEBUGCHECKSUMSSUBSECTION_H
diff --git a/include/llvm/DebugInfo/CodeView/DebugCrossExSubsection.h b/include/llvm/DebugInfo/CodeView/DebugCrossExSubsection.h
index f755b23422c77..2f9e9814d998d 100644
--- a/include/llvm/DebugInfo/CodeView/DebugCrossExSubsection.h
+++ b/include/llvm/DebugInfo/CodeView/DebugCrossExSubsection.h
@@ -10,18 +10,21 @@
#ifndef LLVM_DEBUGINFO_CODEVIEW_DEBUGCROSSEXSUBSECTION_H
#define LLVM_DEBUGINFO_CODEVIEW_DEBUGCROSSEXSUBSECTION_H
+#include "llvm/DebugInfo/CodeView/CodeView.h"
#include "llvm/DebugInfo/CodeView/DebugSubsection.h"
#include "llvm/Support/BinaryStreamArray.h"
#include "llvm/Support/BinaryStreamReader.h"
-#include "llvm/Support/Endian.h"
-
+#include "llvm/Support/BinaryStreamRef.h"
+#include "llvm/Support/Error.h"
+#include <cstdint>
#include <map>
namespace llvm {
namespace codeview {
+
class DebugCrossModuleExportsSubsectionRef final : public DebugSubsectionRef {
- typedef FixedStreamArray<CrossModuleExport> ReferenceArray;
- typedef ReferenceArray::Iterator Iterator;
+ using ReferenceArray = FixedStreamArray<CrossModuleExport>;
+ using Iterator = ReferenceArray::Iterator;
public:
DebugCrossModuleExportsSubsectionRef()
@@ -58,7 +61,8 @@ public:
private:
std::map<uint32_t, uint32_t> Mappings;
};
-}
-}
-#endif
+} // end namespace codeview
+} // end namespace llvm
+
+#endif // LLVM_DEBUGINFO_CODEVIEW_DEBUGCROSSEXSUBSECTION_H
diff --git a/include/llvm/DebugInfo/CodeView/DebugCrossImpSubsection.h b/include/llvm/DebugInfo/CodeView/DebugCrossImpSubsection.h
index ea3a9a43d50b3..8be7ef265c82e 100644
--- a/include/llvm/DebugInfo/CodeView/DebugCrossImpSubsection.h
+++ b/include/llvm/DebugInfo/CodeView/DebugCrossImpSubsection.h
@@ -11,38 +11,43 @@
#define LLVM_DEBUGINFO_CODEVIEW_DEBUGCROSSIMPSUBSECTION_H
#include "llvm/ADT/StringMap.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/DebugInfo/CodeView/CodeView.h"
#include "llvm/DebugInfo/CodeView/DebugSubsection.h"
#include "llvm/Support/BinaryStreamArray.h"
#include "llvm/Support/BinaryStreamReader.h"
+#include "llvm/Support/BinaryStreamRef.h"
#include "llvm/Support/Endian.h"
+#include "llvm/Support/Error.h"
+#include <cstdint>
+#include <vector>
namespace llvm {
+
namespace codeview {
struct CrossModuleImportItem {
const CrossModuleImport *Header = nullptr;
- llvm::FixedStreamArray<support::ulittle32_t> Imports;
+ FixedStreamArray<support::ulittle32_t> Imports;
};
-}
-}
-namespace llvm {
+} // end namespace codeview
+
template <> struct VarStreamArrayExtractor<codeview::CrossModuleImportItem> {
public:
- typedef void ContextType;
+ using ContextType = void;
Error operator()(BinaryStreamRef Stream, uint32_t &Len,
codeview::CrossModuleImportItem &Item);
};
-}
-namespace llvm {
namespace codeview {
+
class DebugStringTableSubsection;
class DebugCrossModuleImportsSubsectionRef final : public DebugSubsectionRef {
- typedef VarStreamArray<CrossModuleImportItem> ReferenceArray;
- typedef ReferenceArray::Iterator Iterator;
+ using ReferenceArray = VarStreamArray<CrossModuleImportItem>;
+ using Iterator = ReferenceArray::Iterator;
public:
DebugCrossModuleImportsSubsectionRef()
@@ -82,7 +87,9 @@ private:
DebugStringTableSubsection &Strings;
StringMap<std::vector<support::ulittle32_t>> Mappings;
};
-}
-}
-#endif
+} // end namespace codeview
+
+} // end namespace llvm
+
+#endif // LLVM_DEBUGINFO_CODEVIEW_DEBUGCROSSIMPSUBSECTION_H
diff --git a/include/llvm/DebugInfo/CodeView/DebugInlineeLinesSubsection.h b/include/llvm/DebugInfo/CodeView/DebugInlineeLinesSubsection.h
index 7484af6631051..b88c0eae1de28 100644
--- a/include/llvm/DebugInfo/CodeView/DebugInlineeLinesSubsection.h
+++ b/include/llvm/DebugInfo/CodeView/DebugInlineeLinesSubsection.h
@@ -7,19 +7,26 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_DEBUGINFO_CODEVIEW_BUGINLINEELINESSUBSECTION_H
-#define LLVM_DEBUGINFO_CODEVIEW_BUGINLINEELINESSUBSECTION_H
+#ifndef LLVM_DEBUGINFO_CODEVIEW_DEBUGINLINEELINESSUBSECTION_H
+#define LLVM_DEBUGINFO_CODEVIEW_DEBUGINLINEELINESSUBSECTION_H
+#include "llvm/ADT/StringRef.h"
+#include "llvm/DebugInfo/CodeView/CodeView.h"
#include "llvm/DebugInfo/CodeView/DebugSubsection.h"
#include "llvm/DebugInfo/CodeView/Line.h"
+#include "llvm/DebugInfo/CodeView/TypeIndex.h"
#include "llvm/Support/BinaryStreamArray.h"
#include "llvm/Support/BinaryStreamReader.h"
+#include "llvm/Support/BinaryStreamRef.h"
+#include "llvm/Support/Endian.h"
#include "llvm/Support/Error.h"
+#include <cstdint>
+#include <vector>
namespace llvm {
+
namespace codeview {
-class DebugInlineeLinesSubsectionRef;
class DebugChecksumsSubsection;
enum class InlineeLinesSignature : uint32_t {
@@ -40,18 +47,21 @@ struct InlineeSourceLine {
const InlineeSourceLineHeader *Header;
FixedStreamArray<support::ulittle32_t> ExtraFiles;
};
-}
+
+} // end namespace codeview
template <> struct VarStreamArrayExtractor<codeview::InlineeSourceLine> {
Error operator()(BinaryStreamRef Stream, uint32_t &Len,
codeview::InlineeSourceLine &Item);
+
bool HasExtraFiles = false;
};
namespace codeview {
+
class DebugInlineeLinesSubsectionRef final : public DebugSubsectionRef {
- typedef VarStreamArray<InlineeSourceLine> LinesArray;
- typedef LinesArray::Iterator Iterator;
+ using LinesArray = VarStreamArray<InlineeSourceLine>;
+ using Iterator = LinesArray::Iterator;
public:
DebugInlineeLinesSubsectionRef();
@@ -99,13 +109,13 @@ public:
private:
DebugChecksumsSubsection &Checksums;
-
bool HasExtraFiles = false;
uint32_t ExtraFileCount = 0;
-
std::vector<Entry> Entries;
};
-}
-}
-#endif
+} // end namespace codeview
+
+} // end namespace llvm
+
+#endif // LLVM_DEBUGINFO_CODEVIEW_DEBUGINLINEELINESSUBSECTION_H
diff --git a/include/llvm/DebugInfo/CodeView/DebugLinesSubsection.h b/include/llvm/DebugInfo/CodeView/DebugLinesSubsection.h
index f1feb1336cc53..53044b6c3dc8b 100644
--- a/include/llvm/DebugInfo/CodeView/DebugLinesSubsection.h
+++ b/include/llvm/DebugInfo/CodeView/DebugLinesSubsection.h
@@ -1,4 +1,4 @@
-//===- DebugLinesSubsection.h --------------------------------*- C++ -*-===//
+//===- DebugLinesSubsection.h -----------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -7,14 +7,20 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_DEBUGINFO_CODEVIEW_MODULEDEBUGLINEFRAGMENT_H
-#define LLVM_DEBUGINFO_CODEVIEW_MODULEDEBUGLINEFRAGMENT_H
+#ifndef LLVM_DEBUGINFO_CODEVIEW_DEBUGLINESSUBSECTION_H
+#define LLVM_DEBUGINFO_CODEVIEW_DEBUGLINESSUBSECTION_H
+#include "llvm/ADT/StringRef.h"
+#include "llvm/DebugInfo/CodeView/CodeView.h"
#include "llvm/DebugInfo/CodeView/DebugSubsection.h"
#include "llvm/DebugInfo/CodeView/Line.h"
#include "llvm/Support/BinaryStreamArray.h"
#include "llvm/Support/BinaryStreamReader.h"
+#include "llvm/Support/BinaryStreamRef.h"
+#include "llvm/Support/Endian.h"
#include "llvm/Support/Error.h"
+#include <cstdint>
+#include <vector>
namespace llvm {
namespace codeview {
@@ -72,8 +78,9 @@ public:
class DebugLinesSubsectionRef final : public DebugSubsectionRef {
friend class LineColumnExtractor;
- typedef VarStreamArray<LineColumnEntry, LineColumnExtractor> LineInfoArray;
- typedef LineInfoArray::Iterator Iterator;
+
+ using LineInfoArray = VarStreamArray<LineColumnEntry, LineColumnExtractor>;
+ using Iterator = LineInfoArray::Iterator;
public:
DebugLinesSubsectionRef();
@@ -130,14 +137,14 @@ public:
private:
DebugChecksumsSubsection &Checksums;
-
uint32_t RelocOffset = 0;
uint16_t RelocSegment = 0;
uint32_t CodeSize = 0;
LineFlags Flags = LF_None;
std::vector<Block> Blocks;
};
-}
-}
-#endif
+} // end namespace codeview
+} // end namespace llvm
+
+#endif // LLVM_DEBUGINFO_CODEVIEW_DEBUGLINESSUBSECTION_H
diff --git a/include/llvm/DebugInfo/CodeView/DebugStringTableSubsection.h b/include/llvm/DebugInfo/CodeView/DebugStringTableSubsection.h
index be0a2344965b1..7f0f10e4fbfa2 100644
--- a/include/llvm/DebugInfo/CodeView/DebugStringTableSubsection.h
+++ b/include/llvm/DebugInfo/CodeView/DebugStringTableSubsection.h
@@ -12,17 +12,15 @@
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/DebugInfo/CodeView/CodeView.h"
#include "llvm/DebugInfo/CodeView/DebugSubsection.h"
#include "llvm/Support/BinaryStreamRef.h"
#include "llvm/Support/Error.h"
-
-#include <stdint.h>
+#include <cstdint>
namespace llvm {
class BinaryStreamReader;
-class BinaryStreamRef;
-class BinaryStreamWriter;
namespace codeview {
@@ -83,7 +81,9 @@ private:
StringMap<uint32_t> Strings;
uint32_t StringSize = 1;
};
-}
-}
-#endif
+} // end namespace codeview
+
+} // end namespace llvm
+
+#endif // LLVM_DEBUGINFO_CODEVIEW_DEBUGSTRINGTABLESUBSECTION_H
diff --git a/include/llvm/DebugInfo/CodeView/DebugSubsectionRecord.h b/include/llvm/DebugInfo/CodeView/DebugSubsectionRecord.h
index ee17b47d8e631..fc0cf0d1d90ec 100644
--- a/include/llvm/DebugInfo/CodeView/DebugSubsectionRecord.h
+++ b/include/llvm/DebugInfo/CodeView/DebugSubsectionRecord.h
@@ -1,4 +1,4 @@
-//===- DebugSubsection.h ------------------------------------*- C++ -*-===//
+//===- DebugSubsectionRecord.h ----------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -7,17 +7,22 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_DEBUGINFO_CODEVIEW_MODULEDEBUGFRAGMENTRECORD_H
-#define LLVM_DEBUGINFO_CODEVIEW_MODULEDEBUGFRAGMENTRECORD_H
+#ifndef LLVM_DEBUGINFO_CODEVIEW_DEBUGSUBSECTIONRECORD_H
+#define LLVM_DEBUGINFO_CODEVIEW_DEBUGSUBSECTIONRECORD_H
#include "llvm/DebugInfo/CodeView/CodeView.h"
#include "llvm/Support/BinaryStreamArray.h"
#include "llvm/Support/BinaryStreamRef.h"
-#include "llvm/Support/BinaryStreamWriter.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/Error.h"
+#include "llvm/Support/MathExtras.h"
+#include <cstdint>
+#include <memory>
namespace llvm {
+
+class BinaryStreamWriter;
+
namespace codeview {
class DebugSubsection;
@@ -42,8 +47,8 @@ public:
BinaryStreamRef getRecordData() const;
private:
- CodeViewContainer Container;
- DebugSubsectionKind Kind;
+ CodeViewContainer Container = CodeViewContainer::ObjectFile;
+ DebugSubsectionKind Kind = DebugSubsectionKind::None;
BinaryStreamRef Data;
};
@@ -71,7 +76,7 @@ private:
CodeViewContainer Container;
};
-} // namespace codeview
+} // end namespace codeview
template <> struct VarStreamArrayExtractor<codeview::DebugSubsectionRecord> {
Error operator()(BinaryStreamRef Stream, uint32_t &Length,
@@ -88,8 +93,11 @@ template <> struct VarStreamArrayExtractor<codeview::DebugSubsectionRecord> {
};
namespace codeview {
-typedef VarStreamArray<DebugSubsectionRecord> DebugSubsectionArray;
-}
-} // namespace llvm
-#endif // LLVM_DEBUGINFO_CODEVIEW_MODULEDEBUGFRAGMENTRECORD_H
+using DebugSubsectionArray = VarStreamArray<DebugSubsectionRecord>;
+
+} // end namespace codeview
+
+} // end namespace llvm
+
+#endif // LLVM_DEBUGINFO_CODEVIEW_DEBUGSUBSECTIONRECORD_H
diff --git a/include/llvm/DebugInfo/CodeView/DebugSymbolRVASubsection.h b/include/llvm/DebugInfo/CodeView/DebugSymbolRVASubsection.h
index ad58a293cb09a..a4c04b55eb4c2 100644
--- a/include/llvm/DebugInfo/CodeView/DebugSymbolRVASubsection.h
+++ b/include/llvm/DebugInfo/CodeView/DebugSymbolRVASubsection.h
@@ -10,17 +10,23 @@
#ifndef LLVM_DEBUGINFO_CODEVIEW_DEBUGSYMBOLRVASUBSECTION_H
#define LLVM_DEBUGINFO_CODEVIEW_DEBUGSYMBOLRVASUBSECTION_H
+#include "llvm/DebugInfo/CodeView/CodeView.h"
#include "llvm/DebugInfo/CodeView/DebugSubsection.h"
#include "llvm/Support/BinaryStreamArray.h"
-#include "llvm/Support/BinaryStreamReader.h"
+#include "llvm/Support/Endian.h"
#include "llvm/Support/Error.h"
+#include <cstdint>
+#include <vector>
namespace llvm {
+
+class BinaryStreamReader;
+
namespace codeview {
class DebugSymbolRVASubsectionRef final : public DebugSubsectionRef {
public:
- typedef FixedStreamArray<support::ulittle32_t> ArrayType;
+ using ArrayType = FixedStreamArray<support::ulittle32_t>;
DebugSymbolRVASubsectionRef();
@@ -53,7 +59,9 @@ public:
private:
std::vector<support::ulittle32_t> RVAs;
};
-} // namespace codeview
-} // namespace llvm
-#endif
+} // end namespace codeview
+
+} // end namespace llvm
+
+#endif // LLVM_DEBUGINFO_CODEVIEW_DEBUGSYMBOLRVASUBSECTION_H
diff --git a/include/llvm/DebugInfo/CodeView/EnumTables.h b/include/llvm/DebugInfo/CodeView/EnumTables.h
index 5d54bb4cca841..ee0f0f7c6023a 100644
--- a/include/llvm/DebugInfo/CodeView/EnumTables.h
+++ b/include/llvm/DebugInfo/CodeView/EnumTables.h
@@ -1,4 +1,4 @@
-//===- EnumTables.h Enum to string conversion tables ------------*- C++ -*-===//
+//===- EnumTables.h - Enum to string conversion tables ----------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -14,11 +14,11 @@
#include "llvm/BinaryFormat/COFF.h"
#include "llvm/DebugInfo/CodeView/CodeView.h"
#include "llvm/Support/ScopedPrinter.h"
-
-#include <stdint.h>
+#include <cstdint>
namespace llvm {
namespace codeview {
+
ArrayRef<EnumEntry<SymbolKind>> getSymbolTypeNames();
ArrayRef<EnumEntry<TypeLeafKind>> getTypeLeafNames();
ArrayRef<EnumEntry<uint16_t>> getRegisterNames();
@@ -38,7 +38,8 @@ ArrayRef<EnumEntry<uint8_t>> getThunkOrdinalNames();
ArrayRef<EnumEntry<uint16_t>> getTrampolineNames();
ArrayRef<EnumEntry<COFF::SectionCharacteristics>>
getImageSectionCharacteristicNames();
-} // namespace codeview
-} // namespace llvm
+
+} // end namespace codeview
+} // end namespace llvm
#endif // LLVM_DEBUGINFO_CODEVIEW_ENUMTABLES_H
diff --git a/include/llvm/DebugInfo/CodeView/Formatters.h b/include/llvm/DebugInfo/CodeView/Formatters.h
index 1fbb0dd6f9b00..0842c1e373dbd 100644
--- a/include/llvm/DebugInfo/CodeView/Formatters.h
+++ b/include/llvm/DebugInfo/CodeView/Formatters.h
@@ -14,21 +14,27 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
#include "llvm/Support/FormatAdapters.h"
-#include "llvm/Support/FormatProviders.h"
#include "llvm/Support/FormatVariadic.h"
+#include "llvm/Support/raw_ostream.h"
+#include <cstdint>
namespace llvm {
+
namespace codeview {
+
namespace detail {
-class GuidAdapter final : public llvm::FormatAdapter<ArrayRef<uint8_t>> {
+
+class GuidAdapter final : public FormatAdapter<ArrayRef<uint8_t>> {
ArrayRef<uint8_t> Guid;
public:
explicit GuidAdapter(ArrayRef<uint8_t> Guid);
explicit GuidAdapter(StringRef Guid);
- void format(llvm::raw_ostream &Stream, StringRef Style);
+
+ void format(raw_ostream &Stream, StringRef Style) override ;
};
-}
+
+} // end namespace detail
inline detail::GuidAdapter fmt_guid(StringRef Item) {
return detail::GuidAdapter(Item);
@@ -37,11 +43,12 @@ inline detail::GuidAdapter fmt_guid(StringRef Item) {
inline detail::GuidAdapter fmt_guid(ArrayRef<uint8_t> Item) {
return detail::GuidAdapter(Item);
}
-}
+
+} // end namespace codeview
template <> struct format_provider<codeview::TypeIndex> {
public:
- static void format(const codeview::TypeIndex &V, llvm::raw_ostream &Stream,
+ static void format(const codeview::TypeIndex &V, raw_ostream &Stream,
StringRef Style) {
if (V.isNoneType())
Stream << "<no type>";
@@ -52,6 +59,7 @@ public:
}
}
};
-}
-#endif
+} // end namespace llvm
+
+#endif // LLVM_DEBUGINFO_CODEVIEW_FORMATTERS_H
diff --git a/include/llvm/DebugInfo/CodeView/LazyRandomTypeCollection.h b/include/llvm/DebugInfo/CodeView/LazyRandomTypeCollection.h
index 8b1540abf903e..cc0c24301d498 100644
--- a/include/llvm/DebugInfo/CodeView/LazyRandomTypeCollection.h
+++ b/include/llvm/DebugInfo/CodeView/LazyRandomTypeCollection.h
@@ -1,4 +1,4 @@
-//===- LazyRandomTypeCollection.h ---------------------------- *- C++ --*-===//
+//===- LazyRandomTypeCollection.h -------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -10,12 +10,18 @@
#ifndef LLVM_DEBUGINFO_CODEVIEW_LAZYRANDOMTYPECOLLECTION_H
#define LLVM_DEBUGINFO_CODEVIEW_LAZYRANDOMTYPECOLLECTION_H
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/Optional.h"
+#include "llvm/ADT/StringRef.h"
#include "llvm/DebugInfo/CodeView/TypeCollection.h"
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
#include "llvm/DebugInfo/CodeView/TypeRecord.h"
#include "llvm/Support/Allocator.h"
+#include "llvm/Support/BinaryStreamArray.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/StringSaver.h"
+#include <cstdint>
+#include <vector>
namespace llvm {
namespace codeview {
@@ -43,7 +49,8 @@ namespace codeview {
/// into M chunks of roughly equal size, this yields a worst case lookup time
/// of O(N/M) and an amortized time of O(1).
class LazyRandomTypeCollection : public TypeCollection {
- typedef FixedStreamArray<TypeIndexOffset> PartialOffsetArray;
+ using PartialOffsetArray = FixedStreamArray<TypeIndexOffset>;
+
struct CacheEntry {
CVType Type;
uint32_t Offset;
diff --git a/include/llvm/DebugInfo/CodeView/StringsAndChecksums.h b/include/llvm/DebugInfo/CodeView/StringsAndChecksums.h
index 708b317164fc7..1a83882246652 100644
--- a/include/llvm/DebugInfo/CodeView/StringsAndChecksums.h
+++ b/include/llvm/DebugInfo/CodeView/StringsAndChecksums.h
@@ -7,23 +7,18 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_DEBUGINFO_CODEVIEW_STRINGS_AND_CHECKSUMS_H
-#define LLVM_DEBUGINFO_CODEVIEW_STRINGS_AND_CHECKSUMS_H
+#ifndef LLVM_DEBUGINFO_CODEVIEW_STRINGSANDCHECKSUMS_H
+#define LLVM_DEBUGINFO_CODEVIEW_STRINGSANDCHECKSUMS_H
#include "llvm/DebugInfo/CodeView/CodeView.h"
+#include "llvm/DebugInfo/CodeView/DebugChecksumsSubsection.h"
+#include "llvm/DebugInfo/CodeView/DebugStringTableSubsection.h"
#include "llvm/DebugInfo/CodeView/DebugSubsectionRecord.h"
-
#include <memory>
namespace llvm {
namespace codeview {
-class DebugSubsectionRecord;
-class DebugChecksumsSubsectionRef;
-class DebugStringTableSubsectionRef;
-class DebugChecksumsSubsection;
-class DebugStringTableSubsection;
-
class StringsAndChecksumsRef {
public:
// If no subsections are known about initially, we find as much as we can.
@@ -83,8 +78,9 @@ class StringsAndChecksums {
public:
using StringsPtr = std::shared_ptr<DebugStringTableSubsection>;
using ChecksumsPtr = std::shared_ptr<DebugChecksumsSubsection>;
+
// If no subsections are known about initially, we find as much as we can.
- StringsAndChecksums() {}
+ StringsAndChecksums() = default;
void setStrings(const StringsPtr &SP) { Strings = SP; }
void setChecksums(const ChecksumsPtr &CP) { Checksums = CP; }
@@ -100,7 +96,7 @@ private:
ChecksumsPtr Checksums;
};
-} // namespace codeview
-} // namespace llvm
+} // end namespace codeview
+} // end namespace llvm
-#endif
+#endif // LLVM_DEBUGINFO_CODEVIEW_STRINGSANDCHECKSUMS_H
diff --git a/include/llvm/DebugInfo/CodeView/SymbolDeserializer.h b/include/llvm/DebugInfo/CodeView/SymbolDeserializer.h
index 7080b04807570..5b6599d8c1db0 100644
--- a/include/llvm/DebugInfo/CodeView/SymbolDeserializer.h
+++ b/include/llvm/DebugInfo/CodeView/SymbolDeserializer.h
@@ -51,6 +51,10 @@ public:
CodeViewContainer Container)
: Delegate(Delegate), Container(Container) {}
+ Error visitSymbolBegin(CVSymbol &Record, uint32_t Offset) override {
+ return visitSymbolBegin(Record);
+ }
+
Error visitSymbolBegin(CVSymbol &Record) override {
assert(!Mapping && "Already in a symbol mapping!");
Mapping = llvm::make_unique<MappingInfo>(Record.content(), Container);
diff --git a/include/llvm/DebugInfo/CodeView/SymbolRecord.h b/include/llvm/DebugInfo/CodeView/SymbolRecord.h
index 1cf77fcdecbe0..7941af8be8af2 100644
--- a/include/llvm/DebugInfo/CodeView/SymbolRecord.h
+++ b/include/llvm/DebugInfo/CodeView/SymbolRecord.h
@@ -21,8 +21,6 @@
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
#include "llvm/Support/BinaryStreamArray.h"
#include "llvm/Support/Endian.h"
-#include "llvm/Support/Error.h"
-#include <cstddef>
#include <cstdint>
#include <vector>
@@ -35,6 +33,7 @@ protected:
public:
SymbolRecordKind getKind() const { return Kind; }
+
SymbolRecordKind Kind;
};
@@ -153,6 +152,7 @@ public:
: SymbolRecord(Kind), RecordOffset(RecordOffset) {}
std::vector<TypeIndex> Indices;
+
uint32_t RecordOffset;
};
@@ -165,8 +165,8 @@ struct BinaryAnnotationIterator {
int32_t S1;
};
- BinaryAnnotationIterator(ArrayRef<uint8_t> Annotations) : Data(Annotations) {}
BinaryAnnotationIterator() = default;
+ BinaryAnnotationIterator(ArrayRef<uint8_t> Annotations) : Data(Annotations) {}
BinaryAnnotationIterator(const BinaryAnnotationIterator &Other)
: Data(Other.Data) {}
@@ -342,9 +342,9 @@ public:
: SymbolRecord(SymbolRecordKind::InlineSiteSym),
RecordOffset(RecordOffset) {}
- llvm::iterator_range<BinaryAnnotationIterator> annotations() const {
- return llvm::make_range(BinaryAnnotationIterator(AnnotationData),
- BinaryAnnotationIterator());
+ iterator_range<BinaryAnnotationIterator> annotations() const {
+ return make_range(BinaryAnnotationIterator(AnnotationData),
+ BinaryAnnotationIterator());
}
uint32_t Parent;
@@ -479,6 +479,7 @@ public:
ulittle16_t Register;
ulittle16_t MayHaveNoName;
};
+
explicit DefRangeRegisterSym(SymbolRecordKind Kind) : SymbolRecord(Kind) {}
DefRangeRegisterSym(uint32_t RecordOffset)
: SymbolRecord(SymbolRecordKind::DefRangeRegisterSym),
@@ -501,6 +502,7 @@ public:
ulittle16_t MayHaveNoName;
ulittle32_t OffsetInParent;
};
+
explicit DefRangeSubfieldRegisterSym(SymbolRecordKind Kind)
: SymbolRecord(Kind) {}
DefRangeSubfieldRegisterSym(uint32_t RecordOffset)
@@ -546,6 +548,7 @@ public:
ulittle16_t Flags;
little32_t BasePointerOffset;
};
+
explicit DefRangeRegisterRelSym(SymbolRecordKind Kind) : SymbolRecord(Kind) {}
explicit DefRangeRegisterRelSym(uint32_t RecordOffset)
: SymbolRecord(SymbolRecordKind::DefRangeRegisterRelSym),
@@ -935,8 +938,8 @@ public:
uint32_t RecordOffset;
};
-typedef CVRecord<SymbolKind> CVSymbol;
-typedef VarStreamArray<CVSymbol> CVSymbolArray;
+using CVSymbol = CVRecord<SymbolKind>;
+using CVSymbolArray = VarStreamArray<CVSymbol>;
} // end namespace codeview
} // end namespace llvm
diff --git a/include/llvm/DebugInfo/CodeView/SymbolSerializer.h b/include/llvm/DebugInfo/CodeView/SymbolSerializer.h
index 42adbdb4e20f3..b63ced5217b44 100644
--- a/include/llvm/DebugInfo/CodeView/SymbolSerializer.h
+++ b/include/llvm/DebugInfo/CodeView/SymbolSerializer.h
@@ -1,4 +1,4 @@
-//===- symbolSerializer.h ---------------------------------------*- C++ -*-===//
+//===- SymbolSerializer.h ---------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -10,21 +10,20 @@
#ifndef LLVM_DEBUGINFO_CODEVIEW_SYMBOLSERIALIZER_H
#define LLVM_DEBUGINFO_CODEVIEW_SYMBOLSERIALIZER_H
+#include "llvm/ADT/Optional.h"
+#include "llvm/DebugInfo/CodeView/CodeView.h"
+#include "llvm/DebugInfo/CodeView/RecordSerialization.h"
+#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
#include "llvm/DebugInfo/CodeView/SymbolRecordMapping.h"
#include "llvm/DebugInfo/CodeView/SymbolVisitorCallbacks.h"
-
-#include "llvm/ADT/Optional.h"
-#include "llvm/ADT/SmallVector.h"
-#include "llvm/ADT/StringMap.h"
-#include "llvm/ADT/StringRef.h"
-#include "llvm/ADT/iterator_range.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/BinaryByteStream.h"
#include "llvm/Support/BinaryStreamWriter.h"
#include "llvm/Support/Error.h"
+#include <cstdint>
+#include <vector>
namespace llvm {
-class BinaryStreamWriter;
namespace codeview {
class SymbolSerializer : public SymbolVisitorCallbacks {
@@ -45,6 +44,8 @@ class SymbolSerializer : public SymbolVisitorCallbacks {
}
public:
+ SymbolSerializer(BumpPtrAllocator &Storage, CodeViewContainer Container);
+
template <typename SymType>
static CVSymbol writeOneSymbol(SymType &Sym, BumpPtrAllocator &Storage,
CodeViewContainer Container) {
@@ -57,13 +58,11 @@ public:
return Result;
}
- SymbolSerializer(BumpPtrAllocator &Storage, CodeViewContainer Container);
-
- virtual Error visitSymbolBegin(CVSymbol &Record) override;
- virtual Error visitSymbolEnd(CVSymbol &Record) override;
+ Error visitSymbolBegin(CVSymbol &Record) override;
+ Error visitSymbolEnd(CVSymbol &Record) override;
#define SYMBOL_RECORD(EnumName, EnumVal, Name) \
- virtual Error visitKnownRecord(CVSymbol &CVR, Name &Record) override { \
+ Error visitKnownRecord(CVSymbol &CVR, Name &Record) override { \
return visitKnownRecordImpl(CVR, Record); \
}
#define SYMBOL_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
@@ -75,7 +74,8 @@ private:
return Mapping.visitKnownRecord(CVR, Record);
}
};
-}
-}
-#endif
+} // end namespace codeview
+} // end namespace llvm
+
+#endif // LLVM_DEBUGINFO_CODEVIEW_SYMBOLSERIALIZER_H
diff --git a/include/llvm/DebugInfo/CodeView/SymbolVisitorCallbackPipeline.h b/include/llvm/DebugInfo/CodeView/SymbolVisitorCallbackPipeline.h
index 5f4205bd6e082..e29511a67b7f3 100644
--- a/include/llvm/DebugInfo/CodeView/SymbolVisitorCallbackPipeline.h
+++ b/include/llvm/DebugInfo/CodeView/SymbolVisitorCallbackPipeline.h
@@ -30,6 +30,14 @@ public:
return Error::success();
}
+ Error visitSymbolBegin(CVSymbol &Record, uint32_t Offset) override {
+ for (auto Visitor : Pipeline) {
+ if (auto EC = Visitor->visitSymbolBegin(Record, Offset))
+ return EC;
+ }
+ return Error::success();
+ }
+
Error visitSymbolBegin(CVSymbol &Record) override {
for (auto Visitor : Pipeline) {
if (auto EC = Visitor->visitSymbolBegin(Record))
diff --git a/include/llvm/DebugInfo/CodeView/SymbolVisitorCallbacks.h b/include/llvm/DebugInfo/CodeView/SymbolVisitorCallbacks.h
index 2ef7eabdaa9d3..0816f7c62656f 100644
--- a/include/llvm/DebugInfo/CodeView/SymbolVisitorCallbacks.h
+++ b/include/llvm/DebugInfo/CodeView/SymbolVisitorCallbacks.h
@@ -29,8 +29,10 @@ public:
/// Paired begin/end actions for all symbols. Receives all record data,
/// including the fixed-length record prefix. visitSymbolBegin() should
- /// return
- /// the type of the Symbol, or an error if it cannot be determined.
+ /// return the type of the Symbol, or an error if it cannot be determined.
+ virtual Error visitSymbolBegin(CVSymbol &Record, uint32_t Offset) {
+ return Error::success();
+ }
virtual Error visitSymbolBegin(CVSymbol &Record) { return Error::success(); }
virtual Error visitSymbolEnd(CVSymbol &Record) { return Error::success(); }
diff --git a/include/llvm/DebugInfo/CodeView/TypeIndexDiscovery.h b/include/llvm/DebugInfo/CodeView/TypeIndexDiscovery.h
index c393b42cd27c5..afe8942159e84 100644
--- a/include/llvm/DebugInfo/CodeView/TypeIndexDiscovery.h
+++ b/include/llvm/DebugInfo/CodeView/TypeIndexDiscovery.h
@@ -28,6 +28,8 @@ void discoverTypeIndices(ArrayRef<uint8_t> RecordData,
SmallVectorImpl<TiReference> &Refs);
void discoverTypeIndices(const CVType &Type,
SmallVectorImpl<TiReference> &Refs);
+void discoverTypeIndices(const CVType &Type,
+ SmallVectorImpl<TypeIndex> &Indices);
/// Discover type indices in symbol records. Returns false if this is an unknown
/// record.
diff --git a/include/llvm/DebugInfo/CodeView/TypeRecord.h b/include/llvm/DebugInfo/CodeView/TypeRecord.h
index 3a64a437aa4d9..2efeb1b3cefd1 100644
--- a/include/llvm/DebugInfo/CodeView/TypeRecord.h
+++ b/include/llvm/DebugInfo/CodeView/TypeRecord.h
@@ -15,6 +15,7 @@
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/iterator_range.h"
#include "llvm/DebugInfo/CodeView/CVRecord.h"
#include "llvm/DebugInfo/CodeView/CodeView.h"
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
@@ -25,31 +26,30 @@
#include <vector>
namespace llvm {
-
-class BinaryStreamReader;
-
namespace codeview {
using support::little32_t;
using support::ulittle16_t;
using support::ulittle32_t;
-typedef CVRecord<TypeLeafKind> CVType;
-typedef RemappedRecord<TypeLeafKind> RemappedType;
+using CVType = CVRecord<TypeLeafKind>;
+using RemappedType = RemappedRecord<TypeLeafKind>;
struct CVMemberRecord {
TypeLeafKind Kind;
ArrayRef<uint8_t> Data;
};
-typedef VarStreamArray<CVType> CVTypeArray;
-typedef iterator_range<CVTypeArray::Iterator> CVTypeRange;
+using CVTypeArray = VarStreamArray<CVType>;
+using CVTypeRange = iterator_range<CVTypeArray::Iterator>;
/// Equvalent to CV_fldattr_t in cvinfo.h.
struct MemberAttributes {
uint16_t Attrs = 0;
+
enum {
MethodKindShift = 2,
};
+
MemberAttributes() = default;
explicit MemberAttributes(MemberAccess Access)
@@ -226,6 +226,7 @@ public:
TypeIndex getClassType() const { return ClassType; }
TypeIndex getFunctionType() const { return FunctionType; }
StringRef getName() const { return Name; }
+
TypeIndex ClassType;
TypeIndex FunctionType;
StringRef Name;
@@ -330,7 +331,6 @@ public:
TypeIndex ReferentType;
uint32_t Attrs;
-
Optional<MemberPointerInfo> MemberInfo;
private:
@@ -490,6 +490,7 @@ public:
UnderlyingType(UnderlyingType) {}
TypeIndex getUnderlyingType() const { return UnderlyingType; }
+
TypeIndex UnderlyingType;
};
@@ -505,6 +506,7 @@ public:
TypeIndex getType() const { return Type; }
uint8_t getBitOffset() const { return BitOffset; }
uint8_t getBitSize() const { return BitSize; }
+
TypeIndex Type;
uint8_t BitSize;
uint8_t BitOffset;
@@ -527,6 +529,7 @@ public:
}
uint32_t getEntryCount() const { return getSlots().size(); }
+
ArrayRef<VFTableSlotKind> SlotsRef;
std::vector<VFTableSlotKind> Slots;
};
@@ -541,9 +544,7 @@ public:
Name(Name) {}
StringRef getGuid() const { return Guid; }
-
uint32_t getAge() const { return Age; }
-
StringRef getName() const { return Name; }
StringRef Guid;
@@ -560,8 +561,8 @@ public:
: TypeRecord(TypeRecordKind::StringId), Id(Id), String(String) {}
TypeIndex getId() const { return Id; }
-
StringRef getString() const { return String; }
+
TypeIndex Id;
StringRef String;
};
@@ -576,9 +577,7 @@ public:
FunctionType(FunctionType), Name(Name) {}
TypeIndex getParentScope() const { return ParentScope; }
-
TypeIndex getFunctionType() const { return FunctionType; }
-
StringRef getName() const { return Name; }
TypeIndex ParentScope;
@@ -635,6 +634,7 @@ public:
ArgIndices(ArgIndices.begin(), ArgIndices.end()) {}
ArrayRef<TypeIndex> getArgs() const { return ArgIndices; }
+
SmallVector<TypeIndex, 4> ArgIndices;
};
@@ -656,6 +656,7 @@ public:
TypeIndex getOverriddenVTable() const { return OverriddenVFTable; }
uint32_t getVFPtrOffset() const { return VFPtrOffset; }
StringRef getName() const { return makeArrayRef(MethodNames).front(); }
+
ArrayRef<StringRef> getMethodNames() const {
return makeArrayRef(MethodNames).drop_front();
}
@@ -707,6 +708,7 @@ public:
: TypeRecord(TypeRecordKind::MethodOverloadList), Methods(Methods) {}
ArrayRef<OneMethodRecord> getMethods() const { return Methods; }
+
std::vector<OneMethodRecord> Methods;
};
@@ -723,6 +725,7 @@ public:
uint16_t getNumOverloads() const { return NumOverloads; }
TypeIndex getMethodList() const { return MethodList; }
StringRef getName() const { return Name; }
+
uint16_t NumOverloads;
TypeIndex MethodList;
StringRef Name;
@@ -874,7 +877,6 @@ public:
};
} // end namespace codeview
-
} // end namespace llvm
#endif // LLVM_DEBUGINFO_CODEVIEW_TYPERECORD_H
diff --git a/include/llvm/DebugInfo/CodeView/TypeSerializer.h b/include/llvm/DebugInfo/CodeView/TypeSerializer.h
index 988a2d4aa8346..0e734a8170bdf 100644
--- a/include/llvm/DebugInfo/CodeView/TypeSerializer.h
+++ b/include/llvm/DebugInfo/CodeView/TypeSerializer.h
@@ -10,19 +10,25 @@
#ifndef LLVM_DEBUGINFO_CODEVIEW_TYPESERIALIZER_H
#define LLVM_DEBUGINFO_CODEVIEW_TYPESERIALIZER_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/ADT/Optional.h"
-#include "llvm/ADT/SmallVector.h"
-#include "llvm/ADT/StringRef.h"
-#include "llvm/Support/Allocator.h"
#include "llvm/Support/Error.h"
+#include <cassert>
+#include <cstdint>
+#include <memory>
+#include <vector>
namespace llvm {
-
namespace codeview {
class TypeHasher;
@@ -46,7 +52,7 @@ class TypeSerializer : public TypeVisitorCallbacks {
}
};
- typedef SmallVector<MutableArrayRef<uint8_t>, 2> MutableRecordList;
+ using MutableRecordList = SmallVector<MutableArrayRef<uint8_t>, 2>;
static constexpr uint8_t ContinuationLength = 8;
BumpPtrAllocator &RecordStorage;
@@ -82,7 +88,7 @@ class TypeSerializer : public TypeVisitorCallbacks {
public:
explicit TypeSerializer(BumpPtrAllocator &Storage, bool Hash = true);
- ~TypeSerializer();
+ ~TypeSerializer() override;
void reset();
@@ -146,7 +152,8 @@ private:
return Error::success();
}
};
-}
-}
-#endif
+} // end namespace codeview
+} // end namespace llvm
+
+#endif // LLVM_DEBUGINFO_CODEVIEW_TYPESERIALIZER_H
diff --git a/include/llvm/DebugInfo/CodeView/TypeServerHandler.h b/include/llvm/DebugInfo/CodeView/TypeServerHandler.h
index 35f06eaf6eb40..e96baad9ceae3 100644
--- a/include/llvm/DebugInfo/CodeView/TypeServerHandler.h
+++ b/include/llvm/DebugInfo/CodeView/TypeServerHandler.h
@@ -10,16 +10,17 @@
#ifndef LLVM_DEBUGINFO_CODEVIEW_TYPESERVERHANDLER_H
#define LLVM_DEBUGINFO_CODEVIEW_TYPESERVERHANDLER_H
-#include "llvm/DebugInfo/CodeView/TypeRecord.h"
#include "llvm/Support/Error.h"
namespace llvm {
namespace codeview {
+
+class TypeServer2Record;
class TypeVisitorCallbacks;
class TypeServerHandler {
public:
- virtual ~TypeServerHandler() {}
+ virtual ~TypeServerHandler() = default;
/// Handle a TypeServer record. If the implementation returns true
/// the record will not be processed by the top-level visitor. If
@@ -30,7 +31,8 @@ public:
return false;
}
};
-}
-}
-#endif
+} // end namespace codeview
+} // end namespace llvm
+
+#endif // LLVM_DEBUGINFO_CODEVIEW_TYPESERVERHANDLER_H
diff --git a/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h b/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h
index 8bde63efe1882..eb6d0f541c1ed 100644
--- a/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h
+++ b/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h
@@ -12,8 +12,8 @@
#include "llvm/ADT/SmallVector.h"
#include "llvm/BinaryFormat/Dwarf.h"
+#include "llvm/DebugInfo/DWARF/DWARFDataExtractor.h"
#include "llvm/DebugInfo/DWARF/DWARFRelocMap.h"
-#include "llvm/Support/DataExtractor.h"
#include <cstdint>
#include <utility>
@@ -41,20 +41,31 @@ class DWARFAcceleratorTable {
struct Header Hdr;
struct HeaderData HdrData;
- DataExtractor AccelSection;
+ DWARFDataExtractor AccelSection;
DataExtractor StringSection;
- const RelocAddrMap& Relocs;
public:
- DWARFAcceleratorTable(DataExtractor AccelSection, DataExtractor StringSection,
- const RelocAddrMap &Relocs)
- : AccelSection(AccelSection), StringSection(StringSection), Relocs(Relocs) {}
+ DWARFAcceleratorTable(const DWARFDataExtractor &AccelSection,
+ DataExtractor StringSection)
+ : AccelSection(AccelSection), StringSection(StringSection) {}
bool extract();
uint32_t getNumBuckets();
uint32_t getNumHashes();
uint32_t getSizeHdr();
uint32_t getHeaderDataLength();
+ ArrayRef<std::pair<HeaderData::AtomType, HeaderData::Form>> getAtomsDesc();
+ bool validateForms();
+
+ /// Return information related to the DWARF DIE we're looking for when
+ /// performing a lookup by name.
+ ///
+ /// \param HashDataOffset an offset into the hash data table
+ /// \returns DIEOffset the offset into the .debug_info section for the DIE
+ /// related to the input hash data offset. Currently this function returns
+ /// only the DIEOffset but it can be modified to return more data regarding
+ /// the DIE
+ uint32_t readAtoms(uint32_t &HashDataOffset);
void dump(raw_ostream &OS) const;
};
diff --git a/include/llvm/DebugInfo/DWARF/DWARFCompileUnit.h b/include/llvm/DebugInfo/DWARF/DWARFCompileUnit.h
index b4e4721e3d519..a18adf87bf8e1 100644
--- a/include/llvm/DebugInfo/DWARF/DWARFCompileUnit.h
+++ b/include/llvm/DebugInfo/DWARF/DWARFCompileUnit.h
@@ -20,8 +20,8 @@ public:
DWARFCompileUnit(DWARFContext &Context, const DWARFSection &Section,
const DWARFDebugAbbrev *DA, const DWARFSection *RS,
StringRef SS, const DWARFSection &SOS,
- const DWARFSection *AOS, StringRef LS, bool LE, bool IsDWO,
- const DWARFUnitSectionBase &UnitSection,
+ const DWARFSection *AOS, const DWARFSection &LS, bool LE,
+ bool IsDWO, const DWARFUnitSectionBase &UnitSection,
const DWARFUnitIndex::Entry *Entry)
: DWARFUnit(Context, Section, DA, RS, SS, SOS, AOS, LS, LE, IsDWO,
UnitSection, Entry) {}
diff --git a/include/llvm/DebugInfo/DWARF/DWARFContext.h b/include/llvm/DebugInfo/DWARF/DWARFContext.h
index 4bf34d52bcba9..739aa1f9ee749 100644
--- a/include/llvm/DebugInfo/DWARF/DWARFContext.h
+++ b/include/llvm/DebugInfo/DWARF/DWARFContext.h
@@ -45,12 +45,6 @@ class DataExtractor;
class MemoryBuffer;
class raw_ostream;
-/// Reads a value from data extractor and applies a relocation to the result if
-/// one exists for the given offset.
-uint64_t getRelocatedValue(const DataExtractor &Data, uint32_t Size,
- uint32_t *Off, const RelocAddrMap *Relocs,
- uint64_t *SecNdx = nullptr);
-
/// DWARFContext
/// This data structure is the top level entity that deals with dwarf debug
/// information parsing. The actual data is supplied through pure virtual
@@ -289,6 +283,11 @@ private:
DWARFCompileUnit *getCompileUnitForAddress(uint64_t Address);
};
+/// Used as a return value for a error callback passed to DWARF context.
+/// Callback should return Halt if client application wants to stop
+/// object parsing, or should return Continue otherwise.
+enum class ErrorPolicy { Halt, Continue };
+
/// DWARFContextInMemory is the simplest possible implementation of a
/// DWARFContext. It assumes all content is available in memory and stores
/// pointers to it.
@@ -346,9 +345,14 @@ class DWARFContextInMemory : public DWARFContext {
Error maybeDecompress(const object::SectionRef &Sec, StringRef Name,
StringRef &Data);
+ /// Function used to handle default error reporting policy. Prints a error
+ /// message and returns Continue, so DWARF context ignores the error.
+ static ErrorPolicy defaultErrorHandler(Error E);
+
public:
- DWARFContextInMemory(const object::ObjectFile &Obj,
- const LoadedObjectInfo *L = nullptr);
+ DWARFContextInMemory(
+ const object::ObjectFile &Obj, const LoadedObjectInfo *L = nullptr,
+ function_ref<ErrorPolicy(Error)> HandleError = defaultErrorHandler);
DWARFContextInMemory(const StringMap<std::unique_ptr<MemoryBuffer>> &Sections,
uint8_t AddrSize,
diff --git a/include/llvm/DebugInfo/DWARF/DWARFDataExtractor.h b/include/llvm/DebugInfo/DWARF/DWARFDataExtractor.h
new file mode 100644
index 0000000000000..ef4360f666218
--- /dev/null
+++ b/include/llvm/DebugInfo/DWARF/DWARFDataExtractor.h
@@ -0,0 +1,48 @@
+//===- DWARFDataExtractor.h -------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_DEBUGINFO_DWARFDATAEXTRACTOR_H
+#define LLVM_DEBUGINFO_DWARFDATAEXTRACTOR_H
+
+#include "llvm/DebugInfo/DWARF/DWARFSection.h"
+#include "llvm/Support/DataExtractor.h"
+
+namespace llvm {
+
+/// A DataExtractor (typically for an in-memory copy of an object-file section)
+/// plus a relocation map for that section, if there is one.
+class DWARFDataExtractor : public DataExtractor {
+ const RelocAddrMap *RelocMap = nullptr;
+public:
+ /// Constructor for the normal case of extracting data from a DWARF section.
+ /// The DWARFSection's lifetime must be at least as long as the extractor's.
+ DWARFDataExtractor(const DWARFSection &Section, bool IsLittleEndian,
+ uint8_t AddressSize)
+ : DataExtractor(Section.Data, IsLittleEndian, AddressSize),
+ RelocMap(&Section.Relocs) {}
+
+ /// Constructor for cases when there are no relocations.
+ DWARFDataExtractor(StringRef Data, bool IsLittleEndian, uint8_t AddressSize)
+ : DataExtractor(Data, IsLittleEndian, AddressSize) {}
+
+ /// Extracts a value and applies a relocation to the result if
+ /// one exists for the given offset.
+ uint64_t getRelocatedValue(uint32_t Size, uint32_t *Off,
+ uint64_t *SectionIndex = nullptr) const;
+
+ /// Extracts an address-sized value and applies a relocation to the result if
+ /// one exists for the given offset.
+ uint64_t getRelocatedAddress(uint32_t *Off, uint64_t *SecIx = nullptr) const {
+ return getRelocatedValue(getAddressSize(), Off, SecIx);
+ }
+};
+
+} // end namespace llvm
+
+#endif // LLVM_DEBUGINFO_DWARFDATAEXTRACTOR_H
diff --git a/include/llvm/DebugInfo/DWARF/DWARFDebugInfoEntry.h b/include/llvm/DebugInfo/DWARF/DWARFDebugInfoEntry.h
index 5c591b3de4916..88c8f57bc33ca 100644
--- a/include/llvm/DebugInfo/DWARF/DWARFDebugInfoEntry.h
+++ b/include/llvm/DebugInfo/DWARF/DWARFDebugInfoEntry.h
@@ -12,6 +12,7 @@
#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h"
+#include "llvm/DebugInfo/DWARF/DWARFDataExtractor.h"
#include <cstdint>
namespace llvm {
@@ -40,8 +41,7 @@ public:
/// High performance extraction should use this call.
bool extractFast(const DWARFUnit &U, uint32_t *OffsetPtr,
- const DataExtractor &DebugInfoData,
- uint32_t UEndOffset,
+ const DWARFDataExtractor &DebugInfoData, uint32_t UEndOffset,
uint32_t Depth);
uint32_t getOffset() const { return Offset; }
diff --git a/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h b/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h
index 4d624812f1861..0c8f98aa62f9e 100644
--- a/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h
+++ b/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h
@@ -12,9 +12,9 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/DebugInfo/DIContext.h"
+#include "llvm/DebugInfo/DWARF/DWARFDataExtractor.h"
#include "llvm/DebugInfo/DWARF/DWARFFormValue.h"
#include "llvm/DebugInfo/DWARF/DWARFRelocMap.h"
-#include "llvm/Support/DataExtractor.h"
#include <cstdint>
#include <map>
#include <string>
@@ -26,9 +26,6 @@ class raw_ostream;
class DWARFDebugLine {
public:
- DWARFDebugLine(const RelocAddrMap *LineInfoRelocMap)
- : RelocMap(LineInfoRelocMap) {}
-
struct FileNameEntry {
FileNameEntry() = default;
@@ -98,7 +95,7 @@ public:
void clear();
void dump(raw_ostream &OS) const;
- bool parse(DataExtractor DebugLineData, uint32_t *OffsetPtr);
+ bool parse(const DWARFDataExtractor &DebugLineData, uint32_t *OffsetPtr);
};
/// Standard .debug_line state machine structure.
@@ -220,8 +217,7 @@ public:
void clear();
/// Parse prologue and all rows.
- bool parse(DataExtractor DebugLineData, const RelocAddrMap *RMap,
- uint32_t *OffsetPtr);
+ bool parse(const DWARFDataExtractor &DebugLineData, uint32_t *OffsetPtr);
using RowVector = std::vector<Row>;
using RowIter = RowVector::const_iterator;
@@ -238,7 +234,7 @@ public:
};
const LineTable *getLineTable(uint32_t Offset) const;
- const LineTable *getOrParseLineTable(DataExtractor DebugLineData,
+ const LineTable *getOrParseLineTable(const DWARFDataExtractor &DebugLineData,
uint32_t Offset);
private:
@@ -261,7 +257,6 @@ private:
using LineTableIter = LineTableMapTy::iterator;
using LineTableConstIter = LineTableMapTy::const_iterator;
- const RelocAddrMap *RelocMap;
LineTableMapTy LineTableMap;
};
diff --git a/include/llvm/DebugInfo/DWARF/DWARFDebugLoc.h b/include/llvm/DebugInfo/DWARF/DWARFDebugLoc.h
index 821da8f9b5361..c2b8d0cd73d82 100644
--- a/include/llvm/DebugInfo/DWARF/DWARFDebugLoc.h
+++ b/include/llvm/DebugInfo/DWARF/DWARFDebugLoc.h
@@ -11,8 +11,8 @@
#define LLVM_DEBUGINFO_DWARF_DWARFDEBUGLOC_H
#include "llvm/ADT/SmallVector.h"
+#include "llvm/DebugInfo/DWARF/DWARFDataExtractor.h"
#include "llvm/DebugInfo/DWARF/DWARFRelocMap.h"
-#include "llvm/Support/DataExtractor.h"
#include <cstdint>
namespace llvm {
@@ -45,18 +45,13 @@ class DWARFDebugLoc {
/// the locations in which the variable is stored.
LocationLists Locations;
- /// A map used to resolve binary relocations.
- const RelocAddrMap &RelocMap;
-
public:
- DWARFDebugLoc(const RelocAddrMap &LocRelocMap) : RelocMap(LocRelocMap) {}
-
/// Print the location lists found within the debug_loc section.
void dump(raw_ostream &OS) const;
/// Parse the debug_loc section accessible via the 'data' parameter using the
- /// specified address size to interpret the address ranges.
- void parse(DataExtractor data, unsigned AddressSize);
+ /// address size also given in 'data' to interpret the address ranges.
+ void parse(const DWARFDataExtractor &data);
};
class DWARFDebugLocDWO {
diff --git a/include/llvm/DebugInfo/DWARF/DWARFDebugRangeList.h b/include/llvm/DebugInfo/DWARF/DWARFDebugRangeList.h
index 49beec92ecc67..bcba14b1630d1 100644
--- a/include/llvm/DebugInfo/DWARF/DWARFDebugRangeList.h
+++ b/include/llvm/DebugInfo/DWARF/DWARFDebugRangeList.h
@@ -10,8 +10,8 @@
#ifndef LLVM_DEBUGINFO_DWARF_DWARFDEBUGRANGELIST_H
#define LLVM_DEBUGINFO_DWARF_DWARFDEBUGRANGELIST_H
+#include "llvm/DebugInfo/DWARF/DWARFDataExtractor.h"
#include "llvm/DebugInfo/DWARF/DWARFRelocMap.h"
-#include "llvm/Support/DataExtractor.h"
#include <cassert>
#include <cstdint>
#include <vector>
@@ -79,7 +79,7 @@ public:
void clear();
void dump(raw_ostream &OS) const;
- bool extract(DataExtractor data, uint32_t *offset_ptr, const RelocAddrMap& Relocs);
+ bool extract(const DWARFDataExtractor &data, uint32_t *offset_ptr);
const std::vector<RangeListEntry> &getEntries() { return Entries; }
/// getAbsoluteRanges - Returns absolute address ranges defined by this range
diff --git a/include/llvm/DebugInfo/DWARF/DWARFFormValue.h b/include/llvm/DebugInfo/DWARF/DWARFFormValue.h
index 78fa6639db087..008dba9b42acd 100644
--- a/include/llvm/DebugInfo/DWARF/DWARFFormValue.h
+++ b/include/llvm/DebugInfo/DWARF/DWARFFormValue.h
@@ -14,7 +14,7 @@
#include "llvm/ADT/None.h"
#include "llvm/ADT/Optional.h"
#include "llvm/BinaryFormat/Dwarf.h"
-#include "llvm/Support/DataExtractor.h"
+#include "llvm/DebugInfo/DWARF/DWARFDataExtractor.h"
#include <cstdint>
namespace llvm {
@@ -105,14 +105,13 @@ public:
/// Extracts a value in \p Data at offset \p *OffsetPtr.
///
- /// The passed DWARFUnit is allowed to be nullptr, in which
- /// case no relocation processing will be performed and some
+ /// The passed DWARFUnit is allowed to be nullptr, in which case some
/// kind of forms that depend on Unit information are disallowed.
- /// \param Data The DataExtractor to use.
- /// \param OffsetPtr The offset within DataExtractor where the data starts.
+ /// \param Data The DWARFDataExtractor to use.
+ /// \param OffsetPtr The offset within \p Data where the data starts.
/// \param U The optional DWARFUnit supplying information for some forms.
/// \returns whether the extraction succeeded.
- bool extractValue(const DataExtractor &Data, uint32_t *OffsetPtr,
+ bool extractValue(const DWARFDataExtractor &Data, uint32_t *OffsetPtr,
const DWARFUnit *U);
bool isInlinedCStr() const {
diff --git a/include/llvm/DebugInfo/DWARF/DWARFTypeUnit.h b/include/llvm/DebugInfo/DWARF/DWARFTypeUnit.h
index 2041d40eb53af..4a5793ecb8fa6 100644
--- a/include/llvm/DebugInfo/DWARF/DWARFTypeUnit.h
+++ b/include/llvm/DebugInfo/DWARF/DWARFTypeUnit.h
@@ -32,7 +32,7 @@ public:
DWARFTypeUnit(DWARFContext &Context, const DWARFSection &Section,
const DWARFDebugAbbrev *DA, const DWARFSection *RS,
StringRef SS, const DWARFSection &SOS, const DWARFSection *AOS,
- StringRef LS, bool LE, bool IsDWO,
+ const DWARFSection &LS, bool LE, bool IsDWO,
const DWARFUnitSectionBase &UnitSection,
const DWARFUnitIndex::Entry *Entry)
: DWARFUnit(Context, Section, DA, RS, SS, SOS, AOS, LS, LE, IsDWO,
diff --git a/include/llvm/DebugInfo/DWARF/DWARFUnit.h b/include/llvm/DebugInfo/DWARF/DWARFUnit.h
index d7ccaf82bc9a1..ea36ab7ab5b6b 100644
--- a/include/llvm/DebugInfo/DWARF/DWARFUnit.h
+++ b/include/llvm/DebugInfo/DWARF/DWARFUnit.h
@@ -58,7 +58,7 @@ protected:
virtual void parseImpl(DWARFContext &Context, const DWARFSection &Section,
const DWARFDebugAbbrev *DA, const DWARFSection *RS,
StringRef SS, const DWARFSection &SOS,
- const DWARFSection *AOS, StringRef LS,
+ const DWARFSection *AOS, const DWARFSection &LS,
bool isLittleEndian, bool isDWO) = 0;
};
@@ -91,7 +91,7 @@ private:
void parseImpl(DWARFContext &Context, const DWARFSection &Section,
const DWARFDebugAbbrev *DA, const DWARFSection *RS,
StringRef SS, const DWARFSection &SOS, const DWARFSection *AOS,
- StringRef LS, bool LE, bool IsDWO) override {
+ const DWARFSection &LS, bool LE, bool IsDWO) override {
if (Parsed)
return;
const auto &Index = getDWARFUnitIndex(Context, UnitType::Section);
@@ -118,7 +118,7 @@ class DWARFUnit {
const DWARFDebugAbbrev *Abbrev;
const DWARFSection *RangeSection;
uint32_t RangeSectionBase;
- StringRef LineSection;
+ const DWARFSection &LineSection;
StringRef StringSection;
const DWARFSection &StringOffsetSection;
uint64_t StringOffsetSectionBase = 0;
@@ -166,15 +166,16 @@ protected:
public:
DWARFUnit(DWARFContext &Context, const DWARFSection &Section,
const DWARFDebugAbbrev *DA, const DWARFSection *RS, StringRef SS,
- const DWARFSection &SOS, const DWARFSection *AOS, StringRef LS,
- bool LE, bool IsDWO, const DWARFUnitSectionBase &UnitSection,
+ const DWARFSection &SOS, const DWARFSection *AOS,
+ const DWARFSection &LS, bool LE, bool IsDWO,
+ const DWARFUnitSectionBase &UnitSection,
const DWARFUnitIndex::Entry *IndexEntry = nullptr);
virtual ~DWARFUnit();
DWARFContext& getContext() const { return Context; }
- StringRef getLineSection() const { return LineSection; }
+ const DWARFSection &getLineSection() const { return LineSection; }
StringRef getStringSection() const { return StringSection; }
const DWARFSection &getStringOffsetSection() const {
return StringOffsetSection;
@@ -194,13 +195,11 @@ public:
}
bool getAddrOffsetSectionItem(uint32_t Index, uint64_t &Result) const;
- // FIXME: Result should be uint64_t in DWARF64.
bool getStringOffsetSectionItem(uint32_t Index, uint64_t &Result) const;
- uint64_t getStringOffsetSectionRelocation(uint32_t Index) const;
- DataExtractor getDebugInfoExtractor() const {
- return DataExtractor(InfoSection.Data, isLittleEndian,
- getAddressByteSize());
+ DWARFDataExtractor getDebugInfoExtractor() const {
+ return DWARFDataExtractor(InfoSection, isLittleEndian,
+ getAddressByteSize());
}
DataExtractor getStringExtractor() const {
diff --git a/include/llvm/DebugInfo/PDB/IPDBDataStream.h b/include/llvm/DebugInfo/PDB/IPDBDataStream.h
index 9594dc1591a76..67b5a06d7c59e 100644
--- a/include/llvm/DebugInfo/PDB/IPDBDataStream.h
+++ b/include/llvm/DebugInfo/PDB/IPDBDataStream.h
@@ -1,4 +1,4 @@
-//===- IPDBDataStream.h - base interface for child enumerator -*- C++ ---*-===//
+//===- IPDBDataStream.h - base interface for child enumerator ---*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -10,9 +10,10 @@
#ifndef LLVM_DEBUGINFO_PDB_IPDBDATASTREAM_H
#define LLVM_DEBUGINFO_PDB_IPDBDATASTREAM_H
-#include "PDBTypes.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/SmallVector.h"
+#include <cstdint>
+#include <string>
namespace llvm {
namespace pdb {
@@ -22,18 +23,19 @@ namespace pdb {
/// stream type.
class IPDBDataStream {
public:
- typedef llvm::SmallVector<uint8_t, 32> RecordType;
+ using RecordType = SmallVector<uint8_t, 32>;
virtual ~IPDBDataStream();
virtual uint32_t getRecordCount() const = 0;
virtual std::string getName() const = 0;
- virtual llvm::Optional<RecordType> getItemAtIndex(uint32_t Index) const = 0;
+ virtual Optional<RecordType> getItemAtIndex(uint32_t Index) const = 0;
virtual bool getNext(RecordType &Record) = 0;
virtual void reset() = 0;
virtual IPDBDataStream *clone() const = 0;
};
-}
-}
-#endif
+} // end namespace pdb
+} // end namespace llvm
+
+#endif // LLVM_DEBUGINFO_PDB_IPDBDATASTREAM_H
diff --git a/include/llvm/DebugInfo/PDB/IPDBEnumChildren.h b/include/llvm/DebugInfo/PDB/IPDBEnumChildren.h
index e48dc250822e0..b6b7d95f6282d 100644
--- a/include/llvm/DebugInfo/PDB/IPDBEnumChildren.h
+++ b/include/llvm/DebugInfo/PDB/IPDBEnumChildren.h
@@ -18,8 +18,8 @@ namespace pdb {
template <typename ChildType> class IPDBEnumChildren {
public:
- typedef std::unique_ptr<ChildType> ChildTypePtr;
- typedef IPDBEnumChildren<ChildType> MyType;
+ using ChildTypePtr = std::unique_ptr<ChildType>;
+ using MyType = IPDBEnumChildren<ChildType>;
virtual ~IPDBEnumChildren() = default;
diff --git a/include/llvm/DebugInfo/PDB/Native/DbiModuleList.h b/include/llvm/DebugInfo/PDB/Native/DbiModuleList.h
index 2885081628f6b..5f6e7ab92a967 100644
--- a/include/llvm/DebugInfo/PDB/Native/DbiModuleList.h
+++ b/include/llvm/DebugInfo/PDB/Native/DbiModuleList.h
@@ -7,22 +7,23 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_DEBUGINFO_PDB_RAW_DBIMODULELIST_H
-#define LLVM_DEBUGINFO_PDB_RAW_DBIMODULELIST_H
+#ifndef LLVM_DEBUGINFO_PDB_NATIVE_DBIMODULELIST_H
+#define LLVM_DEBUGINFO_PDB_NATIVE_DBIMODULELIST_H
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/iterator.h"
-#include "llvm/DebugInfo/CodeView/DebugChecksumsSubsection.h"
+#include "llvm/ADT/iterator_range.h"
#include "llvm/DebugInfo/PDB/Native/DbiModuleDescriptor.h"
#include "llvm/Support/BinaryStreamArray.h"
#include "llvm/Support/BinaryStreamRef.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/Error.h"
+#include <cstddef>
#include <cstdint>
+#include <iterator>
#include <vector>
namespace llvm {
-namespace codeview {}
namespace pdb {
class DbiModuleList;
@@ -31,9 +32,9 @@ struct FileInfoSubstreamHeader;
class DbiModuleSourceFilesIterator
: public iterator_facade_base<DbiModuleSourceFilesIterator,
std::random_access_iterator_tag, StringRef> {
- typedef iterator_facade_base<DbiModuleSourceFilesIterator,
- std::random_access_iterator_tag, StringRef>
- BaseType;
+ using BaseType =
+ iterator_facade_base<DbiModuleSourceFilesIterator,
+ std::random_access_iterator_tag, StringRef>;
public:
DbiModuleSourceFilesIterator(const DbiModuleList &Modules, uint32_t Modi,
@@ -110,7 +111,8 @@ private:
BinaryStreamRef FileInfoSubstream;
BinaryStreamRef NamesBuffer;
};
-}
-}
-#endif // LLVM_DEBUGINFO_PDB_RAW_DBIMODULELIST_H \ No newline at end of file
+} // end namespace pdb
+} // end namespace llvm
+
+#endif // LLVM_DEBUGINFO_PDB_NATIVE_DBIMODULELIST_H
diff --git a/include/llvm/DebugInfo/PDB/Native/Hash.h b/include/llvm/DebugInfo/PDB/Native/Hash.h
index 0340554d7b0b3..1f11d43ecdd4e 100644
--- a/include/llvm/DebugInfo/PDB/Native/Hash.h
+++ b/include/llvm/DebugInfo/PDB/Native/Hash.h
@@ -7,19 +7,21 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_DEBUGINFO_PDB_RAW_HASH_H
-#define LLVM_DEBUGINFO_PDB_RAW_HASH_H
+#ifndef LLVM_DEBUGINFO_PDB_NATIVE_HASH_H
+#define LLVM_DEBUGINFO_PDB_NATIVE_HASH_H
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringRef.h"
-#include <stdint.h>
+#include <cstdint>
namespace llvm {
namespace pdb {
+
uint32_t hashStringV1(StringRef Str);
uint32_t hashStringV2(StringRef Str);
uint32_t hashBufferV8(ArrayRef<uint8_t> Data);
-}
-}
-#endif
+} // end namespace pdb
+} // end namespace llvm
+
+#endif // LLVM_DEBUGINFO_PDB_NATIVE_HASH_H
diff --git a/include/llvm/DebugInfo/PDB/Native/HashTable.h b/include/llvm/DebugInfo/PDB/Native/HashTable.h
index 46eefa968e523..05c70c4f2175a 100644
--- a/include/llvm/DebugInfo/PDB/Native/HashTable.h
+++ b/include/llvm/DebugInfo/PDB/Native/HashTable.h
@@ -7,36 +7,36 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_DEBUGINFO_PDB_RAW_HASHTABLE_H
-#define LLVM_DEBUGINFO_PDB_RAW_HASHTABLE_H
+#ifndef LLVM_DEBUGINFO_PDB_NATIVE_HASHTABLE_H
+#define LLVM_DEBUGINFO_PDB_NATIVE_HASHTABLE_H
-#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/SparseBitVector.h"
-#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/iterator.h"
-#include "llvm/Support/BinaryStreamArray.h"
-#include "llvm/Support/BinaryStreamReader.h"
-#include "llvm/Support/BinaryStreamWriter.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/Error.h"
-#include "llvm/Support/MathExtras.h"
-
#include <cstdint>
+#include <iterator>
#include <utility>
+#include <vector>
namespace llvm {
+
+class BinaryStreamReader;
+class BinaryStreamWriter;
+
namespace pdb {
class HashTableIterator;
class HashTable {
friend class HashTableIterator;
+
struct Header {
support::ulittle32_t Size;
support::ulittle32_t Capacity;
};
- typedef std::vector<std::pair<uint32_t, uint32_t>> BucketList;
+ using BucketList = std::vector<std::pair<uint32_t, uint32_t>>;
public:
HashTable();
@@ -63,6 +63,7 @@ public:
protected:
bool isPresent(uint32_t K) const { return Present.test(K); }
bool isDeleted(uint32_t K) const { return Deleted.test(K); }
+
BucketList Buckets;
mutable SparseBitVector<> Present;
mutable SparseBitVector<> Deleted;
@@ -81,6 +82,7 @@ class HashTableIterator
: public iterator_facade_base<HashTableIterator, std::forward_iterator_tag,
std::pair<uint32_t, uint32_t>> {
friend class HashTable;
+
HashTableIterator(const HashTable &Map, uint32_t Index, bool IsEnd);
public:
@@ -101,6 +103,7 @@ private:
};
} // end namespace pdb
+
} // end namespace llvm
-#endif // LLVM_DEBUGINFO_PDB_RAW_HASHTABLE_H
+#endif // LLVM_DEBUGINFO_PDB_NATIVE_HASHTABLE_H
diff --git a/include/llvm/DebugInfo/PDB/Native/ModuleDebugStream.h b/include/llvm/DebugInfo/PDB/Native/ModuleDebugStream.h
index 5565cd5582bc9..f413fd1b336ec 100644
--- a/include/llvm/DebugInfo/PDB/Native/ModuleDebugStream.h
+++ b/include/llvm/DebugInfo/PDB/Native/ModuleDebugStream.h
@@ -1,4 +1,4 @@
-//===- ModuleDebugStream.h - PDB Module Info Stream Access ----------------===//
+//===- ModuleDebugStream.h - PDB Module Info Stream Access ------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -7,26 +7,26 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_DEBUGINFO_PDB_RAW_MODULEDEBUGSTREAM_H
-#define LLVM_DEBUGINFO_PDB_RAW_MODULEDEBUGSTREAM_H
+#ifndef LLVM_DEBUGINFO_PDB_NATIVE_MODULEDEBUGSTREAM_H
+#define LLVM_DEBUGINFO_PDB_NATIVE_MODULEDEBUGSTREAM_H
#include "llvm/ADT/iterator_range.h"
-#include "llvm/DebugInfo/CodeView/CVRecord.h"
#include "llvm/DebugInfo/CodeView/DebugChecksumsSubsection.h"
#include "llvm/DebugInfo/CodeView/DebugSubsectionRecord.h"
#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
#include "llvm/DebugInfo/MSF/MappedBlockStream.h"
-#include "llvm/Support/BinaryStreamArray.h"
#include "llvm/Support/BinaryStreamRef.h"
#include "llvm/Support/Error.h"
+#include <cstdint>
+#include <memory>
namespace llvm {
namespace pdb {
-class PDBFile;
+
class DbiModuleDescriptor;
class ModuleDebugStreamRef {
- typedef codeview::DebugSubsectionArray::Iterator DebugSubsectionIterator;
+ using DebugSubsectionIterator = codeview::DebugSubsectionArray::Iterator;
public:
ModuleDebugStreamRef(const DbiModuleDescriptor &Module,
@@ -50,7 +50,7 @@ public:
ModuleDebugStreamRef &operator=(ModuleDebugStreamRef &&Other) = default;
- llvm::iterator_range<DebugSubsectionIterator> subsections() const;
+ iterator_range<DebugSubsectionIterator> subsections() const;
bool hasDebugSubsections() const;
@@ -75,7 +75,8 @@ private:
codeview::DebugSubsectionArray Subsections;
};
-}
-}
-#endif
+} // end namespace pdb
+} // end namespace llvm
+
+#endif // LLVM_DEBUGINFO_PDB_NATIVE_MODULEDEBUGSTREAM_H
diff --git a/include/llvm/DebugInfo/PDB/Native/ModuleDebugStreamBuilder.h b/include/llvm/DebugInfo/PDB/Native/ModuleDebugStreamBuilder.h
deleted file mode 100644
index e69de29bb2d1d..0000000000000
--- a/include/llvm/DebugInfo/PDB/Native/ModuleDebugStreamBuilder.h
+++ /dev/null
diff --git a/include/llvm/DebugInfo/PDB/Native/NamedStreamMap.h b/include/llvm/DebugInfo/PDB/Native/NamedStreamMap.h
index d4206503e7dca..25f66240a6a24 100644
--- a/include/llvm/DebugInfo/PDB/Native/NamedStreamMap.h
+++ b/include/llvm/DebugInfo/PDB/Native/NamedStreamMap.h
@@ -7,27 +7,31 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_DEBUGINFO_PDB_RAW_PDBNAMEDSTREAMMAP_H
-#define LLVM_DEBUGINFO_PDB_RAW_PDBNAMEDSTREAMMAP_H
+#ifndef LLVM_DEBUGINFO_PDB_NATIVE_NAMEDSTREAMMAP_H
+#define LLVM_DEBUGINFO_PDB_NATIVE_NAMEDSTREAMMAP_H
+#include "llvm/ADT/Optional.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/iterator_range.h"
#include "llvm/DebugInfo/PDB/Native/HashTable.h"
#include "llvm/Support/Error.h"
#include <cstdint>
namespace llvm {
+
class BinaryStreamReader;
class BinaryStreamWriter;
namespace pdb {
-class NamedStreamMapBuilder;
+
class NamedStreamMap {
+ friend class NamedStreamMapBuilder;
+
struct FinalizationInfo {
uint32_t StringDataBytes = 0;
uint32_t SerializedLength = 0;
};
- friend NamedStreamMapBuilder;
public:
NamedStreamMap();
@@ -50,6 +54,7 @@ private:
};
} // end namespace pdb
+
} // end namespace llvm
-#endif // LLVM_DEBUGINFO_PDB_RAW_PDBNAMEDSTREAMMAP_H
+#endif // LLVM_DEBUGINFO_PDB_NATIVE_NAMEDSTREAMMAP_H
diff --git a/include/llvm/DebugInfo/PDB/Native/NativeRawSymbol.h b/include/llvm/DebugInfo/PDB/Native/NativeRawSymbol.h
index 5e4aaafff1a90..a24a972879d2c 100644
--- a/include/llvm/DebugInfo/PDB/Native/NativeRawSymbol.h
+++ b/include/llvm/DebugInfo/PDB/Native/NativeRawSymbol.h
@@ -1,4 +1,4 @@
-//===- NativeRawSymbol.h - Native implementation of IPDBRawSymbol - C++ -*-===//
+//==- NativeRawSymbol.h - Native implementation of IPDBRawSymbol -*- C++ -*-==//
//
// The LLVM Compiler Infrastructure
//
@@ -11,6 +11,8 @@
#define LLVM_DEBUGINFO_PDB_NATIVE_NATIVERAWSYMBOL_H
#include "llvm/DebugInfo/PDB/IPDBRawSymbol.h"
+#include <cstdint>
+#include <memory>
namespace llvm {
namespace pdb {
@@ -36,7 +38,7 @@ public:
std::unique_ptr<IPDBEnumSymbols>
findInlineFramesByRVA(uint32_t RVA) const override;
- void getDataBytes(llvm::SmallVector<uint8_t, 32> &Bytes) const override;
+ void getDataBytes(SmallVector<uint8_t, 32> &Bytes) const override;
void getFrontEndVersion(VersionInfo &Version) const override;
void getBackEndVersion(VersionInfo &Version) const override;
PDB_MemberAccess getAccess() const override;
@@ -206,7 +208,7 @@ protected:
uint32_t SymbolId;
};
-}
-}
+} // end namespace pdb
+} // end namespace llvm
-#endif
+#endif // LLVM_DEBUGINFO_PDB_NATIVE_NATIVERAWSYMBOL_H
diff --git a/include/llvm/DebugInfo/PDB/Native/NativeSession.h b/include/llvm/DebugInfo/PDB/Native/NativeSession.h
index bbe207738e021..dd40874dc5f26 100644
--- a/include/llvm/DebugInfo/PDB/Native/NativeSession.h
+++ b/include/llvm/DebugInfo/PDB/Native/NativeSession.h
@@ -7,11 +7,13 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_DEBUGINFO_PDB_RAW_RAWSESSION_H
-#define LLVM_DEBUGINFO_PDB_RAW_RAWSESSION_H
+#ifndef LLVM_DEBUGINFO_PDB_NATIVE_NATIVESESSION_H
+#define LLVM_DEBUGINFO_PDB_NATIVE_NATIVESESSION_H
#include "llvm/ADT/StringRef.h"
#include "llvm/DebugInfo/PDB/IPDBSession.h"
+#include "llvm/DebugInfo/PDB/Native/DbiModuleDescriptor.h"
+#include "llvm/DebugInfo/PDB/Native/NativeRawSymbol.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/Error.h"
@@ -30,6 +32,9 @@ public:
static Error createFromExe(StringRef Path,
std::unique_ptr<IPDBSession> &Session);
+ std::unique_ptr<PDBSymbolCompiland>
+ createCompilandSymbol(DbiModuleDescriptor MI);
+
uint64_t getLoadAddress() const override;
void setLoadAddress(uint64_t Address) override;
std::unique_ptr<PDBSymbolExe> getGlobalScope() override;
@@ -71,6 +76,7 @@ public:
private:
std::unique_ptr<PDBFile> Pdb;
std::unique_ptr<BumpPtrAllocator> Allocator;
+ std::vector<std::unique_ptr<NativeRawSymbol>> SymbolCache;
};
}
}
diff --git a/include/llvm/DebugInfo/PDB/PDB.h b/include/llvm/DebugInfo/PDB/PDB.h
index 1f5a066b9a1bd..9f9da39ca6ccd 100644
--- a/include/llvm/DebugInfo/PDB/PDB.h
+++ b/include/llvm/DebugInfo/PDB/PDB.h
@@ -10,21 +10,23 @@
#ifndef LLVM_DEBUGINFO_PDB_PDB_H
#define LLVM_DEBUGINFO_PDB_PDB_H
-#include "PDBTypes.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/DebugInfo/PDB/PDBTypes.h"
#include "llvm/Support/Error.h"
#include <memory>
-#include <system_error>
namespace llvm {
-class StringRef;
-
namespace pdb {
+class IPDBSession;
+
Error loadDataForPDB(PDB_ReaderType Type, StringRef Path,
std::unique_ptr<IPDBSession> &Session);
Error loadDataForEXE(PDB_ReaderType Type, StringRef Path,
std::unique_ptr<IPDBSession> &Session);
-}
-}
-#endif
+
+} // end namespace pdb
+} // end namespace llvm
+
+#endif // LLVM_DEBUGINFO_PDB_PDB_H
diff --git a/include/llvm/DebugInfo/PDB/PDBExtras.h b/include/llvm/DebugInfo/PDB/PDBExtras.h
index fc5787556a6d1..3a38f21b94c81 100644
--- a/include/llvm/DebugInfo/PDB/PDBExtras.h
+++ b/include/llvm/DebugInfo/PDB/PDBExtras.h
@@ -1,4 +1,4 @@
-//===- PDBExtras.h - helper functions and classes for PDBs -------*- C++-*-===//
+//===- PDBExtras.h - helper functions and classes for PDBs ------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -10,15 +10,17 @@
#ifndef LLVM_DEBUGINFO_PDB_PDBEXTRAS_H
#define LLVM_DEBUGINFO_PDB_PDBEXTRAS_H
-#include "PDBTypes.h"
#include "llvm/DebugInfo/CodeView/CodeView.h"
-#include "llvm/Support/raw_ostream.h"
+#include "llvm/DebugInfo/PDB/PDBTypes.h"
#include <unordered_map>
namespace llvm {
+class raw_ostream;
+
namespace pdb {
-typedef std::unordered_map<PDB_SymType, int> TagStats;
+
+using TagStats = std::unordered_map<PDB_SymType, int>;
raw_ostream &operator<<(raw_ostream &OS, const PDB_VariantType &Value);
raw_ostream &operator<<(raw_ostream &OS, const PDB_CallingConv &Conv);
@@ -37,7 +39,9 @@ raw_ostream &operator<<(raw_ostream &OS, const PDB_Machine &Machine);
raw_ostream &operator<<(raw_ostream &OS, const Variant &Value);
raw_ostream &operator<<(raw_ostream &OS, const VersionInfo &Version);
raw_ostream &operator<<(raw_ostream &OS, const TagStats &Stats);
-}
-}
-#endif
+} // end namespace pdb
+
+} // end namespace llvm
+
+#endif // LLVM_DEBUGINFO_PDB_PDBEXTRAS_H
diff --git a/include/llvm/DebugInfo/PDB/PDBTypes.h b/include/llvm/DebugInfo/PDB/PDBTypes.h
index dd2fc4f2c55f7..79ec7ce906d57 100644
--- a/include/llvm/DebugInfo/PDB/PDBTypes.h
+++ b/include/llvm/DebugInfo/PDB/PDBTypes.h
@@ -1,4 +1,4 @@
-//===- PDBTypes.h - Defines enums for various fields contained in PDB ---*-===//
+//===- PDBTypes.h - Defines enums for various fields contained in PDB ----====//
//
// The LLVM Compiler Infrastructure
//
@@ -10,9 +10,10 @@
#ifndef LLVM_DEBUGINFO_PDB_PDBTYPES_H
#define LLVM_DEBUGINFO_PDB_PDBTYPES_H
-#include "llvm/Config/llvm-config.h"
#include "llvm/DebugInfo/CodeView/CodeView.h"
+#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
#include "llvm/DebugInfo/PDB/Native/RawTypes.h"
+#include <cstddef>
#include <cstdint>
#include <cstring>
#include <functional>
@@ -20,21 +21,11 @@
namespace llvm {
namespace pdb {
-class PDBSymDumper;
-class PDBSymbol;
-
class IPDBDataStream;
-template <class T> class IPDBEnumChildren;
class IPDBLineNumber;
-class IPDBRawSymbol;
-class IPDBSession;
class IPDBSourceFile;
-
-typedef IPDBEnumChildren<PDBSymbol> IPDBEnumSymbols;
-typedef IPDBEnumChildren<IPDBSourceFile> IPDBEnumSourceFiles;
-typedef IPDBEnumChildren<IPDBDataStream> IPDBEnumDataStreams;
-typedef IPDBEnumChildren<IPDBLineNumber> IPDBEnumLineNumbers;
-
+class PDBSymDumper;
+class PDBSymbol;
class PDBSymbolExe;
class PDBSymbolCompiland;
class PDBSymbolCompilandDetails;
@@ -67,6 +58,11 @@ class PDBSymbolTypeManaged;
class PDBSymbolTypeDimension;
class PDBSymbolUnknown;
+using IPDBEnumSymbols = IPDBEnumChildren<PDBSymbol>;
+using IPDBEnumSourceFiles = IPDBEnumChildren<IPDBSourceFile>;
+using IPDBEnumDataStreams = IPDBEnumChildren<IPDBDataStream>;
+using IPDBEnumLineNumbers = IPDBEnumChildren<IPDBLineNumber>;
+
/// Specifies which PDB reader implementation is to be used. Only a value
/// of PDB_ReaderType::DIA is currently supported, but Native is in the works.
enum class PDB_ReaderType {
@@ -104,7 +100,7 @@ enum class PDB_Checksum { None = 0, MD5 = 1, SHA1 = 2 };
/// These values correspond to the CV_CPU_TYPE_e enumeration, and are documented
/// here: https://msdn.microsoft.com/en-us/library/b2fc64ek.aspx
-typedef codeview::CPUType PDB_Cpu;
+using PDB_Cpu = codeview::CPUType;
enum class PDB_Machine {
Invalid = 0xffff,
@@ -135,12 +131,11 @@ enum class PDB_Machine {
/// at the following locations:
/// https://msdn.microsoft.com/en-us/library/b2fc64ek.aspx
/// https://msdn.microsoft.com/en-us/library/windows/desktop/ms680207(v=vs.85).aspx
-///
-typedef codeview::CallingConvention PDB_CallingConv;
+using PDB_CallingConv = codeview::CallingConvention;
/// These values correspond to the CV_CFL_LANG enumeration, and are documented
/// here: https://msdn.microsoft.com/en-us/library/bw3aekw6.aspx
-typedef codeview::SourceLanguage PDB_Lang;
+using PDB_Lang = codeview::SourceLanguage;
/// These values correspond to the DataKind enumeration, and are documented
/// here: https://msdn.microsoft.com/en-us/library/b2x2t313.aspx
@@ -273,9 +268,9 @@ enum PDB_VariantType {
};
struct Variant {
- Variant() : Type(PDB_VariantType::Empty) {}
+ Variant() = default;
- Variant(const Variant &Other) : Type(PDB_VariantType::Empty) {
+ Variant(const Variant &Other) {
*this = Other;
}
@@ -284,7 +279,7 @@ struct Variant {
delete[] Value.String;
}
- PDB_VariantType Type;
+ PDB_VariantType Type = PDB_VariantType::Empty;
union {
bool Bool;
int8_t Int8;
@@ -344,18 +339,20 @@ struct Variant {
}
};
+} // end namespace pdb
} // end namespace llvm
-}
namespace std {
+
template <> struct hash<llvm::pdb::PDB_SymType> {
- typedef llvm::pdb::PDB_SymType argument_type;
- typedef std::size_t result_type;
+ using argument_type = llvm::pdb::PDB_SymType;
+ using result_type = std::size_t;
result_type operator()(const argument_type &Arg) const {
return std::hash<int>()(static_cast<int>(Arg));
}
};
+
} // end namespace std
#endif // LLVM_DEBUGINFO_PDB_PDBTYPES_H
diff --git a/include/llvm/DebugInfo/PDB/UDTLayout.h b/include/llvm/DebugInfo/PDB/UDTLayout.h
index 6bc3660fbe517..c4234c191e21c 100644
--- a/include/llvm/DebugInfo/PDB/UDTLayout.h
+++ b/include/llvm/DebugInfo/PDB/UDTLayout.h
@@ -10,30 +10,26 @@
#ifndef LLVM_DEBUGINFO_PDB_UDTLAYOUT_H
#define LLVM_DEBUGINFO_PDB_UDTLAYOUT_H
-#include "PDBSymbol.h"
-#include "PDBTypes.h"
-
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/BitVector.h"
-#include "llvm/ADT/DenseMap.h"
-
-#include <list>
+#include "llvm/ADT/StringRef.h"
+#include "llvm/DebugInfo/PDB/PDBSymbol.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolData.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeBaseClass.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeUDT.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeVTable.h"
+#include "llvm/DebugInfo/PDB/PDBTypes.h"
+#include <cstdint>
#include <memory>
+#include <string>
+#include <vector>
namespace llvm {
-
-class raw_ostream;
-
namespace pdb {
-class PDBSymTypeBaseClass;
-class PDBSymbolData;
-class PDBSymbolTypeUDT;
-class PDBSymbolTypeVTable;
-
-class ClassLayout;
class BaseClassLayout;
-class LayoutItemBase;
+class ClassLayout;
class UDTLayoutBase;
class LayoutItemBase {
@@ -41,7 +37,7 @@ public:
LayoutItemBase(const UDTLayoutBase *Parent, const PDBSymbol *Symbol,
const std::string &Name, uint32_t OffsetInParent,
uint32_t Size, bool IsElided);
- virtual ~LayoutItemBase() {}
+ virtual ~LayoutItemBase() = default;
uint32_t deepPaddingSize() const;
virtual uint32_t immediatePadding() const { return 0; }
@@ -79,7 +75,8 @@ public:
VBPtrLayoutItem(const UDTLayoutBase &Parent,
std::unique_ptr<PDBSymbolTypeBuiltin> Sym, uint32_t Offset,
uint32_t Size);
- virtual bool isVBPtr() const { return true; }
+
+ bool isVBPtr() const override { return true; }
private:
std::unique_ptr<PDBSymbolTypeBuiltin> Type;
@@ -120,17 +117,12 @@ public:
bool IsElided);
uint32_t tailPadding() const override;
-
ArrayRef<LayoutItemBase *> layout_items() const { return LayoutItems; }
-
ArrayRef<BaseClassLayout *> bases() const { return AllBases; }
ArrayRef<BaseClassLayout *> regular_bases() const { return NonVirtualBases; }
ArrayRef<BaseClassLayout *> virtual_bases() const { return VirtualBases; }
-
uint32_t directVirtualBaseCount() const { return DirectVBaseCount; }
-
ArrayRef<std::unique_ptr<PDBSymbolFunc>> funcs() const { return Funcs; }
-
ArrayRef<std::unique_ptr<PDBSymbol>> other_items() const { return Other; }
protected:
@@ -183,7 +175,8 @@ private:
std::unique_ptr<PDBSymbolTypeUDT> OwnedStorage;
const PDBSymbolTypeUDT &UDT;
};
-}
-} // namespace llvm
+
+} // end namespace pdb
+} // end namespace llvm
#endif // LLVM_DEBUGINFO_PDB_UDTLAYOUT_H