aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/llvm/lib/DebugInfo/PDB
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm-project/llvm/lib/DebugInfo/PDB')
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.cpp12
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/DbiModuleList.cpp1
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/DbiStream.cpp2
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp13
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/EnumTables.cpp1
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/FormatUtil.cpp207
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/GSIStreamBuilder.cpp9
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/GlobalsStream.cpp3
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/HashTable.cpp3
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/InfoStream.cpp4
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/InfoStreamBuilder.cpp4
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/InjectedSourceStream.cpp2
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/InputFile.cpp587
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/LinePrinter.cpp340
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/ModuleDebugStream.cpp7
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NamedStreamMap.cpp4
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeCompilandSymbol.cpp2
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeEnumGlobals.cpp4
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeEnumInjectedSources.cpp4
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeEnumLineNumbers.cpp8
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeEnumModules.cpp5
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeEnumSymbols.cpp4
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeEnumTypes.cpp9
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeExeSymbol.cpp6
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeFunctionSymbol.cpp10
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeInlineSiteSymbol.cpp68
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeLineNumber.cpp1
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativePublicSymbol.cpp5
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeRawSymbol.cpp1
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeSession.cpp26
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeSourceFile.cpp2
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeSymbolEnumerator.cpp4
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeTypeArray.cpp9
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeTypeBuiltin.cpp3
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeTypeEnum.cpp20
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeTypeFunctionSig.cpp5
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeTypePointer.cpp5
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeTypeTypedef.cpp4
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeTypeUDT.cpp13
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeTypeVTShape.cpp5
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/PDBFile.cpp1
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp21
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/PDBStringTable.cpp1
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/PDBStringTableBuilder.cpp7
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/PublicsStream.cpp4
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/SymbolCache.cpp15
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/SymbolStream.cpp5
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/TpiStreamBuilder.cpp6
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDB.cpp1
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBContext.cpp9
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBExtras.cpp2
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbol.cpp2
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolAnnotation.cpp2
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolBlock.cpp3
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolCompiland.cpp3
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolCompilandDetails.cpp3
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolCompilandEnv.cpp4
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolCustom.cpp3
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolData.cpp3
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolExe.cpp4
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolFunc.cpp2
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolFuncDebugEnd.cpp3
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolFuncDebugStart.cpp4
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolLabel.cpp2
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolPublicSymbol.cpp4
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolThunk.cpp2
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeArray.cpp2
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeBaseClass.cpp4
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeBuiltin.cpp2
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeCustom.cpp3
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeDimension.cpp3
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeEnum.cpp3
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeFriend.cpp3
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeFunctionArg.cpp2
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeManaged.cpp3
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypePointer.cpp3
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeTypedef.cpp2
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeUDT.cpp10
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeVTable.cpp2
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeVTableShape.cpp3
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolUnknown.cpp3
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolUsingNamespace.cpp3
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/PDB/UDTLayout.cpp3
83 files changed, 1375 insertions, 217 deletions
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.cpp
index b6f11a942a26..c12ac38c2317 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.cpp
@@ -10,12 +10,10 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/BinaryFormat/COFF.h"
+#include "llvm/DebugInfo/CodeView/CodeView.h"
#include "llvm/DebugInfo/CodeView/DebugSubsectionRecord.h"
#include "llvm/DebugInfo/MSF/MSFBuilder.h"
-#include "llvm/DebugInfo/MSF/MSFCommon.h"
#include "llvm/DebugInfo/MSF/MappedBlockStream.h"
-#include "llvm/DebugInfo/PDB/Native/DbiModuleDescriptor.h"
-#include "llvm/DebugInfo/PDB/Native/GSIStreamBuilder.h"
#include "llvm/DebugInfo/PDB/Native/RawConstants.h"
#include "llvm/DebugInfo/PDB/Native/RawError.h"
#include "llvm/Support/BinaryStreamWriter.h"
@@ -25,6 +23,12 @@ using namespace llvm::codeview;
using namespace llvm::msf;
using namespace llvm::pdb;
+namespace llvm {
+namespace codeview {
+class DebugSubsection;
+}
+} // namespace llvm
+
static uint32_t calculateDiSymbolStreamSize(uint32_t SymbolByteSize,
uint32_t C13Size) {
uint32_t Size = sizeof(uint32_t); // Signature
@@ -44,7 +48,7 @@ DbiModuleDescriptorBuilder::DbiModuleDescriptorBuilder(StringRef ModuleName,
Layout.Mod = ModIndex;
}
-DbiModuleDescriptorBuilder::~DbiModuleDescriptorBuilder() {}
+DbiModuleDescriptorBuilder::~DbiModuleDescriptorBuilder() = default;
uint16_t DbiModuleDescriptorBuilder::getStreamIndex() const {
return Layout.ModDiStream;
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/DbiModuleList.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/DbiModuleList.cpp
index 5cf014e881cd..009cd113f652 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/DbiModuleList.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/DbiModuleList.cpp
@@ -10,6 +10,7 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/iterator_range.h"
#include "llvm/DebugInfo/PDB/Native/RawError.h"
+#include "llvm/DebugInfo/PDB/Native/RawTypes.h"
#include "llvm/Support/BinaryStreamReader.h"
#include "llvm/Support/Error.h"
#include <algorithm>
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/DbiStream.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/DbiStream.cpp
index 4eb16804171d..1a2267334049 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/DbiStream.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/DbiStream.cpp
@@ -9,7 +9,6 @@
#include "llvm/DebugInfo/PDB/Native/DbiStream.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/DebugInfo/MSF/MappedBlockStream.h"
-#include "llvm/DebugInfo/PDB/Native/DbiModuleDescriptor.h"
#include "llvm/DebugInfo/PDB/Native/ISectionContribVisitor.h"
#include "llvm/DebugInfo/PDB/Native/PDBFile.h"
#include "llvm/DebugInfo/PDB/Native/RawConstants.h"
@@ -20,7 +19,6 @@
#include "llvm/Support/BinaryStreamArray.h"
#include "llvm/Support/BinaryStreamReader.h"
#include "llvm/Support/Error.h"
-#include <algorithm>
#include <cstddef>
#include <cstdint>
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp
index 0584966a98c5..3a719bd07c8a 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp
@@ -14,7 +14,6 @@
#include "llvm/DebugInfo/MSF/MSFBuilder.h"
#include "llvm/DebugInfo/MSF/MappedBlockStream.h"
#include "llvm/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.h"
-#include "llvm/DebugInfo/PDB/Native/DbiStream.h"
#include "llvm/DebugInfo/PDB/Native/RawError.h"
#include "llvm/Object/COFF.h"
#include "llvm/Support/BinaryStreamWriter.h"
@@ -30,7 +29,7 @@ DbiStreamBuilder::DbiStreamBuilder(msf::MSFBuilder &Msf)
PdbDllVersion(0), PdbDllRbld(0), Flags(0), MachineType(PDB_Machine::x86),
Header(nullptr) {}
-DbiStreamBuilder::~DbiStreamBuilder() {}
+DbiStreamBuilder::~DbiStreamBuilder() = default;
void DbiStreamBuilder::setVersionHeader(PdbRaw_DbiVer V) { VerHeader = V; }
@@ -72,7 +71,7 @@ void DbiStreamBuilder::setPublicsStreamIndex(uint32_t Index) {
}
void DbiStreamBuilder::addNewFpoData(const codeview::FrameData &FD) {
- if (!NewFpoData.hasValue())
+ if (!NewFpoData)
NewFpoData.emplace(false);
NewFpoData->addFrameData(FD);
@@ -286,7 +285,7 @@ Error DbiStreamBuilder::finalize() {
}
Error DbiStreamBuilder::finalizeMsfLayout() {
- if (NewFpoData.hasValue()) {
+ if (NewFpoData) {
DbgStreams[(int)DbgHeaderType::NewFPO].emplace();
DbgStreams[(int)DbgHeaderType::NewFPO]->Size =
NewFpoData->calculateSerializedSize();
@@ -307,7 +306,7 @@ Error DbiStreamBuilder::finalizeMsfLayout() {
}
for (auto &S : DbgStreams) {
- if (!S.hasValue())
+ if (!S)
continue;
auto ExpectedIndex = Msf.addStream(S->Size);
if (!ExpectedIndex)
@@ -428,14 +427,14 @@ Error DbiStreamBuilder::commit(const msf::MSFLayout &Layout,
for (auto &Stream : DbgStreams) {
uint16_t StreamNumber = kInvalidStreamIndex;
- if (Stream.hasValue())
+ if (Stream)
StreamNumber = Stream->StreamNumber;
if (auto EC = Writer.writeInteger(StreamNumber))
return EC;
}
for (auto &Stream : DbgStreams) {
- if (!Stream.hasValue())
+ if (!Stream)
continue;
assert(Stream->StreamNumber != kInvalidStreamIndex);
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/EnumTables.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/EnumTables.cpp
index 37192ba36a04..32bad9cea7ce 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/EnumTables.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/EnumTables.cpp
@@ -8,6 +8,7 @@
#include "llvm/DebugInfo/PDB/Native/EnumTables.h"
#include "llvm/DebugInfo/PDB/Native/RawConstants.h"
+#include "llvm/Support/ScopedPrinter.h"
using namespace llvm;
using namespace llvm::pdb;
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/FormatUtil.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/FormatUtil.cpp
new file mode 100644
index 000000000000..a167d45982a9
--- /dev/null
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/FormatUtil.cpp
@@ -0,0 +1,207 @@
+//===- FormatUtil.cpp ----------------------------------------- *- C++ --*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/DebugInfo/PDB/Native/FormatUtil.h"
+
+#include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/StringExtras.h"
+#include "llvm/BinaryFormat/COFF.h"
+#include "llvm/DebugInfo/CodeView/CodeView.h"
+#include "llvm/Support/FormatAdapters.h"
+#include "llvm/Support/FormatVariadic.h"
+
+using namespace llvm;
+using namespace llvm::codeview;
+using namespace llvm::pdb;
+
+std::string llvm::pdb::typesetItemList(ArrayRef<std::string> Opts,
+ uint32_t IndentLevel, uint32_t GroupSize,
+ StringRef Sep) {
+ std::string Result;
+ while (!Opts.empty()) {
+ ArrayRef<std::string> ThisGroup;
+ ThisGroup = Opts.take_front(GroupSize);
+ Opts = Opts.drop_front(ThisGroup.size());
+ Result += join(ThisGroup, Sep);
+ if (!Opts.empty()) {
+ Result += Sep;
+ Result += "\n";
+ Result += std::string(formatv("{0}", fmt_repeat(' ', IndentLevel)));
+ }
+ }
+ return Result;
+}
+
+std::string llvm::pdb::typesetStringList(uint32_t IndentLevel,
+ ArrayRef<StringRef> Strings) {
+ std::string Result = "[";
+ for (const auto &S : Strings) {
+ Result += std::string(formatv("\n{0}{1}", fmt_repeat(' ', IndentLevel), S));
+ }
+ Result += "]";
+ return Result;
+}
+
+std::string llvm::pdb::formatChunkKind(DebugSubsectionKind Kind,
+ bool Friendly) {
+ if (Friendly) {
+ switch (Kind) {
+ RETURN_CASE(DebugSubsectionKind, None, "none");
+ RETURN_CASE(DebugSubsectionKind, Symbols, "symbols");
+ RETURN_CASE(DebugSubsectionKind, Lines, "lines");
+ RETURN_CASE(DebugSubsectionKind, StringTable, "strings");
+ RETURN_CASE(DebugSubsectionKind, FileChecksums, "checksums");
+ RETURN_CASE(DebugSubsectionKind, FrameData, "frames");
+ RETURN_CASE(DebugSubsectionKind, InlineeLines, "inlinee lines");
+ RETURN_CASE(DebugSubsectionKind, CrossScopeImports, "xmi");
+ RETURN_CASE(DebugSubsectionKind, CrossScopeExports, "xme");
+ RETURN_CASE(DebugSubsectionKind, ILLines, "il lines");
+ RETURN_CASE(DebugSubsectionKind, FuncMDTokenMap, "func md token map");
+ RETURN_CASE(DebugSubsectionKind, TypeMDTokenMap, "type md token map");
+ RETURN_CASE(DebugSubsectionKind, MergedAssemblyInput,
+ "merged assembly input");
+ RETURN_CASE(DebugSubsectionKind, CoffSymbolRVA, "coff symbol rva");
+ }
+ } else {
+ switch (Kind) {
+ RETURN_CASE(DebugSubsectionKind, None, "none");
+ RETURN_CASE(DebugSubsectionKind, Symbols, "DEBUG_S_SYMBOLS");
+ RETURN_CASE(DebugSubsectionKind, Lines, "DEBUG_S_LINES");
+ RETURN_CASE(DebugSubsectionKind, StringTable, "DEBUG_S_STRINGTABLE");
+ RETURN_CASE(DebugSubsectionKind, FileChecksums, "DEBUG_S_FILECHKSMS");
+ RETURN_CASE(DebugSubsectionKind, FrameData, "DEBUG_S_FRAMEDATA");
+ RETURN_CASE(DebugSubsectionKind, InlineeLines, "DEBUG_S_INLINEELINES");
+ RETURN_CASE(DebugSubsectionKind, CrossScopeImports,
+ "DEBUG_S_CROSSSCOPEIMPORTS");
+ RETURN_CASE(DebugSubsectionKind, CrossScopeExports,
+ "DEBUG_S_CROSSSCOPEEXPORTS");
+ RETURN_CASE(DebugSubsectionKind, ILLines, "DEBUG_S_IL_LINES");
+ RETURN_CASE(DebugSubsectionKind, FuncMDTokenMap,
+ "DEBUG_S_FUNC_MDTOKEN_MAP");
+ RETURN_CASE(DebugSubsectionKind, TypeMDTokenMap,
+ "DEBUG_S_TYPE_MDTOKEN_MAP");
+ RETURN_CASE(DebugSubsectionKind, MergedAssemblyInput,
+ "DEBUG_S_MERGED_ASSEMBLYINPUT");
+ RETURN_CASE(DebugSubsectionKind, CoffSymbolRVA,
+ "DEBUG_S_COFF_SYMBOL_RVA");
+ }
+ }
+ return formatUnknownEnum(Kind);
+}
+
+std::string llvm::pdb::formatSymbolKind(SymbolKind K) {
+ switch (uint32_t(K)) {
+#define SYMBOL_RECORD(EnumName, value, name) \
+ case EnumName: \
+ return #EnumName;
+#define CV_SYMBOL(EnumName, value) SYMBOL_RECORD(EnumName, value, EnumName)
+#include "llvm/DebugInfo/CodeView/CodeViewSymbols.def"
+ }
+ return formatUnknownEnum(K);
+}
+
+std::string llvm::pdb::formatTypeLeafKind(TypeLeafKind K) {
+ switch (K) {
+#define TYPE_RECORD(EnumName, value, name) \
+ case EnumName: \
+ return #EnumName;
+#include "llvm/DebugInfo/CodeView/CodeViewTypes.def"
+ default:
+ return formatv("UNKNOWN RECORD ({0:X})",
+ static_cast<std::underlying_type_t<TypeLeafKind>>(K))
+ .str();
+ }
+}
+
+std::string llvm::pdb::formatSegmentOffset(uint16_t Segment, uint32_t Offset) {
+ return std::string(formatv("{0:4}:{1:4}", Segment, Offset));
+}
+
+#define PUSH_CHARACTERISTIC_FLAG(Enum, TheOpt, Value, Style, Descriptive) \
+ PUSH_FLAG(Enum, TheOpt, Value, \
+ ((Style == CharacteristicStyle::HeaderDefinition) ? #TheOpt \
+ : Descriptive))
+
+#define PUSH_MASKED_CHARACTERISTIC_FLAG(Enum, Mask, TheOpt, Value, Style, \
+ Descriptive) \
+ PUSH_MASKED_FLAG(Enum, Mask, TheOpt, Value, \
+ ((Style == CharacteristicStyle::HeaderDefinition) \
+ ? #TheOpt \
+ : Descriptive))
+
+std::string llvm::pdb::formatSectionCharacteristics(uint32_t IndentLevel,
+ uint32_t C,
+ uint32_t FlagsPerLine,
+ StringRef Separator,
+ CharacteristicStyle Style) {
+ using SC = COFF::SectionCharacteristics;
+ std::vector<std::string> Opts;
+ if (C == COFF::SC_Invalid)
+ return "invalid";
+ if (C == 0)
+ return "none";
+ PUSH_CHARACTERISTIC_FLAG(SC, IMAGE_SCN_TYPE_NOLOAD, C, Style, "noload");
+ PUSH_CHARACTERISTIC_FLAG(SC, IMAGE_SCN_TYPE_NO_PAD, C, Style, "no padding");
+ PUSH_CHARACTERISTIC_FLAG(SC, IMAGE_SCN_CNT_CODE, C, Style, "code");
+ PUSH_CHARACTERISTIC_FLAG(SC, IMAGE_SCN_CNT_INITIALIZED_DATA, C, Style,
+ "initialized data");
+ PUSH_CHARACTERISTIC_FLAG(SC, IMAGE_SCN_CNT_UNINITIALIZED_DATA, C, Style,
+ "uninitialized data");
+ PUSH_CHARACTERISTIC_FLAG(SC, IMAGE_SCN_LNK_OTHER, C, Style, "other");
+ PUSH_CHARACTERISTIC_FLAG(SC, IMAGE_SCN_LNK_INFO, C, Style, "info");
+ PUSH_CHARACTERISTIC_FLAG(SC, IMAGE_SCN_LNK_REMOVE, C, Style, "remove");
+ PUSH_CHARACTERISTIC_FLAG(SC, IMAGE_SCN_LNK_COMDAT, C, Style, "comdat");
+ PUSH_CHARACTERISTIC_FLAG(SC, IMAGE_SCN_GPREL, C, Style, "gp rel");
+ PUSH_CHARACTERISTIC_FLAG(SC, IMAGE_SCN_MEM_PURGEABLE, C, Style, "purgeable");
+ PUSH_CHARACTERISTIC_FLAG(SC, IMAGE_SCN_MEM_16BIT, C, Style, "16-bit");
+ PUSH_CHARACTERISTIC_FLAG(SC, IMAGE_SCN_MEM_LOCKED, C, Style, "locked");
+ PUSH_CHARACTERISTIC_FLAG(SC, IMAGE_SCN_MEM_PRELOAD, C, Style, "preload");
+ PUSH_MASKED_CHARACTERISTIC_FLAG(SC, 0xF00000, IMAGE_SCN_ALIGN_1BYTES, C,
+ Style, "1 byte align");
+ PUSH_MASKED_CHARACTERISTIC_FLAG(SC, 0xF00000, IMAGE_SCN_ALIGN_2BYTES, C,
+ Style, "2 byte align");
+ PUSH_MASKED_CHARACTERISTIC_FLAG(SC, 0xF00000, IMAGE_SCN_ALIGN_4BYTES, C,
+ Style, "4 byte align");
+ PUSH_MASKED_CHARACTERISTIC_FLAG(SC, 0xF00000, IMAGE_SCN_ALIGN_8BYTES, C,
+ Style, "8 byte align");
+ PUSH_MASKED_CHARACTERISTIC_FLAG(SC, 0xF00000, IMAGE_SCN_ALIGN_16BYTES, C,
+ Style, "16 byte align");
+ PUSH_MASKED_CHARACTERISTIC_FLAG(SC, 0xF00000, IMAGE_SCN_ALIGN_32BYTES, C,
+ Style, "32 byte align");
+ PUSH_MASKED_CHARACTERISTIC_FLAG(SC, 0xF00000, IMAGE_SCN_ALIGN_64BYTES, C,
+ Style, "64 byte align");
+ PUSH_MASKED_CHARACTERISTIC_FLAG(SC, 0xF00000, IMAGE_SCN_ALIGN_128BYTES, C,
+ Style, "128 byte align");
+ PUSH_MASKED_CHARACTERISTIC_FLAG(SC, 0xF00000, IMAGE_SCN_ALIGN_256BYTES, C,
+ Style, "256 byte align");
+ PUSH_MASKED_CHARACTERISTIC_FLAG(SC, 0xF00000, IMAGE_SCN_ALIGN_512BYTES, C,
+ Style, "512 byte align");
+ PUSH_MASKED_CHARACTERISTIC_FLAG(SC, 0xF00000, IMAGE_SCN_ALIGN_1024BYTES, C,
+ Style, "1024 byte align");
+ PUSH_MASKED_CHARACTERISTIC_FLAG(SC, 0xF00000, IMAGE_SCN_ALIGN_2048BYTES, C,
+ Style, "2048 byte align");
+ PUSH_MASKED_CHARACTERISTIC_FLAG(SC, 0xF00000, IMAGE_SCN_ALIGN_4096BYTES, C,
+ Style, "4096 byte align");
+ PUSH_MASKED_CHARACTERISTIC_FLAG(SC, 0xF00000, IMAGE_SCN_ALIGN_8192BYTES, C,
+ Style, "8192 byte align");
+ PUSH_CHARACTERISTIC_FLAG(SC, IMAGE_SCN_LNK_NRELOC_OVFL, C, Style,
+ "noreloc overflow");
+ PUSH_CHARACTERISTIC_FLAG(SC, IMAGE_SCN_MEM_DISCARDABLE, C, Style,
+ "discardable");
+ PUSH_CHARACTERISTIC_FLAG(SC, IMAGE_SCN_MEM_NOT_CACHED, C, Style,
+ "not cached");
+ PUSH_CHARACTERISTIC_FLAG(SC, IMAGE_SCN_MEM_NOT_PAGED, C, Style, "not paged");
+ PUSH_CHARACTERISTIC_FLAG(SC, IMAGE_SCN_MEM_SHARED, C, Style, "shared");
+ PUSH_CHARACTERISTIC_FLAG(SC, IMAGE_SCN_MEM_EXECUTE, C, Style,
+ "execute permissions");
+ PUSH_CHARACTERISTIC_FLAG(SC, IMAGE_SCN_MEM_READ, C, Style,
+ "read permissions");
+ PUSH_CHARACTERISTIC_FLAG(SC, IMAGE_SCN_MEM_WRITE, C, Style,
+ "write permissions");
+ return typesetItemList(Opts, IndentLevel, FlagsPerLine, Separator);
+}
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/GSIStreamBuilder.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/GSIStreamBuilder.cpp
index 9084e689d165..262873c6e6ab 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/GSIStreamBuilder.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/GSIStreamBuilder.cpp
@@ -14,7 +14,7 @@
#include "llvm/DebugInfo/PDB/Native/GSIStreamBuilder.h"
#include "llvm/DebugInfo/CodeView/RecordName.h"
-#include "llvm/DebugInfo/CodeView/SymbolDeserializer.h"
+#include "llvm/DebugInfo/CodeView/RecordSerialization.h"
#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
#include "llvm/DebugInfo/CodeView/SymbolSerializer.h"
#include "llvm/DebugInfo/MSF/MSFBuilder.h"
@@ -22,6 +22,7 @@
#include "llvm/DebugInfo/MSF/MappedBlockStream.h"
#include "llvm/DebugInfo/PDB/Native/GlobalsStream.h"
#include "llvm/DebugInfo/PDB/Native/Hash.h"
+#include "llvm/DebugInfo/PDB/Native/RawTypes.h"
#include "llvm/Support/BinaryItemStream.h"
#include "llvm/Support/BinaryStreamWriter.h"
#include "llvm/Support/Parallel.h"
@@ -196,7 +197,7 @@ void GSIStreamBuilder::finalizeGlobalBuckets(uint32_t RecordZeroOffset) {
void GSIHashStreamBuilder::finalizeBuckets(
uint32_t RecordZeroOffset, MutableArrayRef<BulkPublic> Records) {
// Hash every name in parallel.
- parallelForEachN(0, Records.size(), [&](size_t I) {
+ parallelFor(0, Records.size(), [&](size_t I) {
Records[I].setBucketIdx(hashStringV1(Records[I].Name) % IPHR_HASH);
});
@@ -231,7 +232,7 @@ void GSIHashStreamBuilder::finalizeBuckets(
// bucket can properly early-out when it detects the record won't be found.
// The algorithm used here corresponds to the function
// caseInsensitiveComparePchPchCchCch in the reference implementation.
- parallelForEachN(0, IPHR_HASH, [&](size_t I) {
+ parallelFor(0, IPHR_HASH, [&](size_t I) {
auto B = HashRecords.begin() + BucketStarts[I];
auto E = HashRecords.begin() + BucketCursors[I];
if (B == E)
@@ -286,7 +287,7 @@ GSIStreamBuilder::GSIStreamBuilder(msf::MSFBuilder &Msf)
: Msf(Msf), PSH(std::make_unique<GSIHashStreamBuilder>()),
GSH(std::make_unique<GSIHashStreamBuilder>()) {}
-GSIStreamBuilder::~GSIStreamBuilder() {}
+GSIStreamBuilder::~GSIStreamBuilder() = default;
uint32_t GSIStreamBuilder::calculatePublicsHashStreamSize() const {
uint32_t Size = 0;
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/GlobalsStream.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/GlobalsStream.cpp
index f27d60f46815..7217fe38be55 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/GlobalsStream.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/GlobalsStream.cpp
@@ -21,6 +21,7 @@
#include "llvm/DebugInfo/PDB/Native/GlobalsStream.h"
#include "llvm/DebugInfo/CodeView/RecordName.h"
+#include "llvm/DebugInfo/MSF/MappedBlockStream.h"
#include "llvm/DebugInfo/PDB/Native/Hash.h"
#include "llvm/DebugInfo/PDB/Native/RawError.h"
#include "llvm/DebugInfo/PDB/Native/SymbolStream.h"
@@ -141,14 +142,12 @@ readGSIHashBuckets(FixedStreamArray<support::ulittle32_t> &HashBuckets,
return joinErrors(std::move(EC),
make_error<RawError>(raw_error_code::corrupt_file,
"Could not read a bitmap."));
- uint32_t NumBuckets1 = 0;
uint32_t CompressedBucketIdx = 0;
for (uint32_t I = 0; I <= IPHR_HASH; ++I) {
uint8_t WordIdx = I / 32;
uint8_t BitIdx = I % 32;
bool IsSet = HashBitmap[WordIdx] & (1U << BitIdx);
if (IsSet) {
- ++NumBuckets1;
BucketMap[I] = CompressedBucketIdx++;
} else {
BucketMap[I] = -1;
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/HashTable.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/HashTable.cpp
index dfdcdf1f4eaf..030a59821914 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/HashTable.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/HashTable.cpp
@@ -7,14 +7,11 @@
//===----------------------------------------------------------------------===//
#include "llvm/DebugInfo/PDB/Native/HashTable.h"
-#include "llvm/ADT/Optional.h"
#include "llvm/DebugInfo/PDB/Native/RawError.h"
#include "llvm/Support/BinaryStreamReader.h"
#include "llvm/Support/BinaryStreamWriter.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/MathExtras.h"
-#include <algorithm>
-#include <cassert>
#include <cstdint>
#include <utility>
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/InfoStream.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/InfoStream.cpp
index f41bb32d69af..927a0ffee28c 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/InfoStream.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/InfoStream.cpp
@@ -7,8 +7,6 @@
//===----------------------------------------------------------------------===//
#include "llvm/DebugInfo/PDB/Native/InfoStream.h"
-#include "llvm/ADT/BitVector.h"
-#include "llvm/ADT/SmallVector.h"
#include "llvm/DebugInfo/PDB/Native/RawConstants.h"
#include "llvm/DebugInfo/PDB/Native/RawError.h"
#include "llvm/DebugInfo/PDB/Native/RawTypes.h"
@@ -16,7 +14,7 @@
using namespace llvm;
using namespace llvm::codeview;
-using namespace llvm::msf;
+// using namespace llvm::msf;
using namespace llvm::pdb;
InfoStream::InfoStream(std::unique_ptr<BinaryStream> Stream)
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/InfoStreamBuilder.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/InfoStreamBuilder.cpp
index 42daa7cae799..e8f5a451b08e 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/InfoStreamBuilder.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/InfoStreamBuilder.cpp
@@ -10,11 +10,9 @@
#include "llvm/DebugInfo/MSF/MSFBuilder.h"
#include "llvm/DebugInfo/MSF/MappedBlockStream.h"
-#include "llvm/DebugInfo/PDB/Native/InfoStream.h"
#include "llvm/DebugInfo/PDB/Native/NamedStreamMap.h"
-#include "llvm/DebugInfo/PDB/Native/PDBFileBuilder.h"
-#include "llvm/DebugInfo/PDB/Native/RawError.h"
#include "llvm/DebugInfo/PDB/Native/RawTypes.h"
+#include "llvm/Support/BinaryStreamReader.h"
#include "llvm/Support/BinaryStreamWriter.h"
using namespace llvm;
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/InjectedSourceStream.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/InjectedSourceStream.cpp
index 3f4101db7b93..f1e8adeb1b21 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/InjectedSourceStream.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/InjectedSourceStream.cpp
@@ -9,7 +9,7 @@
#include "llvm/DebugInfo/PDB/Native/InjectedSourceStream.h"
#include "llvm/DebugInfo/MSF/MappedBlockStream.h"
-#include "llvm/DebugInfo/PDB/Native/Hash.h"
+#include "llvm/DebugInfo/PDB/Native/HashTable.h"
#include "llvm/DebugInfo/PDB/Native/PDBStringTable.h"
#include "llvm/DebugInfo/PDB/Native/RawConstants.h"
#include "llvm/DebugInfo/PDB/Native/RawTypes.h"
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/InputFile.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/InputFile.cpp
new file mode 100644
index 000000000000..495b25077737
--- /dev/null
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/InputFile.cpp
@@ -0,0 +1,587 @@
+//===- InputFile.cpp ------------------------------------------ *- C++ --*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/DebugInfo/PDB/Native/InputFile.h"
+
+#include "llvm/BinaryFormat/Magic.h"
+#include "llvm/DebugInfo/CodeView/CodeView.h"
+#include "llvm/DebugInfo/CodeView/LazyRandomTypeCollection.h"
+#include "llvm/DebugInfo/CodeView/StringsAndChecksums.h"
+#include "llvm/DebugInfo/MSF/MappedBlockStream.h"
+#include "llvm/DebugInfo/PDB/Native/DbiStream.h"
+#include "llvm/DebugInfo/PDB/Native/FormatUtil.h"
+#include "llvm/DebugInfo/PDB/Native/LinePrinter.h"
+#include "llvm/DebugInfo/PDB/Native/NativeSession.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/TpiStream.h"
+#include "llvm/DebugInfo/PDB/PDB.h"
+#include "llvm/Object/COFF.h"
+#include "llvm/Support/FileSystem.h"
+#include "llvm/Support/FormatVariadic.h"
+
+using namespace llvm;
+using namespace llvm::codeview;
+using namespace llvm::object;
+using namespace llvm::pdb;
+
+InputFile::InputFile() = default;
+InputFile::~InputFile() = default;
+
+Expected<ModuleDebugStreamRef>
+llvm::pdb::getModuleDebugStream(PDBFile &File, StringRef &ModuleName,
+ uint32_t Index) {
+ Expected<DbiStream &> DbiOrErr = File.getPDBDbiStream();
+ if (!DbiOrErr)
+ return DbiOrErr.takeError();
+ DbiStream &Dbi = *DbiOrErr;
+ const auto &Modules = Dbi.modules();
+ if (Index >= Modules.getModuleCount())
+ return make_error<RawError>(raw_error_code::index_out_of_bounds,
+ "Invalid module index");
+
+ auto Modi = Modules.getModuleDescriptor(Index);
+
+ ModuleName = Modi.getModuleName();
+
+ uint16_t ModiStream = Modi.getModuleStreamIndex();
+ if (ModiStream == kInvalidStreamIndex)
+ return make_error<RawError>(raw_error_code::no_stream,
+ "Module stream not present");
+
+ auto ModStreamData = File.createIndexedStream(ModiStream);
+
+ ModuleDebugStreamRef ModS(Modi, std::move(ModStreamData));
+ if (auto EC = ModS.reload())
+ return make_error<RawError>(raw_error_code::corrupt_file,
+ "Invalid module stream");
+
+ return std::move(ModS);
+}
+
+Expected<ModuleDebugStreamRef> llvm::pdb::getModuleDebugStream(PDBFile &File,
+ uint32_t Index) {
+ Expected<DbiStream &> DbiOrErr = File.getPDBDbiStream();
+ if (!DbiOrErr)
+ return DbiOrErr.takeError();
+ DbiStream &Dbi = *DbiOrErr;
+ const auto &Modules = Dbi.modules();
+ auto Modi = Modules.getModuleDescriptor(Index);
+
+ uint16_t ModiStream = Modi.getModuleStreamIndex();
+ if (ModiStream == kInvalidStreamIndex)
+ return make_error<RawError>(raw_error_code::no_stream,
+ "Module stream not present");
+
+ auto ModStreamData = File.createIndexedStream(ModiStream);
+
+ ModuleDebugStreamRef ModS(Modi, std::move(ModStreamData));
+ if (Error Err = ModS.reload())
+ return make_error<RawError>(raw_error_code::corrupt_file,
+ "Invalid module stream");
+
+ return std::move(ModS);
+}
+
+static inline bool isCodeViewDebugSubsection(object::SectionRef Section,
+ StringRef Name,
+ BinaryStreamReader &Reader) {
+ if (Expected<StringRef> NameOrErr = Section.getName()) {
+ if (*NameOrErr != Name)
+ return false;
+ } else {
+ consumeError(NameOrErr.takeError());
+ return false;
+ }
+
+ Expected<StringRef> ContentsOrErr = Section.getContents();
+ if (!ContentsOrErr) {
+ consumeError(ContentsOrErr.takeError());
+ return false;
+ }
+
+ Reader = BinaryStreamReader(*ContentsOrErr, support::little);
+ uint32_t Magic;
+ if (Reader.bytesRemaining() < sizeof(uint32_t))
+ return false;
+ cantFail(Reader.readInteger(Magic));
+ if (Magic != COFF::DEBUG_SECTION_MAGIC)
+ return false;
+ return true;
+}
+
+static inline bool isDebugSSection(object::SectionRef Section,
+ DebugSubsectionArray &Subsections) {
+ BinaryStreamReader Reader;
+ if (!isCodeViewDebugSubsection(Section, ".debug$S", Reader))
+ return false;
+
+ cantFail(Reader.readArray(Subsections, Reader.bytesRemaining()));
+ return true;
+}
+
+static bool isDebugTSection(SectionRef Section, CVTypeArray &Types) {
+ BinaryStreamReader Reader;
+ if (!isCodeViewDebugSubsection(Section, ".debug$T", Reader) &&
+ !isCodeViewDebugSubsection(Section, ".debug$P", Reader))
+ return false;
+ cantFail(Reader.readArray(Types, Reader.bytesRemaining()));
+ return true;
+}
+
+static std::string formatChecksumKind(FileChecksumKind Kind) {
+ switch (Kind) {
+ RETURN_CASE(FileChecksumKind, None, "None");
+ RETURN_CASE(FileChecksumKind, MD5, "MD5");
+ RETURN_CASE(FileChecksumKind, SHA1, "SHA-1");
+ RETURN_CASE(FileChecksumKind, SHA256, "SHA-256");
+ }
+ return formatUnknownEnum(Kind);
+}
+
+template <typename... Args>
+static void formatInternal(LinePrinter &Printer, bool Append, Args &&...args) {
+ if (Append)
+ Printer.format(std::forward<Args>(args)...);
+ else
+ Printer.formatLine(std::forward<Args>(args)...);
+}
+
+SymbolGroup::SymbolGroup(InputFile *File, uint32_t GroupIndex) : File(File) {
+ if (!File)
+ return;
+
+ if (File->isPdb())
+ initializeForPdb(GroupIndex);
+ else {
+ Name = ".debug$S";
+ uint32_t I = 0;
+ for (const auto &S : File->obj().sections()) {
+ DebugSubsectionArray SS;
+ if (!isDebugSSection(S, SS))
+ continue;
+
+ if (!SC.hasChecksums() || !SC.hasStrings())
+ SC.initialize(SS);
+
+ if (I == GroupIndex)
+ Subsections = SS;
+
+ if (SC.hasChecksums() && SC.hasStrings())
+ break;
+ }
+ rebuildChecksumMap();
+ }
+}
+
+StringRef SymbolGroup::name() const { return Name; }
+
+void SymbolGroup::updateDebugS(const codeview::DebugSubsectionArray &SS) {
+ Subsections = SS;
+}
+
+void SymbolGroup::updatePdbModi(uint32_t Modi) { initializeForPdb(Modi); }
+
+void SymbolGroup::initializeForPdb(uint32_t Modi) {
+ assert(File && File->isPdb());
+
+ // PDB always uses the same string table, but each module has its own
+ // checksums. So we only set the strings if they're not already set.
+ if (!SC.hasStrings()) {
+ auto StringTable = File->pdb().getStringTable();
+ if (StringTable)
+ SC.setStrings(StringTable->getStringTable());
+ else
+ consumeError(StringTable.takeError());
+ }
+
+ SC.resetChecksums();
+ auto MDS = getModuleDebugStream(File->pdb(), Name, Modi);
+ if (!MDS) {
+ consumeError(MDS.takeError());
+ return;
+ }
+
+ DebugStream = std::make_shared<ModuleDebugStreamRef>(std::move(*MDS));
+ Subsections = DebugStream->getSubsectionsArray();
+ SC.initialize(Subsections);
+ rebuildChecksumMap();
+}
+
+void SymbolGroup::rebuildChecksumMap() {
+ if (!SC.hasChecksums())
+ return;
+
+ for (const auto &Entry : SC.checksums()) {
+ auto S = SC.strings().getString(Entry.FileNameOffset);
+ if (!S)
+ continue;
+ ChecksumsByFile[*S] = Entry;
+ }
+}
+
+const ModuleDebugStreamRef &SymbolGroup::getPdbModuleStream() const {
+ assert(File && File->isPdb() && DebugStream);
+ return *DebugStream;
+}
+
+Expected<StringRef> SymbolGroup::getNameFromStringTable(uint32_t Offset) const {
+ return SC.strings().getString(Offset);
+}
+
+Expected<StringRef> SymbolGroup::getNameFromChecksums(uint32_t Offset) const {
+ StringRef Name;
+ if (!SC.hasChecksums()) {
+ return std::move(Name);
+ }
+
+ auto Iter = SC.checksums().getArray().at(Offset);
+ if (Iter == SC.checksums().getArray().end()) {
+ return std::move(Name);
+ }
+
+ uint32_t FO = Iter->FileNameOffset;
+ auto ExpectedFile = getNameFromStringTable(FO);
+ if (!ExpectedFile) {
+ return std::move(Name);
+ }
+
+ return *ExpectedFile;
+}
+
+void SymbolGroup::formatFromFileName(LinePrinter &Printer, StringRef File,
+ bool Append) const {
+ auto FC = ChecksumsByFile.find(File);
+ if (FC == ChecksumsByFile.end()) {
+ formatInternal(Printer, Append, "- (no checksum) {0}", File);
+ return;
+ }
+
+ formatInternal(Printer, Append, "- ({0}: {1}) {2}",
+ formatChecksumKind(FC->getValue().Kind),
+ toHex(FC->getValue().Checksum), File);
+}
+
+void SymbolGroup::formatFromChecksumsOffset(LinePrinter &Printer,
+ uint32_t Offset,
+ bool Append) const {
+ if (!SC.hasChecksums()) {
+ formatInternal(Printer, Append, "(unknown file name offset {0})", Offset);
+ return;
+ }
+
+ auto Iter = SC.checksums().getArray().at(Offset);
+ if (Iter == SC.checksums().getArray().end()) {
+ formatInternal(Printer, Append, "(unknown file name offset {0})", Offset);
+ return;
+ }
+
+ uint32_t FO = Iter->FileNameOffset;
+ auto ExpectedFile = getNameFromStringTable(FO);
+ if (!ExpectedFile) {
+ formatInternal(Printer, Append, "(unknown file name offset {0})", Offset);
+ consumeError(ExpectedFile.takeError());
+ return;
+ }
+ if (Iter->Kind == FileChecksumKind::None) {
+ formatInternal(Printer, Append, "{0} (no checksum)", *ExpectedFile);
+ } else {
+ formatInternal(Printer, Append, "{0} ({1}: {2})", *ExpectedFile,
+ formatChecksumKind(Iter->Kind), toHex(Iter->Checksum));
+ }
+}
+
+Expected<InputFile> InputFile::open(StringRef Path, bool AllowUnknownFile) {
+ InputFile IF;
+ if (!llvm::sys::fs::exists(Path))
+ return make_error<StringError>(formatv("File {0} not found", Path),
+ inconvertibleErrorCode());
+
+ file_magic Magic;
+ if (auto EC = identify_magic(Path, Magic))
+ return make_error<StringError>(
+ formatv("Unable to identify file type for file {0}", Path), EC);
+
+ if (Magic == file_magic::coff_object) {
+ Expected<OwningBinary<Binary>> BinaryOrErr = createBinary(Path);
+ if (!BinaryOrErr)
+ return BinaryOrErr.takeError();
+
+ IF.CoffObject = std::move(*BinaryOrErr);
+ IF.PdbOrObj = llvm::cast<COFFObjectFile>(IF.CoffObject.getBinary());
+ return std::move(IF);
+ }
+
+ if (Magic == file_magic::pdb) {
+ std::unique_ptr<IPDBSession> Session;
+ if (auto Err = loadDataForPDB(PDB_ReaderType::Native, Path, Session))
+ return std::move(Err);
+
+ IF.PdbSession.reset(static_cast<NativeSession *>(Session.release()));
+ IF.PdbOrObj = &IF.PdbSession->getPDBFile();
+
+ return std::move(IF);
+ }
+
+ if (!AllowUnknownFile)
+ return make_error<StringError>(
+ formatv("File {0} is not a supported file type", Path),
+ inconvertibleErrorCode());
+
+ auto Result = MemoryBuffer::getFile(Path, /*IsText=*/false,
+ /*RequiresNullTerminator=*/false);
+ if (!Result)
+ return make_error<StringError>(
+ formatv("File {0} could not be opened", Path), Result.getError());
+
+ IF.UnknownFile = std::move(*Result);
+ IF.PdbOrObj = IF.UnknownFile.get();
+ return std::move(IF);
+}
+
+PDBFile &InputFile::pdb() {
+ assert(isPdb());
+ return *PdbOrObj.get<PDBFile *>();
+}
+
+const PDBFile &InputFile::pdb() const {
+ assert(isPdb());
+ return *PdbOrObj.get<PDBFile *>();
+}
+
+object::COFFObjectFile &InputFile::obj() {
+ assert(isObj());
+ return *PdbOrObj.get<object::COFFObjectFile *>();
+}
+
+const object::COFFObjectFile &InputFile::obj() const {
+ assert(isObj());
+ return *PdbOrObj.get<object::COFFObjectFile *>();
+}
+
+MemoryBuffer &InputFile::unknown() {
+ assert(isUnknown());
+ return *PdbOrObj.get<MemoryBuffer *>();
+}
+
+const MemoryBuffer &InputFile::unknown() const {
+ assert(isUnknown());
+ return *PdbOrObj.get<MemoryBuffer *>();
+}
+
+StringRef InputFile::getFilePath() const {
+ if (isPdb())
+ return pdb().getFilePath();
+ if (isObj())
+ return obj().getFileName();
+ assert(isUnknown());
+ return unknown().getBufferIdentifier();
+}
+
+bool InputFile::hasTypes() const {
+ if (isPdb())
+ return pdb().hasPDBTpiStream();
+
+ for (const auto &Section : obj().sections()) {
+ CVTypeArray Types;
+ if (isDebugTSection(Section, Types))
+ return true;
+ }
+ return false;
+}
+
+bool InputFile::hasIds() const {
+ if (isObj())
+ return false;
+ return pdb().hasPDBIpiStream();
+}
+
+bool InputFile::isPdb() const { return PdbOrObj.is<PDBFile *>(); }
+
+bool InputFile::isObj() const {
+ return PdbOrObj.is<object::COFFObjectFile *>();
+}
+
+bool InputFile::isUnknown() const { return PdbOrObj.is<MemoryBuffer *>(); }
+
+codeview::LazyRandomTypeCollection &
+InputFile::getOrCreateTypeCollection(TypeCollectionKind Kind) {
+ if (Types && Kind == kTypes)
+ return *Types;
+ if (Ids && Kind == kIds)
+ return *Ids;
+
+ if (Kind == kIds) {
+ assert(isPdb() && pdb().hasPDBIpiStream());
+ }
+
+ // If the collection was already initialized, we should have just returned it
+ // in step 1.
+ if (isPdb()) {
+ TypeCollectionPtr &Collection = (Kind == kIds) ? Ids : Types;
+ auto &Stream = cantFail((Kind == kIds) ? pdb().getPDBIpiStream()
+ : pdb().getPDBTpiStream());
+
+ auto &Array = Stream.typeArray();
+ uint32_t Count = Stream.getNumTypeRecords();
+ auto Offsets = Stream.getTypeIndexOffsets();
+ Collection =
+ std::make_unique<LazyRandomTypeCollection>(Array, Count, Offsets);
+ return *Collection;
+ }
+
+ assert(isObj());
+ assert(Kind == kTypes);
+ assert(!Types);
+
+ for (const auto &Section : obj().sections()) {
+ CVTypeArray Records;
+ if (!isDebugTSection(Section, Records))
+ continue;
+
+ Types = std::make_unique<LazyRandomTypeCollection>(Records, 100);
+ return *Types;
+ }
+
+ Types = std::make_unique<LazyRandomTypeCollection>(100);
+ return *Types;
+}
+
+codeview::LazyRandomTypeCollection &InputFile::types() {
+ return getOrCreateTypeCollection(kTypes);
+}
+
+codeview::LazyRandomTypeCollection &InputFile::ids() {
+ // Object files have only one type stream that contains both types and ids.
+ // Similarly, some PDBs don't contain an IPI stream, and for those both types
+ // and IDs are in the same stream.
+ if (isObj() || !pdb().hasPDBIpiStream())
+ return types();
+
+ return getOrCreateTypeCollection(kIds);
+}
+
+iterator_range<SymbolGroupIterator> InputFile::symbol_groups() {
+ return make_range<SymbolGroupIterator>(symbol_groups_begin(),
+ symbol_groups_end());
+}
+
+SymbolGroupIterator InputFile::symbol_groups_begin() {
+ return SymbolGroupIterator(*this);
+}
+
+SymbolGroupIterator InputFile::symbol_groups_end() {
+ return SymbolGroupIterator();
+}
+
+SymbolGroupIterator::SymbolGroupIterator() : Value(nullptr) {}
+
+SymbolGroupIterator::SymbolGroupIterator(InputFile &File) : Value(&File) {
+ if (File.isObj()) {
+ SectionIter = File.obj().section_begin();
+ scanToNextDebugS();
+ }
+}
+
+bool SymbolGroupIterator::operator==(const SymbolGroupIterator &R) const {
+ bool E = isEnd();
+ bool RE = R.isEnd();
+ if (E || RE)
+ return E == RE;
+
+ if (Value.File != R.Value.File)
+ return false;
+ return Index == R.Index;
+}
+
+const SymbolGroup &SymbolGroupIterator::operator*() const {
+ assert(!isEnd());
+ return Value;
+}
+SymbolGroup &SymbolGroupIterator::operator*() {
+ assert(!isEnd());
+ return Value;
+}
+
+SymbolGroupIterator &SymbolGroupIterator::operator++() {
+ assert(Value.File && !isEnd());
+ ++Index;
+ if (isEnd())
+ return *this;
+
+ if (Value.File->isPdb()) {
+ Value.updatePdbModi(Index);
+ return *this;
+ }
+
+ scanToNextDebugS();
+ return *this;
+}
+
+void SymbolGroupIterator::scanToNextDebugS() {
+ assert(SectionIter);
+ auto End = Value.File->obj().section_end();
+ auto &Iter = *SectionIter;
+ assert(!isEnd());
+
+ while (++Iter != End) {
+ DebugSubsectionArray SS;
+ SectionRef SR = *Iter;
+ if (!isDebugSSection(SR, SS))
+ continue;
+
+ Value.updateDebugS(SS);
+ return;
+ }
+}
+
+bool SymbolGroupIterator::isEnd() const {
+ if (!Value.File)
+ return true;
+ if (Value.File->isPdb()) {
+ DbiStream &Dbi = cantFail(Value.File->pdb().getPDBDbiStream());
+ uint32_t Count = Dbi.modules().getModuleCount();
+ assert(Index <= Count);
+ return Index == Count;
+ }
+
+ assert(SectionIter);
+ return *SectionIter == Value.File->obj().section_end();
+}
+
+static bool isMyCode(const SymbolGroup &Group) {
+ if (Group.getFile().isObj())
+ return true;
+
+ StringRef Name = Group.name();
+ if (Name.startswith("Import:"))
+ return false;
+ if (Name.endswith_insensitive(".dll"))
+ return false;
+ if (Name.equals_insensitive("* linker *"))
+ return false;
+ if (Name.startswith_insensitive("f:\\binaries\\Intermediate\\vctools"))
+ return false;
+ if (Name.startswith_insensitive("f:\\dd\\vctools\\crt"))
+ return false;
+ return true;
+}
+
+bool llvm::pdb::shouldDumpSymbolGroup(uint32_t Idx, const SymbolGroup &Group,
+ const FilterOptions &Filters) {
+ if (Filters.JustMyCode && !isMyCode(Group))
+ return false;
+
+ // If the arg was not specified on the command line, always dump all modules.
+ if (!Filters.DumpModi)
+ return true;
+
+ // Otherwise, only dump if this is the same module specified.
+ return (Filters.DumpModi == Idx);
+}
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/LinePrinter.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/LinePrinter.cpp
new file mode 100644
index 000000000000..c12fedc23833
--- /dev/null
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/LinePrinter.cpp
@@ -0,0 +1,340 @@
+//===- LinePrinter.cpp ------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/DebugInfo/PDB/Native/LinePrinter.h"
+
+#include "llvm/ADT/STLExtras.h"
+#include "llvm/DebugInfo/CodeView/LazyRandomTypeCollection.h"
+#include "llvm/DebugInfo/MSF/MSFCommon.h"
+#include "llvm/DebugInfo/MSF/MappedBlockStream.h"
+#include "llvm/DebugInfo/PDB/IPDBLineNumber.h"
+#include "llvm/DebugInfo/PDB/Native/InputFile.h"
+#include "llvm/DebugInfo/PDB/Native/NativeSession.h"
+#include "llvm/DebugInfo/PDB/Native/PDBFile.h"
+#include "llvm/DebugInfo/PDB/UDTLayout.h"
+#include "llvm/Object/COFF.h"
+#include "llvm/Support/BinaryStreamReader.h"
+#include "llvm/Support/Format.h"
+#include "llvm/Support/FormatAdapters.h"
+#include "llvm/Support/FormatVariadic.h"
+#include "llvm/Support/Regex.h"
+
+#include <algorithm>
+
+using namespace llvm;
+using namespace llvm::msf;
+using namespace llvm::pdb;
+
+namespace {
+bool IsItemExcluded(llvm::StringRef Item,
+ std::list<llvm::Regex> &IncludeFilters,
+ std::list<llvm::Regex> &ExcludeFilters) {
+ if (Item.empty())
+ return false;
+
+ auto match_pred = [Item](llvm::Regex &R) { return R.match(Item); };
+
+ // Include takes priority over exclude. If the user specified include
+ // filters, and none of them include this item, them item is gone.
+ if (!IncludeFilters.empty() && !any_of(IncludeFilters, match_pred))
+ return true;
+
+ if (any_of(ExcludeFilters, match_pred))
+ return true;
+
+ return false;
+}
+} // namespace
+
+using namespace llvm;
+
+LinePrinter::LinePrinter(int Indent, bool UseColor, llvm::raw_ostream &Stream,
+ const FilterOptions &Filters)
+ : OS(Stream), IndentSpaces(Indent), CurrentIndent(0), UseColor(UseColor),
+ Filters(Filters) {
+ SetFilters(ExcludeTypeFilters, Filters.ExcludeTypes.begin(),
+ Filters.ExcludeTypes.end());
+ SetFilters(ExcludeSymbolFilters, Filters.ExcludeSymbols.begin(),
+ Filters.ExcludeSymbols.end());
+ SetFilters(ExcludeCompilandFilters, Filters.ExcludeCompilands.begin(),
+ Filters.ExcludeCompilands.end());
+
+ SetFilters(IncludeTypeFilters, Filters.IncludeTypes.begin(),
+ Filters.IncludeTypes.end());
+ SetFilters(IncludeSymbolFilters, Filters.IncludeSymbols.begin(),
+ Filters.IncludeSymbols.end());
+ SetFilters(IncludeCompilandFilters, Filters.IncludeCompilands.begin(),
+ Filters.IncludeCompilands.end());
+}
+
+void LinePrinter::Indent(uint32_t Amount) {
+ if (Amount == 0)
+ Amount = IndentSpaces;
+ CurrentIndent += Amount;
+}
+
+void LinePrinter::Unindent(uint32_t Amount) {
+ if (Amount == 0)
+ Amount = IndentSpaces;
+ CurrentIndent = std::max<int>(0, CurrentIndent - Amount);
+}
+
+void LinePrinter::NewLine() {
+ OS << "\n";
+ OS.indent(CurrentIndent);
+}
+
+void LinePrinter::print(const Twine &T) { OS << T; }
+
+void LinePrinter::printLine(const Twine &T) {
+ NewLine();
+ OS << T;
+}
+
+bool LinePrinter::IsClassExcluded(const ClassLayout &Class) {
+ if (IsTypeExcluded(Class.getName(), Class.getSize()))
+ return true;
+ if (Class.deepPaddingSize() < Filters.PaddingThreshold)
+ return true;
+ return false;
+}
+
+void LinePrinter::formatBinary(StringRef Label, ArrayRef<uint8_t> Data,
+ uint64_t StartOffset) {
+ NewLine();
+ OS << Label << " (";
+ if (!Data.empty()) {
+ OS << "\n";
+ OS << format_bytes_with_ascii(Data, StartOffset, 32, 4,
+ CurrentIndent + IndentSpaces, true);
+ NewLine();
+ }
+ OS << ")";
+}
+
+void LinePrinter::formatBinary(StringRef Label, ArrayRef<uint8_t> Data,
+ uint64_t Base, uint64_t StartOffset) {
+ NewLine();
+ OS << Label << " (";
+ if (!Data.empty()) {
+ OS << "\n";
+ Base += StartOffset;
+ OS << format_bytes_with_ascii(Data, Base, 32, 4,
+ CurrentIndent + IndentSpaces, true);
+ NewLine();
+ }
+ OS << ")";
+}
+
+namespace {
+struct Run {
+ Run() = default;
+ explicit Run(uint32_t Block) : Block(Block) {}
+ uint32_t Block = 0;
+ uint64_t ByteLen = 0;
+};
+} // namespace
+
+static std::vector<Run> computeBlockRuns(uint32_t BlockSize,
+ const msf::MSFStreamLayout &Layout) {
+ std::vector<Run> Runs;
+ if (Layout.Length == 0)
+ return Runs;
+
+ ArrayRef<support::ulittle32_t> Blocks = Layout.Blocks;
+ assert(!Blocks.empty());
+ uint64_t StreamBytesRemaining = Layout.Length;
+ uint32_t CurrentBlock = Blocks[0];
+ Runs.emplace_back(CurrentBlock);
+ while (!Blocks.empty()) {
+ Run *CurrentRun = &Runs.back();
+ uint32_t NextBlock = Blocks.front();
+ if (NextBlock < CurrentBlock || (NextBlock - CurrentBlock > 1)) {
+ Runs.emplace_back(NextBlock);
+ CurrentRun = &Runs.back();
+ }
+ uint64_t Used =
+ std::min(static_cast<uint64_t>(BlockSize), StreamBytesRemaining);
+ CurrentRun->ByteLen += Used;
+ StreamBytesRemaining -= Used;
+ CurrentBlock = NextBlock;
+ Blocks = Blocks.drop_front();
+ }
+ return Runs;
+}
+
+static std::pair<Run, uint64_t> findRun(uint64_t Offset, ArrayRef<Run> Runs) {
+ for (const auto &R : Runs) {
+ if (Offset < R.ByteLen)
+ return std::make_pair(R, Offset);
+ Offset -= R.ByteLen;
+ }
+ llvm_unreachable("Invalid offset!");
+}
+
+void LinePrinter::formatMsfStreamData(StringRef Label, PDBFile &File,
+ uint32_t StreamIdx,
+ StringRef StreamPurpose, uint64_t Offset,
+ uint64_t Size) {
+ if (StreamIdx >= File.getNumStreams()) {
+ formatLine("Stream {0}: Not present", StreamIdx);
+ return;
+ }
+ if (Size + Offset > File.getStreamByteSize(StreamIdx)) {
+ formatLine(
+ "Stream {0}: Invalid offset and size, range out of stream bounds",
+ StreamIdx);
+ return;
+ }
+
+ auto S = File.createIndexedStream(StreamIdx);
+ if (!S) {
+ NewLine();
+ formatLine("Stream {0}: Not present", StreamIdx);
+ return;
+ }
+
+ uint64_t End =
+ (Size == 0) ? S->getLength() : std::min(Offset + Size, S->getLength());
+ Size = End - Offset;
+
+ formatLine("Stream {0}: {1} (dumping {2:N} / {3:N} bytes)", StreamIdx,
+ StreamPurpose, Size, S->getLength());
+ AutoIndent Indent(*this);
+ BinaryStreamRef Slice(*S);
+ BinarySubstreamRef Substream;
+ Substream.Offset = Offset;
+ Substream.StreamData = Slice.drop_front(Offset).keep_front(Size);
+
+ auto Layout = File.getStreamLayout(StreamIdx);
+ formatMsfStreamData(Label, File, Layout, Substream);
+}
+
+void LinePrinter::formatMsfStreamData(StringRef Label, PDBFile &File,
+ const msf::MSFStreamLayout &Stream,
+ BinarySubstreamRef Substream) {
+ BinaryStreamReader Reader(Substream.StreamData);
+
+ auto Runs = computeBlockRuns(File.getBlockSize(), Stream);
+
+ NewLine();
+ OS << Label << " (";
+ while (Reader.bytesRemaining() > 0) {
+ OS << "\n";
+
+ Run FoundRun;
+ uint64_t RunOffset;
+ std::tie(FoundRun, RunOffset) = findRun(Substream.Offset, Runs);
+ assert(FoundRun.ByteLen >= RunOffset);
+ uint64_t Len = FoundRun.ByteLen - RunOffset;
+ Len = std::min(Len, Reader.bytesRemaining());
+ uint64_t Base = FoundRun.Block * File.getBlockSize() + RunOffset;
+ ArrayRef<uint8_t> Data;
+ consumeError(Reader.readBytes(Data, Len));
+ OS << format_bytes_with_ascii(Data, Base, 32, 4,
+ CurrentIndent + IndentSpaces, true);
+ if (Reader.bytesRemaining() > 0) {
+ NewLine();
+ OS << formatv(" {0}",
+ fmt_align("<discontinuity>", AlignStyle::Center, 114, '-'));
+ }
+ Substream.Offset += Len;
+ }
+ NewLine();
+ OS << ")";
+}
+
+void LinePrinter::formatMsfStreamBlocks(
+ PDBFile &File, const msf::MSFStreamLayout &StreamLayout) {
+ auto Blocks = makeArrayRef(StreamLayout.Blocks);
+ uint64_t L = StreamLayout.Length;
+
+ while (L > 0) {
+ NewLine();
+ assert(!Blocks.empty());
+ OS << formatv("Block {0} (\n", uint32_t(Blocks.front()));
+ uint64_t UsedBytes =
+ std::min(L, static_cast<uint64_t>(File.getBlockSize()));
+ ArrayRef<uint8_t> BlockData =
+ cantFail(File.getBlockData(Blocks.front(), File.getBlockSize()));
+ uint64_t BaseOffset = Blocks.front();
+ BaseOffset *= File.getBlockSize();
+ OS << format_bytes_with_ascii(BlockData, BaseOffset, 32, 4,
+ CurrentIndent + IndentSpaces, true);
+ NewLine();
+ OS << ")";
+ NewLine();
+ L -= UsedBytes;
+ Blocks = Blocks.drop_front();
+ }
+}
+
+bool LinePrinter::IsTypeExcluded(llvm::StringRef TypeName, uint64_t Size) {
+ if (IsItemExcluded(TypeName, IncludeTypeFilters, ExcludeTypeFilters))
+ return true;
+ if (Size < Filters.SizeThreshold)
+ return true;
+ return false;
+}
+
+bool LinePrinter::IsSymbolExcluded(llvm::StringRef SymbolName) {
+ return IsItemExcluded(SymbolName, IncludeSymbolFilters, ExcludeSymbolFilters);
+}
+
+bool LinePrinter::IsCompilandExcluded(llvm::StringRef CompilandName) {
+ return IsItemExcluded(CompilandName, IncludeCompilandFilters,
+ ExcludeCompilandFilters);
+}
+
+WithColor::WithColor(LinePrinter &P, PDB_ColorItem C)
+ : OS(P.OS), UseColor(P.hasColor()) {
+ if (UseColor)
+ applyColor(C);
+}
+
+WithColor::~WithColor() {
+ if (UseColor)
+ OS.resetColor();
+}
+
+void WithColor::applyColor(PDB_ColorItem C) {
+ switch (C) {
+ case PDB_ColorItem::None:
+ OS.resetColor();
+ return;
+ case PDB_ColorItem::Comment:
+ OS.changeColor(raw_ostream::GREEN, false);
+ return;
+ case PDB_ColorItem::Address:
+ OS.changeColor(raw_ostream::YELLOW, /*bold=*/true);
+ return;
+ case PDB_ColorItem::Keyword:
+ OS.changeColor(raw_ostream::MAGENTA, true);
+ return;
+ case PDB_ColorItem::Register:
+ case PDB_ColorItem::Offset:
+ OS.changeColor(raw_ostream::YELLOW, false);
+ return;
+ case PDB_ColorItem::Type:
+ OS.changeColor(raw_ostream::CYAN, true);
+ return;
+ case PDB_ColorItem::Identifier:
+ OS.changeColor(raw_ostream::CYAN, false);
+ return;
+ case PDB_ColorItem::Path:
+ OS.changeColor(raw_ostream::CYAN, false);
+ return;
+ case PDB_ColorItem::Padding:
+ case PDB_ColorItem::SectionHeader:
+ OS.changeColor(raw_ostream::RED, true);
+ return;
+ case PDB_ColorItem::LiteralValue:
+ OS.changeColor(raw_ostream::GREEN, true);
+ return;
+ }
+}
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/ModuleDebugStream.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/ModuleDebugStream.cpp
index 1445f0bd9e1b..f0e96a7cd659 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/ModuleDebugStream.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/ModuleDebugStream.cpp
@@ -10,16 +10,17 @@
#include "llvm/ADT/iterator_range.h"
#include "llvm/DebugInfo/CodeView/CodeView.h"
#include "llvm/DebugInfo/CodeView/DebugChecksumsSubsection.h"
-#include "llvm/DebugInfo/CodeView/SymbolDeserializer.h"
-#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
#include "llvm/DebugInfo/CodeView/SymbolRecordHelpers.h"
+#include "llvm/DebugInfo/MSF/MSFCommon.h"
+#include "llvm/DebugInfo/MSF/MappedBlockStream.h"
#include "llvm/DebugInfo/PDB/Native/DbiModuleDescriptor.h"
#include "llvm/DebugInfo/PDB/Native/RawConstants.h"
#include "llvm/DebugInfo/PDB/Native/RawError.h"
+#include "llvm/DebugInfo/PDB/Native/RawTypes.h"
+#include "llvm/Support/BinaryStreamArray.h"
#include "llvm/Support/BinaryStreamReader.h"
#include "llvm/Support/BinaryStreamRef.h"
#include "llvm/Support/Error.h"
-#include <algorithm>
#include <cstdint>
using namespace llvm;
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NamedStreamMap.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NamedStreamMap.cpp
index 1d873b87b347..500923e57fbb 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NamedStreamMap.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NamedStreamMap.cpp
@@ -7,21 +7,19 @@
//===----------------------------------------------------------------------===//
#include "llvm/DebugInfo/PDB/Native/NamedStreamMap.h"
+#include "llvm/ADT/SparseBitVector.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
-#include "llvm/ADT/iterator_range.h"
#include "llvm/DebugInfo/PDB/Native/Hash.h"
#include "llvm/DebugInfo/PDB/Native/HashTable.h"
#include "llvm/DebugInfo/PDB/Native/RawError.h"
#include "llvm/Support/BinaryStreamReader.h"
-#include "llvm/Support/BinaryStreamRef.h"
#include "llvm/Support/BinaryStreamWriter.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/Error.h"
#include <algorithm>
#include <cassert>
#include <cstdint>
-#include <tuple>
using namespace llvm;
using namespace llvm::pdb;
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeCompilandSymbol.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeCompilandSymbol.cpp
index 7717f062eac1..d24364312b31 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeCompilandSymbol.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeCompilandSymbol.cpp
@@ -9,8 +9,6 @@
#include "llvm/DebugInfo/PDB/Native/NativeCompilandSymbol.h"
#include "llvm/DebugInfo/PDB/Native/NativeSession.h"
-#include "llvm/ADT/STLExtras.h"
-
namespace llvm {
namespace pdb {
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeEnumGlobals.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeEnumGlobals.cpp
index 54646867bc5f..b861fc2435b8 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeEnumGlobals.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeEnumGlobals.cpp
@@ -8,13 +8,15 @@
#include "llvm/DebugInfo/PDB/Native/NativeEnumGlobals.h"
-#include "llvm/DebugInfo/CodeView/SymbolDeserializer.h"
+#include "llvm/DebugInfo/CodeView/CVRecord.h"
#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
#include "llvm/DebugInfo/PDB/Native/GlobalsStream.h"
#include "llvm/DebugInfo/PDB/Native/NativeSession.h"
#include "llvm/DebugInfo/PDB/Native/PDBFile.h"
+#include "llvm/DebugInfo/PDB/Native/SymbolCache.h"
#include "llvm/DebugInfo/PDB/Native/SymbolStream.h"
#include "llvm/DebugInfo/PDB/PDBSymbol.h"
+#include "llvm/DebugInfo/PDB/PDBTypes.h"
using namespace llvm;
using namespace llvm::codeview;
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeEnumInjectedSources.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeEnumInjectedSources.cpp
index 5e6412275063..65e253ed115f 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeEnumInjectedSources.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeEnumInjectedSources.cpp
@@ -8,9 +8,11 @@
#include "llvm/DebugInfo/PDB/Native/NativeEnumInjectedSources.h"
-#include "llvm/DebugInfo/PDB/Native/InfoStream.h"
+#include "llvm/DebugInfo/MSF/MappedBlockStream.h"
+#include "llvm/DebugInfo/PDB/Native/HashTable.h"
#include "llvm/DebugInfo/PDB/Native/PDBFile.h"
#include "llvm/DebugInfo/PDB/Native/PDBStringTable.h"
+#include "llvm/DebugInfo/PDB/Native/RawTypes.h"
namespace llvm {
namespace pdb {
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeEnumLineNumbers.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeEnumLineNumbers.cpp
index 1e4b07646335..b912bf77e579 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeEnumLineNumbers.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeEnumLineNumbers.cpp
@@ -8,13 +8,11 @@
#include "llvm/DebugInfo/PDB/Native/NativeEnumLineNumbers.h"
-#include "llvm/ADT/STLExtras.h"
-#include "llvm/DebugInfo/CodeView/DebugLinesSubsection.h"
-#include "llvm/DebugInfo/CodeView/DebugSubsectionRecord.h"
+#include "llvm/DebugInfo/CodeView/CodeView.h"
#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
#include "llvm/DebugInfo/PDB/Native/NativeLineNumber.h"
-#include "llvm/DebugInfo/PDB/Native/NativeSession.h"
-#include "llvm/DebugInfo/PDB/Native/NativeSourceFile.h"
+
+#include <vector>
using namespace llvm;
using namespace llvm::codeview;
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeEnumModules.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeEnumModules.cpp
index c6621924b516..7108b8efff83 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeEnumModules.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeEnumModules.cpp
@@ -8,13 +8,10 @@
#include "llvm/DebugInfo/PDB/Native/NativeEnumModules.h"
-#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
-#include "llvm/DebugInfo/PDB/Native/NativeCompilandSymbol.h"
-#include "llvm/DebugInfo/PDB/Native/NativeExeSymbol.h"
#include "llvm/DebugInfo/PDB/Native/NativeSession.h"
+#include "llvm/DebugInfo/PDB/Native/SymbolCache.h"
#include "llvm/DebugInfo/PDB/PDBSymbol.h"
#include "llvm/DebugInfo/PDB/PDBSymbolCompiland.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolExe.h"
namespace llvm {
namespace pdb {
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeEnumSymbols.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeEnumSymbols.cpp
index feede1dbc958..24fe2244cfc5 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeEnumSymbols.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeEnumSymbols.cpp
@@ -8,11 +8,11 @@
#include "llvm/DebugInfo/PDB/Native/NativeEnumSymbols.h"
+#include "llvm/DebugInfo/CodeView/CodeView.h"
#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
#include "llvm/DebugInfo/PDB/Native/NativeSession.h"
-#include "llvm/DebugInfo/PDB/Native/NativeTypeEnum.h"
+#include "llvm/DebugInfo/PDB/Native/SymbolCache.h"
#include "llvm/DebugInfo/PDB/PDBSymbol.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h"
using namespace llvm;
using namespace llvm::codeview;
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeEnumTypes.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeEnumTypes.cpp
index 2524e10cb6c5..6912b8dc838e 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeEnumTypes.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeEnumTypes.cpp
@@ -8,13 +8,16 @@
#include "llvm/DebugInfo/PDB/Native/NativeEnumTypes.h"
-#include "llvm/DebugInfo/CodeView/TypeDeserializer.h"
+#include "llvm/ADT/Optional.h"
+#include "llvm/ADT/STLExtras.h"
+#include "llvm/DebugInfo/CodeView/CVRecord.h"
+#include "llvm/DebugInfo/CodeView/LazyRandomTypeCollection.h"
#include "llvm/DebugInfo/CodeView/TypeRecordHelpers.h"
#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
#include "llvm/DebugInfo/PDB/Native/NativeSession.h"
-#include "llvm/DebugInfo/PDB/Native/NativeTypeEnum.h"
+#include "llvm/DebugInfo/PDB/Native/SymbolCache.h"
#include "llvm/DebugInfo/PDB/PDBSymbol.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h"
+#include "llvm/DebugInfo/PDB/PDBTypes.h"
using namespace llvm;
using namespace llvm::codeview;
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeExeSymbol.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeExeSymbol.cpp
index 895f8943157a..ae0f66c31fde 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeExeSymbol.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeExeSymbol.cpp
@@ -8,14 +8,14 @@
#include "llvm/DebugInfo/PDB/Native/NativeExeSymbol.h"
-#include "llvm/ADT/STLExtras.h"
+#include "llvm/DebugInfo/CodeView/CodeView.h"
+#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
#include "llvm/DebugInfo/PDB/Native/DbiStream.h"
#include "llvm/DebugInfo/PDB/Native/InfoStream.h"
-#include "llvm/DebugInfo/PDB/Native/NativeCompilandSymbol.h"
#include "llvm/DebugInfo/PDB/Native/NativeEnumModules.h"
+#include "llvm/DebugInfo/PDB/Native/NativeSession.h"
#include "llvm/DebugInfo/PDB/Native/PDBFile.h"
#include "llvm/DebugInfo/PDB/Native/SymbolCache.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolCompiland.h"
using namespace llvm;
using namespace llvm::pdb;
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeFunctionSymbol.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeFunctionSymbol.cpp
index 7f3b35c297b4..b1caa5add5b3 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeFunctionSymbol.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeFunctionSymbol.cpp
@@ -8,11 +8,15 @@
#include "llvm/DebugInfo/PDB/Native/NativeFunctionSymbol.h"
+#include "llvm/DebugInfo/CodeView/CVRecord.h"
+#include "llvm/DebugInfo/CodeView/CodeView.h"
#include "llvm/DebugInfo/CodeView/SymbolDeserializer.h"
#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
+#include "llvm/DebugInfo/PDB/Native/ModuleDebugStream.h"
#include "llvm/DebugInfo/PDB/Native/NativeEnumSymbols.h"
-#include "llvm/DebugInfo/PDB/Native/NativeTypeBuiltin.h"
-#include "llvm/DebugInfo/PDB/Native/NativeTypeEnum.h"
+#include "llvm/DebugInfo/PDB/Native/NativeSession.h"
+#include "llvm/DebugInfo/PDB/Native/SymbolCache.h"
+#include "llvm/DebugInfo/PDB/PDBExtras.h"
using namespace llvm;
using namespace llvm::codeview;
@@ -25,7 +29,7 @@ NativeFunctionSymbol::NativeFunctionSymbol(NativeSession &Session,
: NativeRawSymbol(Session, PDB_SymType::Function, Id), Sym(Sym),
RecordOffset(Offset) {}
-NativeFunctionSymbol::~NativeFunctionSymbol() {}
+NativeFunctionSymbol::~NativeFunctionSymbol() = default;
void NativeFunctionSymbol::dump(raw_ostream &OS, int Indent,
PdbSymbolIdField ShowIdFields,
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeInlineSiteSymbol.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeInlineSiteSymbol.cpp
index 8314353c3890..99ec627fcd26 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeInlineSiteSymbol.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeInlineSiteSymbol.cpp
@@ -12,8 +12,14 @@
#include "llvm/DebugInfo/CodeView/LazyRandomTypeCollection.h"
#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
#include "llvm/DebugInfo/CodeView/TypeDeserializer.h"
+#include "llvm/DebugInfo/PDB/Native/ModuleDebugStream.h"
#include "llvm/DebugInfo/PDB/Native/NativeEnumLineNumbers.h"
+#include "llvm/DebugInfo/PDB/Native/NativeLineNumber.h"
+#include "llvm/DebugInfo/PDB/Native/NativeSession.h"
+#include "llvm/DebugInfo/PDB/Native/PDBFile.h"
+#include "llvm/DebugInfo/PDB/Native/SymbolCache.h"
#include "llvm/DebugInfo/PDB/Native/TpiStream.h"
+#include "llvm/DebugInfo/PDB/PDBExtras.h"
using namespace llvm;
using namespace llvm::codeview;
@@ -25,7 +31,7 @@ NativeInlineSiteSymbol::NativeInlineSiteSymbol(
: NativeRawSymbol(Session, PDB_SymType::InlineSite, Id), Sym(Sym),
ParentAddr(ParentAddr) {}
-NativeInlineSiteSymbol::~NativeInlineSiteSymbol() {}
+NativeInlineSiteSymbol::~NativeInlineSiteSymbol() = default;
void NativeInlineSiteSymbol::dump(raw_ostream &OS, int Indent,
PdbSymbolIdField ShowIdFields,
@@ -98,29 +104,81 @@ void NativeInlineSiteSymbol::getLineOffset(uint32_t OffsetInFunc,
LineOffset = 0;
FileOffset = 0;
uint32_t CodeOffset = 0;
+ Optional<uint32_t> CodeOffsetBase;
+ Optional<uint32_t> CodeOffsetEnd;
+ Optional<int32_t> CurLineOffset;
+ Optional<int32_t> NextLineOffset;
+ Optional<uint32_t> NextFileOffset;
+ auto UpdateCodeOffset = [&](uint32_t Delta) {
+ if (!CodeOffsetBase)
+ CodeOffsetBase = CodeOffset;
+ else if (!CodeOffsetEnd)
+ CodeOffsetEnd = *CodeOffsetBase + Delta;
+ };
+ auto UpdateLineOffset = [&](int32_t Delta) {
+ LineOffset += Delta;
+ if (!CodeOffsetBase || !CurLineOffset)
+ CurLineOffset = LineOffset;
+ else
+ NextLineOffset = LineOffset;
+ };
+ auto UpdateFileOffset = [&](uint32_t Offset) {
+ if (!CodeOffsetBase)
+ FileOffset = Offset;
+ else
+ NextFileOffset = Offset;
+ };
+ auto ValidateAndReset = [&]() {
+ // Current range is finished. Check if OffsetInFunc is in the range.
+ if (CodeOffsetBase && CodeOffsetEnd && CurLineOffset) {
+ if (CodeOffsetBase <= OffsetInFunc && OffsetInFunc < CodeOffsetEnd) {
+ LineOffset = *CurLineOffset;
+ return true;
+ }
+ // Set base, end, file offset and line offset for next range.
+ if (NextFileOffset)
+ FileOffset = *NextFileOffset;
+ if (NextLineOffset) {
+ CurLineOffset = NextLineOffset;
+ NextLineOffset = None;
+ }
+ CodeOffsetBase = CodeOffsetEnd;
+ CodeOffsetEnd = NextFileOffset = None;
+ }
+ return false;
+ };
for (const auto &Annot : Sym.annotations()) {
switch (Annot.OpCode) {
case BinaryAnnotationsOpCode::CodeOffset:
case BinaryAnnotationsOpCode::ChangeCodeOffset:
- case BinaryAnnotationsOpCode::ChangeCodeLength:
+ case BinaryAnnotationsOpCode::ChangeCodeOffsetBase:
CodeOffset += Annot.U1;
+ UpdateCodeOffset(Annot.U1);
+ break;
+ case BinaryAnnotationsOpCode::ChangeCodeLength:
+ UpdateCodeOffset(Annot.U1);
break;
case BinaryAnnotationsOpCode::ChangeCodeLengthAndCodeOffset:
CodeOffset += Annot.U2;
+ UpdateCodeOffset(Annot.U2);
+ UpdateCodeOffset(Annot.U1);
break;
case BinaryAnnotationsOpCode::ChangeLineOffset:
+ UpdateLineOffset(Annot.S1);
+ break;
case BinaryAnnotationsOpCode::ChangeCodeOffsetAndLineOffset:
CodeOffset += Annot.U1;
- LineOffset += Annot.S1;
+ UpdateCodeOffset(Annot.U1);
+ UpdateLineOffset(Annot.S1);
break;
case BinaryAnnotationsOpCode::ChangeFile:
- FileOffset = Annot.U1;
+ UpdateFileOffset(Annot.U1);
break;
default:
break;
}
- if (CodeOffset >= OffsetInFunc)
+ if (ValidateAndReset())
return;
}
}
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeLineNumber.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeLineNumber.cpp
index 155ed0cdb828..aa7d6ac6f29d 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeLineNumber.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeLineNumber.cpp
@@ -7,6 +7,7 @@
//===----------------------------------------------------------------------===//
#include "llvm/DebugInfo/PDB/Native/NativeLineNumber.h"
+#include "llvm/DebugInfo/PDB/Native/NativeSession.h"
using namespace llvm;
using namespace llvm::pdb;
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativePublicSymbol.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativePublicSymbol.cpp
index 1265e688b867..339af6108009 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativePublicSymbol.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativePublicSymbol.cpp
@@ -9,8 +9,7 @@
#include "llvm/DebugInfo/PDB/Native/NativePublicSymbol.h"
#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
-#include "llvm/DebugInfo/PDB/Native/NativeTypeBuiltin.h"
-#include "llvm/DebugInfo/PDB/Native/NativeTypeEnum.h"
+#include "llvm/DebugInfo/PDB/Native/NativeSession.h"
using namespace llvm;
using namespace llvm::codeview;
@@ -20,7 +19,7 @@ NativePublicSymbol::NativePublicSymbol(NativeSession &Session, SymIndexId Id,
const codeview::PublicSym32 &Sym)
: NativeRawSymbol(Session, PDB_SymType::PublicSymbol, Id), Sym(Sym) {}
-NativePublicSymbol::~NativePublicSymbol() {}
+NativePublicSymbol::~NativePublicSymbol() = default;
void NativePublicSymbol::dump(raw_ostream &OS, int Indent,
PdbSymbolIdField ShowIdFields,
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeRawSymbol.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeRawSymbol.cpp
index 2ad552470b61..89f9f9836fec 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeRawSymbol.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeRawSymbol.cpp
@@ -10,7 +10,6 @@
#include "llvm/DebugInfo/PDB/IPDBLineNumber.h"
#include "llvm/DebugInfo/PDB/Native/NativeSession.h"
#include "llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h"
-#include "llvm/Support/FormatVariadic.h"
using namespace llvm;
using namespace llvm::pdb;
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeSession.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeSession.cpp
index 7212a0e65035..cf314c3bede3 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeSession.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeSession.cpp
@@ -8,31 +8,33 @@
#include "llvm/DebugInfo/PDB/Native/NativeSession.h"
-#include "llvm/ADT/STLExtras.h"
-#include "llvm/DebugInfo/CodeView/TypeIndex.h"
+#include "llvm/BinaryFormat/Magic.h"
+#include "llvm/DebugInfo/MSF/MSFCommon.h"
+#include "llvm/DebugInfo/MSF/MappedBlockStream.h"
#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
#include "llvm/DebugInfo/PDB/IPDBSourceFile.h"
+#include "llvm/DebugInfo/PDB/Native/DbiModuleDescriptor.h"
+#include "llvm/DebugInfo/PDB/Native/DbiModuleList.h"
#include "llvm/DebugInfo/PDB/Native/DbiStream.h"
#include "llvm/DebugInfo/PDB/Native/ISectionContribVisitor.h"
-#include "llvm/DebugInfo/PDB/Native/NativeCompilandSymbol.h"
+#include "llvm/DebugInfo/PDB/Native/ModuleDebugStream.h"
#include "llvm/DebugInfo/PDB/Native/NativeEnumInjectedSources.h"
-#include "llvm/DebugInfo/PDB/Native/NativeEnumTypes.h"
#include "llvm/DebugInfo/PDB/Native/NativeExeSymbol.h"
-#include "llvm/DebugInfo/PDB/Native/NativeTypeBuiltin.h"
-#include "llvm/DebugInfo/PDB/Native/NativeTypeEnum.h"
#include "llvm/DebugInfo/PDB/Native/PDBFile.h"
+#include "llvm/DebugInfo/PDB/Native/RawConstants.h"
#include "llvm/DebugInfo/PDB/Native/RawError.h"
+#include "llvm/DebugInfo/PDB/Native/RawTypes.h"
#include "llvm/DebugInfo/PDB/Native/SymbolCache.h"
-#include "llvm/DebugInfo/PDB/Native/TpiStream.h"
+#include "llvm/DebugInfo/PDB/PDBSymbol.h"
#include "llvm/DebugInfo/PDB/PDBSymbolCompiland.h"
#include "llvm/DebugInfo/PDB/PDBSymbolExe.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h"
+#include "llvm/Object/Binary.h"
#include "llvm/Object/COFF.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/BinaryByteStream.h"
+#include "llvm/Support/BinaryStreamArray.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/ErrorOr.h"
-#include "llvm/Support/FileSystem.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/Path.h"
@@ -45,6 +47,12 @@ using namespace llvm;
using namespace llvm::msf;
using namespace llvm::pdb;
+namespace llvm {
+namespace codeview {
+union DebugInfo;
+}
+} // namespace llvm
+
static DbiStream *getDbiStreamPtr(PDBFile &File) {
Expected<DbiStream &> DbiS = File.getPDBDbiStream();
if (DbiS)
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeSourceFile.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeSourceFile.cpp
index fd813dee6b9f..8d6f8ebebf4c 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeSourceFile.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeSourceFile.cpp
@@ -8,6 +8,8 @@
#include "llvm/DebugInfo/PDB/Native/NativeSourceFile.h"
#include "llvm/DebugInfo/PDB/Native/NativeSession.h"
+#include "llvm/DebugInfo/PDB/Native/PDBFile.h"
+#include "llvm/DebugInfo/PDB/Native/PDBStringTable.h"
using namespace llvm;
using namespace llvm::pdb;
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeSymbolEnumerator.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeSymbolEnumerator.cpp
index e5f1dcaf801e..a6e8cbf71548 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeSymbolEnumerator.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeSymbolEnumerator.cpp
@@ -8,7 +8,7 @@
#include "llvm/DebugInfo/PDB/Native/NativeSymbolEnumerator.h"
-#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
+#include "llvm/DebugInfo/PDB/Native/NativeSession.h"
#include "llvm/DebugInfo/PDB/Native/NativeTypeBuiltin.h"
#include "llvm/DebugInfo/PDB/Native/NativeTypeEnum.h"
@@ -22,7 +22,7 @@ NativeSymbolEnumerator::NativeSymbolEnumerator(
: NativeRawSymbol(Session, PDB_SymType::Data, Id), Parent(Parent),
Record(std::move(Record)) {}
-NativeSymbolEnumerator::~NativeSymbolEnumerator() {}
+NativeSymbolEnumerator::~NativeSymbolEnumerator() = default;
void NativeSymbolEnumerator::dump(raw_ostream &OS, int Indent,
PdbSymbolIdField ShowIdFields,
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeTypeArray.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeTypeArray.cpp
index 63ac9fae0e87..e98f357ac485 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeTypeArray.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeTypeArray.cpp
@@ -8,9 +8,10 @@
#include "llvm/DebugInfo/PDB/Native/NativeTypeArray.h"
-#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
-#include "llvm/DebugInfo/PDB/Native/NativeTypeBuiltin.h"
-#include "llvm/DebugInfo/PDB/Native/NativeTypeEnum.h"
+#include "llvm/DebugInfo/CodeView/CodeView.h"
+#include "llvm/DebugInfo/PDB/Native/NativeSession.h"
+#include "llvm/DebugInfo/PDB/Native/SymbolCache.h"
+#include "llvm/DebugInfo/PDB/PDBExtras.h"
using namespace llvm;
using namespace llvm::codeview;
@@ -21,7 +22,7 @@ NativeTypeArray::NativeTypeArray(NativeSession &Session, SymIndexId Id,
codeview::ArrayRecord Record)
: NativeRawSymbol(Session, PDB_SymType::ArrayType, Id), Record(Record),
Index(TI) {}
-NativeTypeArray::~NativeTypeArray() {}
+NativeTypeArray::~NativeTypeArray() = default;
void NativeTypeArray::dump(raw_ostream &OS, int Indent,
PdbSymbolIdField ShowIdFields,
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeTypeBuiltin.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeTypeBuiltin.cpp
index a08663aa91ba..80f892c7b118 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeTypeBuiltin.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeTypeBuiltin.cpp
@@ -7,7 +7,6 @@
//===----------------------------------------------------------------------===//
#include "llvm/DebugInfo/PDB/Native/NativeTypeBuiltin.h"
-#include "llvm/Support/FormatVariadic.h"
using namespace llvm;
using namespace llvm::codeview;
@@ -19,7 +18,7 @@ NativeTypeBuiltin::NativeTypeBuiltin(NativeSession &PDBSession, SymIndexId Id,
: NativeRawSymbol(PDBSession, PDB_SymType::BuiltinType, Id),
Session(PDBSession), Mods(Mods), Type(T), Length(L) {}
-NativeTypeBuiltin::~NativeTypeBuiltin() {}
+NativeTypeBuiltin::~NativeTypeBuiltin() = default;
void NativeTypeBuiltin::dump(raw_ostream &OS, int Indent,
PdbSymbolIdField ShowIdFields,
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeTypeEnum.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeTypeEnum.cpp
index aaec3a5e7c60..ec37d276e66b 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeTypeEnum.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeTypeEnum.cpp
@@ -9,8 +9,9 @@
#include "llvm/DebugInfo/PDB/Native/NativeTypeEnum.h"
#include "llvm/DebugInfo/CodeView/CVTypeVisitor.h"
+#include "llvm/DebugInfo/CodeView/LazyRandomTypeCollection.h"
#include "llvm/DebugInfo/CodeView/TypeRecord.h"
-#include "llvm/DebugInfo/PDB/Native/NativeEnumTypes.h"
+#include "llvm/DebugInfo/PDB/Native/NativeSession.h"
#include "llvm/DebugInfo/PDB/Native/NativeSymbolEnumerator.h"
#include "llvm/DebugInfo/PDB/Native/NativeTypeBuiltin.h"
#include "llvm/DebugInfo/PDB/Native/PDBFile.h"
@@ -18,8 +19,6 @@
#include "llvm/DebugInfo/PDB/Native/TpiStream.h"
#include "llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h"
-#include "llvm/Support/FormatVariadic.h"
-
#include <cassert>
using namespace llvm;
@@ -68,10 +67,13 @@ NativeEnumEnumEnumerators::NativeEnumEnumEnumerators(
ContinuationIndex = ClassParent.getEnumRecord().FieldList;
while (ContinuationIndex) {
- CVType FieldList = Types.getType(*ContinuationIndex);
- assert(FieldList.kind() == LF_FIELDLIST);
+ CVType FieldListCVT = Types.getType(*ContinuationIndex);
+ assert(FieldListCVT.kind() == LF_FIELDLIST);
ContinuationIndex.reset();
- cantFail(visitMemberRecordStream(FieldList.data(), *this));
+ FieldListRecord FieldList;
+ cantFail(TypeDeserializer::deserializeAs<FieldListRecord>(FieldListCVT,
+ FieldList));
+ cantFail(visitMemberRecordStream(FieldList.Data, *this));
}
}
@@ -123,7 +125,7 @@ NativeTypeEnum::NativeTypeEnum(NativeSession &Session, SymIndexId Id,
: NativeRawSymbol(Session, PDB_SymType::Enum, Id),
UnmodifiedType(&UnmodifiedType), Modifiers(std::move(Modifier)) {}
-NativeTypeEnum::~NativeTypeEnum() {}
+NativeTypeEnum::~NativeTypeEnum() = default;
void NativeTypeEnum::dump(raw_ostream &OS, int Indent,
PdbSymbolIdField ShowIdFields,
@@ -138,7 +140,7 @@ void NativeTypeEnum::dump(raw_ostream &OS, int Indent,
dumpSymbolField(OS, "name", getName(), Indent);
dumpSymbolIdField(OS, "typeId", getTypeId(), Indent, Session,
PdbSymbolIdField::Type, ShowIdFields, RecurseIdFields);
- if (Modifiers.hasValue())
+ if (Modifiers)
dumpSymbolIdField(OS, "unmodifiedTypeId", getUnmodifiedTypeId(), Indent,
Session, PdbSymbolIdField::UnmodifiedType, ShowIdFields,
RecurseIdFields);
@@ -206,6 +208,8 @@ PDB_BuiltinType NativeTypeEnum::getBuiltinType() const {
return PDB_BuiltinType::Char16;
case SimpleTypeKind::Character32:
return PDB_BuiltinType::Char32;
+ case SimpleTypeKind::Character8:
+ return PDB_BuiltinType::Char8;
case SimpleTypeKind::Int128:
case SimpleTypeKind::Int128Oct:
case SimpleTypeKind::Int16:
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeTypeFunctionSig.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeTypeFunctionSig.cpp
index f98a4c3043eb..7db3f1c63128 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeTypeFunctionSig.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeTypeFunctionSig.cpp
@@ -10,9 +10,10 @@
#include "llvm/DebugInfo/CodeView/LazyRandomTypeCollection.h"
#include "llvm/DebugInfo/PDB/Native/NativeEnumTypes.h"
-#include "llvm/DebugInfo/PDB/PDBExtras.h"
+#include "llvm/DebugInfo/PDB/Native/NativeSession.h"
#include "llvm/DebugInfo/PDB/Native/PDBFile.h"
#include "llvm/DebugInfo/PDB/Native/TpiStream.h"
+#include "llvm/DebugInfo/PDB/PDBExtras.h"
using namespace llvm;
using namespace llvm::codeview;
@@ -96,7 +97,7 @@ void NativeTypeFunctionSig::initialize() {
}
}
-NativeTypeFunctionSig::~NativeTypeFunctionSig() {}
+NativeTypeFunctionSig::~NativeTypeFunctionSig() = default;
void NativeTypeFunctionSig::initializeArgList(codeview::TypeIndex ArgListTI) {
TpiStream &Tpi = cantFail(Session.getPDBFile().getPDBTpiStream());
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeTypePointer.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeTypePointer.cpp
index 32dcfc235954..14b903ccef5a 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeTypePointer.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeTypePointer.cpp
@@ -7,8 +7,9 @@
//===----------------------------------------------------------------------===//
#include "llvm/DebugInfo/PDB/Native/NativeTypePointer.h"
+#include "llvm/DebugInfo/PDB/Native/NativeSession.h"
-#include "llvm/DebugInfo/CodeView/TypeDeserializer.h"
+#include "llvm/DebugInfo/CodeView/CodeView.h"
#include <cassert>
@@ -29,7 +30,7 @@ NativeTypePointer::NativeTypePointer(NativeSession &Session, SymIndexId Id,
: NativeRawSymbol(Session, PDB_SymType::PointerType, Id), TI(TI),
Record(std::move(Record)) {}
-NativeTypePointer::~NativeTypePointer() {}
+NativeTypePointer::~NativeTypePointer() = default;
void NativeTypePointer::dump(raw_ostream &OS, int Indent,
PdbSymbolIdField ShowIdFields,
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeTypeTypedef.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeTypeTypedef.cpp
index 72964a9e0d4d..11cd349b72ca 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeTypeTypedef.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeTypeTypedef.cpp
@@ -1,4 +1,6 @@
#include "llvm/DebugInfo/PDB/Native/NativeTypeTypedef.h"
+#include "llvm/DebugInfo/PDB/Native/NativeSession.h"
+#include "llvm/DebugInfo/PDB/PDBExtras.h"
using namespace llvm;
using namespace llvm::codeview;
@@ -9,7 +11,7 @@ NativeTypeTypedef::NativeTypeTypedef(NativeSession &Session, SymIndexId Id,
: NativeRawSymbol(Session, PDB_SymType::Typedef, Id),
Record(std::move(Typedef)) {}
-NativeTypeTypedef::~NativeTypeTypedef() {}
+NativeTypeTypedef::~NativeTypeTypedef() = default;
void NativeTypeTypedef::dump(raw_ostream &OS, int Indent,
PdbSymbolIdField ShowIdFields,
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeTypeUDT.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeTypeUDT.cpp
index 917ec14e58d6..b708fb644e7a 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeTypeUDT.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeTypeUDT.cpp
@@ -7,10 +7,11 @@
//===----------------------------------------------------------------------===//
#include "llvm/DebugInfo/PDB/Native/NativeTypeUDT.h"
-
-#include "llvm/DebugInfo/CodeView/TypeDeserializer.h"
-
-#include <cassert>
+#include "llvm/DebugInfo/CodeView/CodeView.h"
+#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
+#include "llvm/DebugInfo/PDB/Native/NativeSession.h"
+#include "llvm/DebugInfo/PDB/Native/SymbolCache.h"
+#include "llvm/DebugInfo/PDB/PDBExtras.h"
using namespace llvm;
using namespace llvm::codeview;
@@ -32,7 +33,7 @@ NativeTypeUDT::NativeTypeUDT(NativeSession &Session, SymIndexId Id,
: NativeRawSymbol(Session, PDB_SymType::UDT, Id),
UnmodifiedType(&UnmodifiedType), Modifiers(std::move(Modifier)) {}
-NativeTypeUDT::~NativeTypeUDT() {}
+NativeTypeUDT::~NativeTypeUDT() = default;
void NativeTypeUDT::dump(raw_ostream &OS, int Indent,
PdbSymbolIdField ShowIdFields,
@@ -44,7 +45,7 @@ void NativeTypeUDT::dump(raw_ostream &OS, int Indent,
dumpSymbolIdField(OS, "lexicalParentId", 0, Indent, Session,
PdbSymbolIdField::LexicalParent, ShowIdFields,
RecurseIdFields);
- if (Modifiers.hasValue())
+ if (Modifiers)
dumpSymbolIdField(OS, "unmodifiedTypeId", getUnmodifiedTypeId(), Indent,
Session, PdbSymbolIdField::UnmodifiedType, ShowIdFields,
RecurseIdFields);
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeTypeVTShape.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeTypeVTShape.cpp
index 837fe19ec88c..63bb3f046e23 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeTypeVTShape.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeTypeVTShape.cpp
@@ -1,4 +1,7 @@
#include "llvm/DebugInfo/PDB/Native/NativeTypeVTShape.h"
+#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
+#include "llvm/DebugInfo/PDB/Native/NativeSession.h"
+#include "llvm/DebugInfo/PDB/PDBExtras.h"
using namespace llvm;
using namespace llvm::pdb;
@@ -10,7 +13,7 @@ NativeTypeVTShape::NativeTypeVTShape(NativeSession &Session, SymIndexId Id,
: NativeRawSymbol(Session, PDB_SymType::VTableShape, Id), TI(TI),
Record(std::move(SR)) {}
-NativeTypeVTShape::~NativeTypeVTShape() {}
+NativeTypeVTShape::~NativeTypeVTShape() = default;
void NativeTypeVTShape::dump(raw_ostream &OS, int Indent,
PdbSymbolIdField ShowIdFields,
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/PDBFile.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/PDBFile.cpp
index 5c61530c470d..471d183a5f53 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/PDBFile.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/PDBFile.cpp
@@ -8,7 +8,6 @@
#include "llvm/DebugInfo/PDB/Native/PDBFile.h"
#include "llvm/ADT/ArrayRef.h"
-#include "llvm/ADT/STLExtras.h"
#include "llvm/DebugInfo/MSF/MSFCommon.h"
#include "llvm/DebugInfo/MSF/MappedBlockStream.h"
#include "llvm/DebugInfo/PDB/Native/DbiStream.h"
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp
index f33125474e3a..641043a8e186 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp
@@ -7,34 +7,41 @@
//===----------------------------------------------------------------------===//
#include "llvm/DebugInfo/PDB/Native/PDBFileBuilder.h"
+#include "llvm/DebugInfo/CodeView/CodeView.h"
+#include "llvm/DebugInfo/CodeView/GUID.h"
#include "llvm/DebugInfo/MSF/MSFBuilder.h"
-#include "llvm/DebugInfo/PDB/Native/DbiStream.h"
+#include "llvm/DebugInfo/MSF/MSFCommon.h"
+#include "llvm/DebugInfo/MSF/MappedBlockStream.h"
#include "llvm/DebugInfo/PDB/Native/DbiStreamBuilder.h"
#include "llvm/DebugInfo/PDB/Native/GSIStreamBuilder.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/RawConstants.h"
#include "llvm/DebugInfo/PDB/Native/RawError.h"
-#include "llvm/DebugInfo/PDB/Native/TpiStream.h"
+#include "llvm/DebugInfo/PDB/Native/RawTypes.h"
#include "llvm/DebugInfo/PDB/Native/TpiStreamBuilder.h"
-#include "llvm/Support/BinaryStream.h"
#include "llvm/Support/BinaryStreamWriter.h"
#include "llvm/Support/CRC.h"
-#include "llvm/Support/Chrono.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/xxhash.h"
+#include <ctime>
+
using namespace llvm;
using namespace llvm::codeview;
using namespace llvm::msf;
using namespace llvm::pdb;
using namespace llvm::support;
+namespace llvm {
+class WritableBinaryStream;
+}
+
PDBFileBuilder::PDBFileBuilder(BumpPtrAllocator &Allocator)
: Allocator(Allocator), InjectedSourceHashTraits(Strings),
InjectedSourceTable(2) {}
-PDBFileBuilder::~PDBFileBuilder() {}
+PDBFileBuilder::~PDBFileBuilder() = default;
Error PDBFileBuilder::initialize(uint32_t BlockSize) {
auto ExpectedMsf = MSFBuilder::create(Allocator, BlockSize);
@@ -348,7 +355,7 @@ Error PDBFileBuilder::commit(StringRef Filename, codeview::GUID *Guid) {
H->Age = Info->getAge();
H->Guid = Info->getGuid();
Optional<uint32_t> Sig = Info->getSignature();
- H->Signature = Sig.hasValue() ? *Sig : time(nullptr);
+ H->Signature = Sig ? *Sig : time(nullptr);
}
return Buffer.commit();
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/PDBStringTable.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/PDBStringTable.cpp
index 2be1656e06bb..5bd12f50f1d7 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/PDBStringTable.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/PDBStringTable.cpp
@@ -8,7 +8,6 @@
#include "llvm/DebugInfo/PDB/Native/PDBStringTable.h"
-#include "llvm/ADT/ArrayRef.h"
#include "llvm/DebugInfo/PDB/Native/Hash.h"
#include "llvm/DebugInfo/PDB/Native/RawError.h"
#include "llvm/DebugInfo/PDB/Native/RawTypes.h"
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/PDBStringTableBuilder.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/PDBStringTableBuilder.cpp
index f7f36901e4d4..45a5bdb48f01 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/PDBStringTableBuilder.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/PDBStringTableBuilder.cpp
@@ -71,7 +71,7 @@ static uint32_t computeBucketCount(uint32_t NumStrings) {
// This list contains all StringCount, BucketCount pairs where BucketCount was
// just incremented. It ends before the first BucketCount entry where
// BucketCount * 3 would overflow a 32-bit unsigned int.
- static std::map<uint32_t, uint32_t> StringsToBuckets = {
+ static const std::pair<uint32_t, uint32_t> StringsToBuckets[] = {
{0, 1},
{1, 2},
{2, 4},
@@ -124,8 +124,9 @@ static uint32_t computeBucketCount(uint32_t NumStrings) {
{517197275, 1034394550},
{775795913, 1551591826},
{1163693870, 2327387740}};
- auto Entry = StringsToBuckets.lower_bound(NumStrings);
- assert(Entry != StringsToBuckets.end());
+ const auto *Entry = llvm::lower_bound(
+ StringsToBuckets, std::make_pair(NumStrings, 0U), llvm::less_first());
+ assert(Entry != std::end(StringsToBuckets));
return Entry->second;
}
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/PublicsStream.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/PublicsStream.cpp
index a33bf03bf8fb..c7b9f443da5e 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/PublicsStream.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/PublicsStream.cpp
@@ -22,14 +22,12 @@
//===----------------------------------------------------------------------===//
#include "llvm/DebugInfo/PDB/Native/PublicsStream.h"
-#include "llvm/ADT/iterator_range.h"
-#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
#include "llvm/DebugInfo/MSF/MappedBlockStream.h"
#include "llvm/DebugInfo/PDB/Native/RawError.h"
+#include "llvm/DebugInfo/PDB/Native/RawTypes.h"
#include "llvm/Support/BinaryStreamReader.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/Error.h"
-#include <algorithm>
#include <cstdint>
using namespace llvm;
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/SymbolCache.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/SymbolCache.cpp
index f9e67014477e..f89f09aa3399 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/SymbolCache.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/SymbolCache.cpp
@@ -1,20 +1,25 @@
#include "llvm/DebugInfo/PDB/Native/SymbolCache.h"
-#include "llvm/DebugInfo/CodeView/DebugInlineeLinesSubsection.h"
+#include "llvm/DebugInfo/CodeView/DebugChecksumsSubsection.h"
#include "llvm/DebugInfo/CodeView/DebugLinesSubsection.h"
+#include "llvm/DebugInfo/CodeView/DebugSubsectionRecord.h"
+#include "llvm/DebugInfo/CodeView/LazyRandomTypeCollection.h"
#include "llvm/DebugInfo/CodeView/SymbolDeserializer.h"
+#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
#include "llvm/DebugInfo/CodeView/TypeDeserializer.h"
+#include "llvm/DebugInfo/CodeView/TypeRecord.h"
#include "llvm/DebugInfo/CodeView/TypeRecordHelpers.h"
+#include "llvm/DebugInfo/PDB/IPDBSourceFile.h"
+#include "llvm/DebugInfo/PDB/Native/DbiModuleList.h"
#include "llvm/DebugInfo/PDB/Native/DbiStream.h"
-#include "llvm/DebugInfo/PDB/Native/GlobalsStream.h"
-#include "llvm/DebugInfo/PDB/Native/ISectionContribVisitor.h"
+#include "llvm/DebugInfo/PDB/Native/ModuleDebugStream.h"
#include "llvm/DebugInfo/PDB/Native/NativeCompilandSymbol.h"
#include "llvm/DebugInfo/PDB/Native/NativeEnumGlobals.h"
#include "llvm/DebugInfo/PDB/Native/NativeEnumLineNumbers.h"
-#include "llvm/DebugInfo/PDB/Native/NativeEnumSymbols.h"
#include "llvm/DebugInfo/PDB/Native/NativeEnumTypes.h"
#include "llvm/DebugInfo/PDB/Native/NativeFunctionSymbol.h"
#include "llvm/DebugInfo/PDB/Native/NativeInlineSiteSymbol.h"
+#include "llvm/DebugInfo/PDB/Native/NativeLineNumber.h"
#include "llvm/DebugInfo/PDB/Native/NativePublicSymbol.h"
#include "llvm/DebugInfo/PDB/Native/NativeRawSymbol.h"
#include "llvm/DebugInfo/PDB/Native/NativeSession.h"
@@ -32,7 +37,6 @@
#include "llvm/DebugInfo/PDB/Native/TpiStream.h"
#include "llvm/DebugInfo/PDB/PDBSymbol.h"
#include "llvm/DebugInfo/PDB/PDBSymbolCompiland.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h"
using namespace llvm;
using namespace llvm::codeview;
@@ -60,6 +64,7 @@ static const struct BuiltinTypeEntry {
{codeview::SimpleTypeKind::WideCharacter, PDB_BuiltinType::WCharT, 2},
{codeview::SimpleTypeKind::Character16, PDB_BuiltinType::Char16, 2},
{codeview::SimpleTypeKind::Character32, PDB_BuiltinType::Char32, 4},
+ {codeview::SimpleTypeKind::Character8, PDB_BuiltinType::Char8, 1},
{codeview::SimpleTypeKind::SignedCharacter, PDB_BuiltinType::Char, 1},
{codeview::SimpleTypeKind::UnsignedCharacter, PDB_BuiltinType::UInt, 1},
{codeview::SimpleTypeKind::Float32, PDB_BuiltinType::Float, 4},
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/SymbolStream.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/SymbolStream.cpp
index 003840b6e67e..5802d1c77527 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/SymbolStream.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/SymbolStream.cpp
@@ -8,10 +8,7 @@
#include "llvm/DebugInfo/PDB/Native/SymbolStream.h"
-#include "llvm/DebugInfo/CodeView/CodeView.h"
-#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
#include "llvm/DebugInfo/MSF/MappedBlockStream.h"
-#include "llvm/Support/BinaryStreamReader.h"
#include "llvm/Support/Endian.h"
using namespace llvm;
@@ -22,7 +19,7 @@ using namespace llvm::pdb;
SymbolStream::SymbolStream(std::unique_ptr<MappedBlockStream> Stream)
: Stream(std::move(Stream)) {}
-SymbolStream::~SymbolStream() {}
+SymbolStream::~SymbolStream() = default;
Error SymbolStream::reload() {
BinaryStreamReader Reader(*Stream);
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/TpiStreamBuilder.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/TpiStreamBuilder.cpp
index 5f4f497690b6..986e45e050c7 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/TpiStreamBuilder.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/TpiStreamBuilder.cpp
@@ -9,17 +9,13 @@
#include "llvm/DebugInfo/PDB/Native/TpiStreamBuilder.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/STLExtras.h"
+#include "llvm/DebugInfo/CodeView/RecordSerialization.h"
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
-#include "llvm/DebugInfo/CodeView/TypeRecord.h"
#include "llvm/DebugInfo/MSF/MSFBuilder.h"
#include "llvm/DebugInfo/MSF/MappedBlockStream.h"
-#include "llvm/DebugInfo/PDB/Native/PDBFile.h"
-#include "llvm/DebugInfo/PDB/Native/RawError.h"
#include "llvm/DebugInfo/PDB/Native/RawTypes.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/BinaryByteStream.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"
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDB.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDB.cpp
index e5b7731f6f4a..d106ba8fefc1 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDB.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDB.cpp
@@ -15,7 +15,6 @@
#endif
#include "llvm/DebugInfo/PDB/Native/NativeSession.h"
#include "llvm/Support/Error.h"
-#include "llvm/Support/MemoryBuffer.h"
using namespace llvm;
using namespace llvm::pdb;
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBContext.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBContext.cpp
index 0ebb70e010d5..e600fb7385f1 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBContext.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBContext.cpp
@@ -14,6 +14,8 @@
#include "llvm/DebugInfo/PDB/PDBSymbolData.h"
#include "llvm/DebugInfo/PDB/PDBSymbolFunc.h"
#include "llvm/DebugInfo/PDB/PDBSymbolPublicSymbol.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeFunctionSig.h"
+#include "llvm/DebugInfo/PDB/PDBTypes.h"
#include "llvm/Object/COFF.h"
using namespace llvm;
@@ -62,6 +64,13 @@ DILineInfo PDBContext::getLineInfoForAddress(object::SectionedAddress Address,
return Result;
}
+DILineInfo
+PDBContext::getLineInfoForDataAddress(object::SectionedAddress Address) {
+ // Unimplemented. S_GDATA and S_LDATA in CodeView (used to describe global
+ // variables) aren't capable of carrying line information.
+ return DILineInfo();
+}
+
DILineInfoTable
PDBContext::getLineInfoForAddressRange(object::SectionedAddress Address,
uint64_t Size,
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBExtras.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBExtras.cpp
index a6d7ca0da7a9..571510e6bad9 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBExtras.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBExtras.cpp
@@ -7,7 +7,6 @@
//===----------------------------------------------------------------------===//
#include "llvm/DebugInfo/PDB/PDBExtras.h"
-#include "llvm/ADT/ArrayRef.h"
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
@@ -64,6 +63,7 @@ raw_ostream &llvm::pdb::operator<<(raw_ostream &OS,
CASE_OUTPUT_ENUM_CLASS_NAME(PDB_BuiltinType, HResult, OS)
CASE_OUTPUT_ENUM_CLASS_NAME(PDB_BuiltinType, Char16, OS)
CASE_OUTPUT_ENUM_CLASS_NAME(PDB_BuiltinType, Char32, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_BuiltinType, Char8, OS)
}
return OS;
}
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbol.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbol.cpp
index d6bc7ee9c951..4eb5af9bd292 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbol.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbol.cpp
@@ -8,6 +8,7 @@
#include "llvm/DebugInfo/PDB/PDBSymbol.h"
#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
+#include "llvm/DebugInfo/PDB/IPDBLineNumber.h"
#include "llvm/DebugInfo/PDB/IPDBRawSymbol.h"
#include "llvm/DebugInfo/PDB/IPDBSession.h"
#include "llvm/DebugInfo/PDB/PDBExtras.h"
@@ -43,7 +44,6 @@
#include "llvm/DebugInfo/PDB/PDBSymbolUnknown.h"
#include "llvm/DebugInfo/PDB/PDBSymbolUsingNamespace.h"
#include "llvm/DebugInfo/PDB/PDBTypes.h"
-#include <algorithm>
#include <memory>
using namespace llvm;
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolAnnotation.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolAnnotation.cpp
index 0fa83efb7ae0..089f4de0f422 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolAnnotation.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolAnnotation.cpp
@@ -10,8 +10,6 @@
#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
-#include <utility>
-
using namespace llvm;
using namespace llvm::pdb;
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolBlock.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolBlock.cpp
index 9452282a8817..49ee4937521b 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolBlock.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolBlock.cpp
@@ -9,9 +9,6 @@
#include "llvm/DebugInfo/PDB/PDBSymbolBlock.h"
#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
-#include "llvm/DebugInfo/PDB/PDBSymbol.h"
-
-#include <utility>
using namespace llvm;
using namespace llvm::pdb;
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolCompiland.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolCompiland.cpp
index 529100b23ba5..bd60489b6bed 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolCompiland.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolCompiland.cpp
@@ -9,10 +9,11 @@
#include "llvm/DebugInfo/PDB/IPDBSession.h"
#include "llvm/DebugInfo/PDB/IPDBSourceFile.h"
+#include "llvm/DebugInfo/PDB/ConcreteSymbolEnumerator.h"
+#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
#include "llvm/DebugInfo/PDB/PDBSymbolCompiland.h"
#include "llvm/DebugInfo/PDB/PDBSymbolCompilandDetails.h"
#include "llvm/DebugInfo/PDB/PDBSymbolCompilandEnv.h"
-#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/Support/Path.h"
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolCompilandDetails.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolCompilandDetails.cpp
index 0d86dfe1e632..f775ac949cd8 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolCompilandDetails.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolCompilandDetails.cpp
@@ -9,9 +9,6 @@
#include "llvm/DebugInfo/PDB/PDBSymbolCompilandDetails.h"
#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
-#include "llvm/DebugInfo/PDB/PDBSymbol.h"
-
-#include <utility>
using namespace llvm;
using namespace llvm::pdb;
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolCompilandEnv.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolCompilandEnv.cpp
index 61f119405fd9..2c2ed59c1726 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolCompilandEnv.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolCompilandEnv.cpp
@@ -10,9 +10,7 @@
#include "llvm/DebugInfo/PDB/IPDBRawSymbol.h"
#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
-#include "llvm/DebugInfo/PDB/PDBSymbol.h"
-
-#include <utility>
+#include "llvm/DebugInfo/PDB/PDBTypes.h"
using namespace llvm;
using namespace llvm::pdb;
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolCustom.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolCustom.cpp
index 6c9a4aa76c3d..405b07c2b689 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolCustom.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolCustom.cpp
@@ -10,9 +10,6 @@
#include "llvm/DebugInfo/PDB/IPDBRawSymbol.h"
#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
-#include "llvm/DebugInfo/PDB/PDBSymbol.h"
-
-#include <utility>
using namespace llvm;
using namespace llvm::pdb;
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolData.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolData.cpp
index d2b82111ccd5..c604b5cd3a6a 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolData.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolData.cpp
@@ -7,12 +7,11 @@
//===----------------------------------------------------------------------===//
#include "llvm/DebugInfo/PDB/PDBSymbolData.h"
+#include "llvm/DebugInfo/PDB/IPDBLineNumber.h"
#include "llvm/DebugInfo/PDB/IPDBSectionContrib.h"
#include "llvm/DebugInfo/PDB/IPDBSession.h"
#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
-#include <utility>
-
using namespace llvm;
using namespace llvm::pdb;
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolExe.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolExe.cpp
index c85756c43e47..3887c23b18ef 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolExe.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolExe.cpp
@@ -8,10 +8,10 @@
#include "llvm/DebugInfo/PDB/PDBSymbolExe.h"
+#include "llvm/DebugInfo/PDB/ConcreteSymbolEnumerator.h"
#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
#include "llvm/DebugInfo/PDB/PDBSymbolTypePointer.h"
-
-#include <utility>
+#include "llvm/DebugInfo/PDB/PDBTypes.h"
using namespace llvm;
using namespace llvm::pdb;
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolFunc.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolFunc.cpp
index cb0329bc0ed7..59d57e83fc10 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolFunc.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolFunc.cpp
@@ -10,7 +10,9 @@
#include "llvm/DebugInfo/PDB/ConcreteSymbolEnumerator.h"
#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
+#include "llvm/DebugInfo/PDB/IPDBLineNumber.h"
#include "llvm/DebugInfo/PDB/IPDBSession.h"
+#include "llvm/DebugInfo/PDB/Native/NativeTypeFunctionSig.h"
#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
#include "llvm/DebugInfo/PDB/PDBSymbolData.h"
#include "llvm/DebugInfo/PDB/PDBSymbolTypeFunctionSig.h"
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolFuncDebugEnd.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolFuncDebugEnd.cpp
index 66433dc17b49..5c72e3f62121 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolFuncDebugEnd.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolFuncDebugEnd.cpp
@@ -9,9 +9,6 @@
#include "llvm/DebugInfo/PDB/PDBSymbolFuncDebugEnd.h"
#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
-#include "llvm/DebugInfo/PDB/PDBSymbol.h"
-
-#include <utility>
using namespace llvm;
using namespace llvm::pdb;
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolFuncDebugStart.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolFuncDebugStart.cpp
index fe32c93c0121..fd537a9eeea4 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolFuncDebugStart.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolFuncDebugStart.cpp
@@ -8,10 +8,8 @@
#include "llvm/DebugInfo/PDB/PDBSymbolFuncDebugStart.h"
+#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
-#include "llvm/DebugInfo/PDB/PDBSymbol.h"
-
-#include <utility>
using namespace llvm;
using namespace llvm::pdb;
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolLabel.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolLabel.cpp
index 1fffe69a0c83..896719a6a8e2 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolLabel.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolLabel.cpp
@@ -10,8 +10,6 @@
#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
-#include <utility>
-
using namespace llvm;
using namespace llvm::pdb;
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolPublicSymbol.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolPublicSymbol.cpp
index 08697683f641..a00b1be40e18 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolPublicSymbol.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolPublicSymbol.cpp
@@ -8,10 +8,8 @@
#include "llvm/DebugInfo/PDB/PDBSymbolPublicSymbol.h"
+#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
-#include "llvm/DebugInfo/PDB/PDBSymbol.h"
-
-#include <utility>
using namespace llvm;
using namespace llvm::pdb;
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolThunk.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolThunk.cpp
index 6483858183e5..42502a55ef76 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolThunk.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolThunk.cpp
@@ -10,8 +10,6 @@
#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
-#include <utility>
-
using namespace llvm;
using namespace llvm::pdb;
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeArray.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeArray.cpp
index a0d521abe43f..bb4eb43f22e5 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeArray.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeArray.cpp
@@ -10,8 +10,6 @@
#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
-#include <utility>
-
using namespace llvm;
using namespace llvm::pdb;
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeBaseClass.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeBaseClass.cpp
index 08467059b5e1..539c3547a4b0 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeBaseClass.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeBaseClass.cpp
@@ -8,10 +8,8 @@
#include "llvm/DebugInfo/PDB/PDBSymbolTypeBaseClass.h"
+#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
-#include "llvm/DebugInfo/PDB/PDBSymbol.h"
-
-#include <utility>
using namespace llvm;
using namespace llvm::pdb;
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeBuiltin.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeBuiltin.cpp
index a0dd9ef601c0..eca2a09c1f77 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeBuiltin.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeBuiltin.cpp
@@ -10,8 +10,6 @@
#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
-#include <utility>
-
using namespace llvm;
using namespace llvm::pdb;
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeCustom.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeCustom.cpp
index 6723894c90ea..a616b4e26cb1 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeCustom.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeCustom.cpp
@@ -9,9 +9,6 @@
#include "llvm/DebugInfo/PDB/PDBSymbolTypeCustom.h"
#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
-#include "llvm/DebugInfo/PDB/PDBSymbol.h"
-
-#include <utility>
using namespace llvm;
using namespace llvm::pdb;
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeDimension.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeDimension.cpp
index 4a25a391f278..2828ce4df3f8 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeDimension.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeDimension.cpp
@@ -10,9 +10,6 @@
#include "llvm/DebugInfo/PDB/PDBSymbolTypeDimension.h"
#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
-#include "llvm/DebugInfo/PDB/PDBSymbol.h"
-
-#include <utility>
using namespace llvm;
using namespace llvm::pdb;
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeEnum.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeEnum.cpp
index b9fdf6aec811..db8ca327da1e 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeEnum.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeEnum.cpp
@@ -8,11 +8,10 @@
#include "llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h"
+#include "llvm/DebugInfo/PDB/IPDBLineNumber.h"
#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
#include "llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h"
-#include <utility>
-
using namespace llvm;
using namespace llvm::pdb;
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeFriend.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeFriend.cpp
index 4ffea42cbb0a..d4bd9996d786 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeFriend.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeFriend.cpp
@@ -9,9 +9,6 @@
#include "llvm/DebugInfo/PDB/PDBSymbolTypeFriend.h"
#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
-#include "llvm/DebugInfo/PDB/PDBSymbol.h"
-
-#include <utility>
using namespace llvm;
using namespace llvm::pdb;
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeFunctionArg.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeFunctionArg.cpp
index 683e93548fb1..acda57f44e33 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeFunctionArg.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeFunctionArg.cpp
@@ -10,8 +10,6 @@
#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
-#include <utility>
-
using namespace llvm;
using namespace llvm::pdb;
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeManaged.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeManaged.cpp
index e80e6c716572..fa6e630e3c45 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeManaged.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeManaged.cpp
@@ -9,9 +9,6 @@
#include "llvm/DebugInfo/PDB/PDBSymbolTypeManaged.h"
#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
-#include "llvm/DebugInfo/PDB/PDBSymbol.h"
-
-#include <utility>
using namespace llvm;
using namespace llvm::pdb;
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypePointer.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypePointer.cpp
index 462fc315359b..9e238c7caa37 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypePointer.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypePointer.cpp
@@ -8,11 +8,8 @@
#include "llvm/DebugInfo/PDB/PDBSymbolTypePointer.h"
-#include "llvm/DebugInfo/PDB/IPDBSession.h"
#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
-#include <utility>
-
using namespace llvm;
using namespace llvm::pdb;
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeTypedef.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeTypedef.cpp
index 70749d9bf5f5..c2ce21c6ca69 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeTypedef.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeTypedef.cpp
@@ -10,8 +10,6 @@
#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
-#include <utility>
-
using namespace llvm;
using namespace llvm::pdb;
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeUDT.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeUDT.cpp
index d302c29a3bec..122111d32027 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeUDT.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeUDT.cpp
@@ -8,16 +8,8 @@
#include "llvm/DebugInfo/PDB/PDBSymbolTypeUDT.h"
-#include "llvm/DebugInfo/PDB/IPDBSession.h"
+#include "llvm/DebugInfo/PDB/IPDBLineNumber.h"
#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
-#include "llvm/DebugInfo/PDB/PDBSymbol.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolData.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolExe.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolTypeBaseClass.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolTypeVTable.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolTypeVTableShape.h"
-
-#include <utility>
using namespace llvm;
using namespace llvm::pdb;
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeVTable.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeVTable.cpp
index 4e2a45116d51..a4d81888e457 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeVTable.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeVTable.cpp
@@ -10,8 +10,6 @@
#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
-#include <utility>
-
using namespace llvm;
using namespace llvm::pdb;
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeVTableShape.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeVTableShape.cpp
index 78957620e083..835a86e165af 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeVTableShape.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolTypeVTableShape.cpp
@@ -9,9 +9,6 @@
#include "llvm/DebugInfo/PDB/PDBSymbolTypeVTableShape.h"
#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
-#include "llvm/DebugInfo/PDB/PDBSymbol.h"
-
-#include <utility>
using namespace llvm;
using namespace llvm::pdb;
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolUnknown.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolUnknown.cpp
index 650d01183171..85294a4cded2 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolUnknown.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolUnknown.cpp
@@ -9,9 +9,6 @@
#include "llvm/DebugInfo/PDB/PDBSymbolUnknown.h"
#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
-#include "llvm/DebugInfo/PDB/PDBSymbol.h"
-
-#include <utility>
using namespace llvm;
using namespace llvm::pdb;
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolUsingNamespace.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolUsingNamespace.cpp
index 74afbdb18086..98aaaa9b10b9 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolUsingNamespace.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/PDBSymbolUsingNamespace.cpp
@@ -9,9 +9,6 @@
#include "llvm/DebugInfo/PDB/PDBSymbolUsingNamespace.h"
#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
-#include "llvm/DebugInfo/PDB/PDBSymbol.h"
-
-#include <utility>
using namespace llvm;
using namespace llvm::pdb;
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/UDTLayout.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/UDTLayout.cpp
index 55854bb49888..6e388834f199 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/PDB/UDTLayout.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/PDB/UDTLayout.cpp
@@ -10,6 +10,8 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/BitVector.h"
#include "llvm/ADT/STLExtras.h"
+#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
+#include "llvm/DebugInfo/PDB/IPDBLineNumber.h"
#include "llvm/DebugInfo/PDB/IPDBRawSymbol.h"
#include "llvm/DebugInfo/PDB/IPDBSession.h"
#include "llvm/DebugInfo/PDB/PDBSymbol.h"
@@ -17,6 +19,7 @@
#include "llvm/DebugInfo/PDB/PDBSymbolFunc.h"
#include "llvm/DebugInfo/PDB/PDBSymbolTypeBaseClass.h"
#include "llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeFunctionSig.h"
#include "llvm/DebugInfo/PDB/PDBSymbolTypePointer.h"
#include "llvm/DebugInfo/PDB/PDBSymbolTypeUDT.h"
#include "llvm/DebugInfo/PDB/PDBSymbolTypeVTable.h"