aboutsummaryrefslogtreecommitdiffstats
path: root/lib/DebugInfo/PDB
diff options
context:
space:
mode:
Diffstat (limited to 'lib/DebugInfo/PDB')
-rw-r--r--lib/DebugInfo/PDB/Android.mk75
-rw-r--r--lib/DebugInfo/PDB/CMakeLists.txt76
-rw-r--r--lib/DebugInfo/PDB/DIA/DIADataStream.cpp73
-rw-r--r--lib/DebugInfo/PDB/DIA/DIAEnumDebugStreams.cpp53
-rw-r--r--lib/DebugInfo/PDB/DIA/DIAEnumLineNumbers.cpp50
-rw-r--r--lib/DebugInfo/PDB/DIA/DIAEnumSourceFiles.cpp50
-rw-r--r--lib/DebugInfo/PDB/DIA/DIAEnumSymbols.cpp54
-rw-r--r--lib/DebugInfo/PDB/DIA/DIALineNumber.cpp75
-rw-r--r--lib/DebugInfo/PDB/DIA/DIARawSymbol.cpp1095
-rw-r--r--lib/DebugInfo/PDB/DIA/DIASession.cpp117
-rw-r--r--lib/DebugInfo/PDB/DIA/DIASourceFile.cpp67
-rw-r--r--lib/DebugInfo/PDB/IPDBSourceFile.cpp32
-rw-r--r--lib/DebugInfo/PDB/LLVMBuild.txt23
-rw-r--r--lib/DebugInfo/PDB/Makefile14
-rw-r--r--lib/DebugInfo/PDB/PDB.cpp30
-rw-r--r--lib/DebugInfo/PDB/PDBExtras.cpp346
-rw-r--r--lib/DebugInfo/PDB/PDBInterfaceAnchors.cpp28
-rw-r--r--lib/DebugInfo/PDB/PDBSymDumper.cpp177
-rw-r--r--lib/DebugInfo/PDB/PDBSymbol.cpp151
-rw-r--r--lib/DebugInfo/PDB/PDBSymbolAnnotation.cpp25
-rw-r--r--lib/DebugInfo/PDB/PDBSymbolBlock.cpp26
-rw-r--r--lib/DebugInfo/PDB/PDBSymbolCompiland.cpp25
-rw-r--r--lib/DebugInfo/PDB/PDBSymbolCompilandDetails.cpp26
-rw-r--r--lib/DebugInfo/PDB/PDBSymbolCompilandEnv.cpp32
-rw-r--r--lib/DebugInfo/PDB/PDBSymbolCustom.cpp31
-rw-r--r--lib/DebugInfo/PDB/PDBSymbolData.cpp30
-rw-r--r--lib/DebugInfo/PDB/PDBSymbolExe.cpp25
-rw-r--r--lib/DebugInfo/PDB/PDBSymbolFunc.cpp104
-rw-r--r--lib/DebugInfo/PDB/PDBSymbolFuncDebugEnd.cpp26
-rw-r--r--lib/DebugInfo/PDB/PDBSymbolFuncDebugStart.cpp26
-rw-r--r--lib/DebugInfo/PDB/PDBSymbolLabel.cpp25
-rw-r--r--lib/DebugInfo/PDB/PDBSymbolPublicSymbol.cpp26
-rw-r--r--lib/DebugInfo/PDB/PDBSymbolThunk.cpp25
-rw-r--r--lib/DebugInfo/PDB/PDBSymbolTypeArray.cpp30
-rw-r--r--lib/DebugInfo/PDB/PDBSymbolTypeBaseClass.cpp26
-rw-r--r--lib/DebugInfo/PDB/PDBSymbolTypeBuiltin.cpp25
-rw-r--r--lib/DebugInfo/PDB/PDBSymbolTypeCustom.cpp26
-rw-r--r--lib/DebugInfo/PDB/PDBSymbolTypeDimension.cpp27
-rw-r--r--lib/DebugInfo/PDB/PDBSymbolTypeEnum.cpp25
-rw-r--r--lib/DebugInfo/PDB/PDBSymbolTypeFriend.cpp26
-rw-r--r--lib/DebugInfo/PDB/PDBSymbolTypeFunctionArg.cpp25
-rw-r--r--lib/DebugInfo/PDB/PDBSymbolTypeFunctionSig.cpp89
-rw-r--r--lib/DebugInfo/PDB/PDBSymbolTypeManaged.cpp26
-rw-r--r--lib/DebugInfo/PDB/PDBSymbolTypePointer.cpp30
-rw-r--r--lib/DebugInfo/PDB/PDBSymbolTypeTypedef.cpp25
-rw-r--r--lib/DebugInfo/PDB/PDBSymbolTypeUDT.cpp25
-rw-r--r--lib/DebugInfo/PDB/PDBSymbolTypeVTable.cpp25
-rw-r--r--lib/DebugInfo/PDB/PDBSymbolTypeVTableShape.cpp26
-rw-r--r--lib/DebugInfo/PDB/PDBSymbolUnknown.cpp26
-rw-r--r--lib/DebugInfo/PDB/PDBSymbolUsingNamespace.cpp26
50 files changed, 3546 insertions, 0 deletions
diff --git a/lib/DebugInfo/PDB/Android.mk b/lib/DebugInfo/PDB/Android.mk
new file mode 100644
index 0000000..c8d4fd1
--- /dev/null
+++ b/lib/DebugInfo/PDB/Android.mk
@@ -0,0 +1,75 @@
+LOCAL_PATH:= $(call my-dir)
+
+# No dia support
+debuginfo_pdb_SRC_FILES := \
+ IPDBSourceFile.cpp \
+ PDB.cpp \
+ PDBExtras.cpp \
+ PDBInterfaceAnchors.cpp \
+ PDBSymbolAnnotation.cpp \
+ PDBSymbolBlock.cpp \
+ PDBSymbolCompiland.cpp \
+ PDBSymbolCompilandDetails.cpp \
+ PDBSymbolCompilandEnv.cpp \
+ PDBSymbol.cpp \
+ PDBSymbolCustom.cpp \
+ PDBSymbolData.cpp \
+ PDBSymbolExe.cpp \
+ PDBSymbolFunc.cpp \
+ PDBSymbolFuncDebugEnd.cpp \
+ PDBSymbolFuncDebugStart.cpp \
+ PDBSymbolLabel.cpp \
+ PDBSymbolPublicSymbol.cpp \
+ PDBSymbolThunk.cpp \
+ PDBSymbolTypeArray.cpp \
+ PDBSymbolTypeBaseClass.cpp \
+ PDBSymbolTypeBuiltin.cpp \
+ PDBSymbolTypeCustom.cpp \
+ PDBSymbolTypeDimension.cpp \
+ PDBSymbolTypeEnum.cpp \
+ PDBSymbolTypeFriend.cpp \
+ PDBSymbolTypeFunctionArg.cpp \
+ PDBSymbolTypeFunctionSig.cpp \
+ PDBSymbolTypeManaged.cpp \
+ PDBSymbolTypePointer.cpp \
+ PDBSymbolTypeTypedef.cpp \
+ PDBSymbolTypeUDT.cpp \
+ PDBSymbolTypeVTable.cpp \
+ PDBSymbolTypeVTableShape.cpp \
+ PDBSymbolUnknown.cpp \
+ PDBSymbolUsingNamespace.cpp \
+ PDBSymDumper.cpp
+
+# For the host
+# =====================================================
+include $(CLEAR_VARS)
+
+REQUIRES_RTTI := 1
+
+LOCAL_SRC_FILES := $(debuginfo_pdb_SRC_FILES)
+
+LOCAL_MODULE:= libLLVMDebugInfoPDB
+
+LOCAL_MODULE_TAGS := optional
+
+include $(LLVM_HOST_BUILD_MK)
+include $(LLVM_GEN_INTRINSICS_MK)
+include $(BUILD_HOST_STATIC_LIBRARY)
+
+# For the device
+# =====================================================
+ifneq (true,$(DISABLE_LLVM_DEVICE_BUILDS))
+include $(CLEAR_VARS)
+
+REQUIRES_RTTI := 1
+
+LOCAL_SRC_FILES := $(debuginfo_pdb_SRC_FILES)
+
+LOCAL_MODULE:= libLLVMDebugInfoPDB
+
+LOCAL_MODULE_TAGS := optional
+
+include $(LLVM_DEVICE_BUILD_MK)
+include $(LLVM_GEN_INTRINSICS_MK)
+include $(BUILD_STATIC_LIBRARY)
+endif
diff --git a/lib/DebugInfo/PDB/CMakeLists.txt b/lib/DebugInfo/PDB/CMakeLists.txt
new file mode 100644
index 0000000..87e357e
--- /dev/null
+++ b/lib/DebugInfo/PDB/CMakeLists.txt
@@ -0,0 +1,76 @@
+macro(add_pdb_impl_folder group)
+ list(APPEND PDB_IMPL_SOURCES ${ARGN})
+ source_group(${group} FILES ${ARGN})
+endmacro()
+
+if(HAVE_DIA_SDK)
+ include_directories(${MSVC_DIA_SDK_DIR}/include)
+ set(LIBPDB_LINK_FOLDERS "${MSVC_DIA_SDK_DIR}\\lib")
+ if (CMAKE_SIZEOF_VOID_P EQUAL 8)
+ set(LIBPDB_LINK_FOLDERS "${LIBPDB_LINK_FOLDERS}\\amd64")
+ endif()
+ set(LIBPDB_ADDITIONAL_LIBRARIES "${LIBPDB_LINK_FOLDERS}\\diaguids.lib")
+
+ add_pdb_impl_folder(DIA
+ DIA/DIADataStream.cpp
+ DIA/DIAEnumDebugStreams.cpp
+ DIA/DIAEnumLineNumbers.cpp
+ DIA/DIAEnumSourceFiles.cpp
+ DIA/DIAEnumSymbols.cpp
+ DIA/DIALineNumber.cpp
+ DIA/DIARawSymbol.cpp
+ DIA/DIASession.cpp
+ DIA/DIASourceFile.cpp
+ )
+
+ set(LIBPDB_ADDITIONAL_HEADER_DIRS "${LLVM_MAIN_INCLUDE_DIR}/llvm/DebugInfo/PDB/DIA")
+
+endif()
+
+list(APPEND LIBPDB_ADDITIONAL_HEADER_DIRS "${LLVM_MAIN_INCLUDE_DIR}/llvm/DebugInfo/PDB")
+
+add_llvm_library(LLVMDebugInfoPDB
+ IPDBSourceFile.cpp
+ PDB.cpp
+ PDBExtras.cpp
+ PDBInterfaceAnchors.cpp
+ PDBSymbol.cpp
+ PDBSymbolAnnotation.cpp
+ PDBSymbolBlock.cpp
+ PDBSymbolCompiland.cpp
+ PDBSymbolCompilandDetails.cpp
+ PDBSymbolCompilandEnv.cpp
+ PDBSymbolCustom.cpp
+ PDBSymbolData.cpp
+ PDBSymbolExe.cpp
+ PDBSymbolFunc.cpp
+ PDBSymbolFuncDebugEnd.cpp
+ PDBSymbolFuncDebugStart.cpp
+ PDBSymbolLabel.cpp
+ PDBSymbolPublicSymbol.cpp
+ PDBSymbolThunk.cpp
+ PDBSymbolTypeArray.cpp
+ PDBSymbolTypeBaseClass.cpp
+ PDBSymbolTypeBuiltin.cpp
+ PDBSymbolTypeCustom.cpp
+ PDBSymbolTypeDimension.cpp
+ PDBSymbolTypeEnum.cpp
+ PDBSymbolTypeFriend.cpp
+ PDBSymbolTypeFunctionArg.cpp
+ PDBSymbolTypeFunctionSig.cpp
+ PDBSymbolTypeManaged.cpp
+ PDBSymbolTypePointer.cpp
+ PDBSymbolTypeTypedef.cpp
+ PDBSymbolTypeUDT.cpp
+ PDBSymbolTypeVTable.cpp
+ PDBSymbolTypeVTableShape.cpp
+ PDBSymbolUnknown.cpp
+ PDBSymbolUsingNamespace.cpp
+ PDBSymDumper.cpp
+ ${PDB_IMPL_SOURCES}
+
+ ADDITIONAL_HEADER_DIRS
+ ${LIBPDB_ADDITIONAL_HEADER_DIRS}
+ )
+
+target_link_libraries(LLVMDebugInfoPDB ${cmake_2_8_12_INTERFACE} "${LIBPDB_ADDITIONAL_LIBRARIES}")
diff --git a/lib/DebugInfo/PDB/DIA/DIADataStream.cpp b/lib/DebugInfo/PDB/DIA/DIADataStream.cpp
new file mode 100644
index 0000000..e0e1b27
--- /dev/null
+++ b/lib/DebugInfo/PDB/DIA/DIADataStream.cpp
@@ -0,0 +1,73 @@
+//===- DIADataStream.cpp - DIA implementation of IPDBDataStream -*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/DebugInfo/PDB/DIA/DIADataStream.h"
+#include "llvm/Support/ConvertUTF.h"
+
+using namespace llvm;
+
+DIADataStream::DIADataStream(CComPtr<IDiaEnumDebugStreamData> DiaStreamData)
+ : StreamData(DiaStreamData) {}
+
+uint32_t DIADataStream::getRecordCount() const {
+ LONG Count = 0;
+ return (S_OK == StreamData->get_Count(&Count)) ? Count : 0;
+}
+
+std::string DIADataStream::getName() const {
+ CComBSTR Name16;
+ if (S_OK != StreamData->get_name(&Name16))
+ return std::string();
+
+ std::string Name8;
+ llvm::ArrayRef<char> Name16Bytes(reinterpret_cast<char *>(Name16.m_str),
+ Name16.ByteLength());
+ if (!llvm::convertUTF16ToUTF8String(Name16Bytes, Name8))
+ return std::string();
+ return Name8;
+}
+
+llvm::Optional<DIADataStream::RecordType>
+DIADataStream::getItemAtIndex(uint32_t Index) const {
+ RecordType Record;
+ DWORD RecordSize = 0;
+ StreamData->Item(Index, 0, &RecordSize, nullptr);
+ if (RecordSize == 0)
+ return llvm::Optional<RecordType>();
+
+ Record.resize(RecordSize);
+ if (S_OK != StreamData->Item(Index, RecordSize, &RecordSize, &Record[0]))
+ return llvm::Optional<RecordType>();
+ return Record;
+}
+
+bool DIADataStream::getNext(RecordType &Record) {
+ Record.clear();
+ DWORD RecordSize = 0;
+ ULONG CountFetched = 0;
+ StreamData->Next(1, 0, &RecordSize, nullptr, &CountFetched);
+ if (RecordSize == 0)
+ return false;
+
+ Record.resize(RecordSize);
+ if (S_OK ==
+ StreamData->Next(1, RecordSize, &RecordSize, &Record[0], &CountFetched))
+ return false;
+ return true;
+}
+
+void DIADataStream::reset() { StreamData->Reset(); }
+
+DIADataStream *DIADataStream::clone() const {
+ CComPtr<IDiaEnumDebugStreamData> EnumeratorClone;
+ if (S_OK != StreamData->Clone(&EnumeratorClone))
+ return nullptr;
+
+ return new DIADataStream(EnumeratorClone);
+}
diff --git a/lib/DebugInfo/PDB/DIA/DIAEnumDebugStreams.cpp b/lib/DebugInfo/PDB/DIA/DIAEnumDebugStreams.cpp
new file mode 100644
index 0000000..23c6489
--- /dev/null
+++ b/lib/DebugInfo/PDB/DIA/DIAEnumDebugStreams.cpp
@@ -0,0 +1,53 @@
+//==- DIAEnumDebugStreams.cpp - DIA Debug Stream Enumerator impl -*- C++ -*-==//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/DebugInfo/PDB/PDBSymbol.h"
+#include "llvm/DebugInfo/PDB/DIA/DIADataStream.h"
+#include "llvm/DebugInfo/PDB/DIA/DIAEnumDebugStreams.h"
+
+using namespace llvm;
+
+DIAEnumDebugStreams::DIAEnumDebugStreams(
+ CComPtr<IDiaEnumDebugStreams> DiaEnumerator)
+ : Enumerator(DiaEnumerator) {}
+
+uint32_t DIAEnumDebugStreams::getChildCount() const {
+ LONG Count = 0;
+ return (S_OK == Enumerator->get_Count(&Count)) ? Count : 0;
+}
+
+std::unique_ptr<IPDBDataStream>
+DIAEnumDebugStreams::getChildAtIndex(uint32_t Index) const {
+ CComPtr<IDiaEnumDebugStreamData> Item;
+ VARIANT VarIndex;
+ VarIndex.vt = VT_I4;
+ VarIndex.lVal = Index;
+ if (S_OK != Enumerator->Item(VarIndex, &Item))
+ return nullptr;
+
+ return std::unique_ptr<IPDBDataStream>(new DIADataStream(Item));
+}
+
+std::unique_ptr<IPDBDataStream> DIAEnumDebugStreams::getNext() {
+ CComPtr<IDiaEnumDebugStreamData> Item;
+ ULONG NumFetched = 0;
+ if (S_OK != Enumerator->Next(1, &Item, &NumFetched))
+ return nullptr;
+
+ return std::unique_ptr<IPDBDataStream>(new DIADataStream(Item));
+}
+
+void DIAEnumDebugStreams::reset() { Enumerator->Reset(); }
+
+DIAEnumDebugStreams *DIAEnumDebugStreams::clone() const {
+ CComPtr<IDiaEnumDebugStreams> EnumeratorClone;
+ if (S_OK != Enumerator->Clone(&EnumeratorClone))
+ return nullptr;
+ return new DIAEnumDebugStreams(EnumeratorClone);
+}
diff --git a/lib/DebugInfo/PDB/DIA/DIAEnumLineNumbers.cpp b/lib/DebugInfo/PDB/DIA/DIAEnumLineNumbers.cpp
new file mode 100644
index 0000000..32a9af2
--- /dev/null
+++ b/lib/DebugInfo/PDB/DIA/DIAEnumLineNumbers.cpp
@@ -0,0 +1,50 @@
+//==- DIAEnumLineNumbers.cpp - DIA Line Number Enumerator impl ---*- C++ -*-==//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/DebugInfo/PDB/PDBSymbol.h"
+#include "llvm/DebugInfo/PDB/DIA/DIAEnumLineNumbers.h"
+#include "llvm/DebugInfo/PDB/DIA/DIALineNumber.h"
+
+using namespace llvm;
+
+DIAEnumLineNumbers::DIAEnumLineNumbers(
+ CComPtr<IDiaEnumLineNumbers> DiaEnumerator)
+ : Enumerator(DiaEnumerator) {}
+
+uint32_t DIAEnumLineNumbers::getChildCount() const {
+ LONG Count = 0;
+ return (S_OK == Enumerator->get_Count(&Count)) ? Count : 0;
+}
+
+std::unique_ptr<IPDBLineNumber>
+DIAEnumLineNumbers::getChildAtIndex(uint32_t Index) const {
+ CComPtr<IDiaLineNumber> Item;
+ if (S_OK != Enumerator->Item(Index, &Item))
+ return nullptr;
+
+ return std::unique_ptr<IPDBLineNumber>(new DIALineNumber(Item));
+}
+
+std::unique_ptr<IPDBLineNumber> DIAEnumLineNumbers::getNext() {
+ CComPtr<IDiaLineNumber> Item;
+ ULONG NumFetched = 0;
+ if (S_OK != Enumerator->Next(1, &Item, &NumFetched))
+ return nullptr;
+
+ return std::unique_ptr<IPDBLineNumber>(new DIALineNumber(Item));
+}
+
+void DIAEnumLineNumbers::reset() { Enumerator->Reset(); }
+
+DIAEnumLineNumbers *DIAEnumLineNumbers::clone() const {
+ CComPtr<IDiaEnumLineNumbers> EnumeratorClone;
+ if (S_OK != Enumerator->Clone(&EnumeratorClone))
+ return nullptr;
+ return new DIAEnumLineNumbers(EnumeratorClone);
+}
diff --git a/lib/DebugInfo/PDB/DIA/DIAEnumSourceFiles.cpp b/lib/DebugInfo/PDB/DIA/DIAEnumSourceFiles.cpp
new file mode 100644
index 0000000..1a94610
--- /dev/null
+++ b/lib/DebugInfo/PDB/DIA/DIAEnumSourceFiles.cpp
@@ -0,0 +1,50 @@
+//==- DIAEnumSourceFiles.cpp - DIA Source File Enumerator impl ---*- C++ -*-==//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/DebugInfo/PDB/PDBSymbol.h"
+#include "llvm/DebugInfo/PDB/DIA/DIAEnumSourceFiles.h"
+#include "llvm/DebugInfo/PDB/DIA/DIASourceFile.h"
+
+using namespace llvm;
+
+DIAEnumSourceFiles::DIAEnumSourceFiles(
+ const DIASession &PDBSession, CComPtr<IDiaEnumSourceFiles> DiaEnumerator)
+ : Session(PDBSession), Enumerator(DiaEnumerator) {}
+
+uint32_t DIAEnumSourceFiles::getChildCount() const {
+ LONG Count = 0;
+ return (S_OK == Enumerator->get_Count(&Count)) ? Count : 0;
+}
+
+std::unique_ptr<IPDBSourceFile>
+DIAEnumSourceFiles::getChildAtIndex(uint32_t Index) const {
+ CComPtr<IDiaSourceFile> Item;
+ if (S_OK != Enumerator->Item(Index, &Item))
+ return nullptr;
+
+ return std::unique_ptr<IPDBSourceFile>(new DIASourceFile(Session, Item));
+}
+
+std::unique_ptr<IPDBSourceFile> DIAEnumSourceFiles::getNext() {
+ CComPtr<IDiaSourceFile> Item;
+ ULONG NumFetched = 0;
+ if (S_OK != Enumerator->Next(1, &Item, &NumFetched))
+ return nullptr;
+
+ return std::unique_ptr<IPDBSourceFile>(new DIASourceFile(Session, Item));
+}
+
+void DIAEnumSourceFiles::reset() { Enumerator->Reset(); }
+
+DIAEnumSourceFiles *DIAEnumSourceFiles::clone() const {
+ CComPtr<IDiaEnumSourceFiles> EnumeratorClone;
+ if (S_OK != Enumerator->Clone(&EnumeratorClone))
+ return nullptr;
+ return new DIAEnumSourceFiles(Session, EnumeratorClone);
+}
diff --git a/lib/DebugInfo/PDB/DIA/DIAEnumSymbols.cpp b/lib/DebugInfo/PDB/DIA/DIAEnumSymbols.cpp
new file mode 100644
index 0000000..6754d9a
--- /dev/null
+++ b/lib/DebugInfo/PDB/DIA/DIAEnumSymbols.cpp
@@ -0,0 +1,54 @@
+//==- DIAEnumSymbols.cpp - DIA Symbol Enumerator impl ------------*- C++ -*-==//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/DebugInfo/PDB/PDBSymbol.h"
+#include "llvm/DebugInfo/PDB/DIA/DIAEnumSymbols.h"
+#include "llvm/DebugInfo/PDB/DIA/DIARawSymbol.h"
+#include "llvm/DebugInfo/PDB/DIA/DIASession.h"
+
+using namespace llvm;
+
+DIAEnumSymbols::DIAEnumSymbols(const DIASession &PDBSession,
+ CComPtr<IDiaEnumSymbols> DiaEnumerator)
+ : Session(PDBSession), Enumerator(DiaEnumerator) {}
+
+uint32_t DIAEnumSymbols::getChildCount() const {
+ LONG Count = 0;
+ return (S_OK == Enumerator->get_Count(&Count)) ? Count : 0;
+}
+
+std::unique_ptr<PDBSymbol>
+DIAEnumSymbols::getChildAtIndex(uint32_t Index) const {
+ CComPtr<IDiaSymbol> Item;
+ if (S_OK != Enumerator->Item(Index, &Item))
+ return nullptr;
+
+ std::unique_ptr<DIARawSymbol> RawSymbol(new DIARawSymbol(Session, Item));
+ return std::unique_ptr<PDBSymbol>(PDBSymbol::create(Session, std::move(RawSymbol)));
+}
+
+std::unique_ptr<PDBSymbol> DIAEnumSymbols::getNext() {
+ CComPtr<IDiaSymbol> Item;
+ ULONG NumFetched = 0;
+ if (S_OK != Enumerator->Next(1, &Item, &NumFetched))
+ return nullptr;
+
+ std::unique_ptr<DIARawSymbol> RawSymbol(new DIARawSymbol(Session, Item));
+ return std::unique_ptr<PDBSymbol>(
+ PDBSymbol::create(Session, std::move(RawSymbol)));
+}
+
+void DIAEnumSymbols::reset() { Enumerator->Reset(); }
+
+DIAEnumSymbols *DIAEnumSymbols::clone() const {
+ CComPtr<IDiaEnumSymbols> EnumeratorClone;
+ if (S_OK != Enumerator->Clone(&EnumeratorClone))
+ return nullptr;
+ return new DIAEnumSymbols(Session, EnumeratorClone);
+}
diff --git a/lib/DebugInfo/PDB/DIA/DIALineNumber.cpp b/lib/DebugInfo/PDB/DIA/DIALineNumber.cpp
new file mode 100644
index 0000000..c5577f1
--- /dev/null
+++ b/lib/DebugInfo/PDB/DIA/DIALineNumber.cpp
@@ -0,0 +1,75 @@
+//===- DIALineNumber.cpp - DIA implementation of IPDBLineNumber -*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/DebugInfo/PDB/DIA/DIALineNumber.h"
+
+using namespace llvm;
+
+DIALineNumber::DIALineNumber(CComPtr<IDiaLineNumber> DiaLineNumber)
+ : LineNumber(DiaLineNumber) {}
+
+uint32_t DIALineNumber::getLineNumber() const {
+ DWORD Line = 0;
+ return (S_OK == LineNumber->get_lineNumber(&Line)) ? Line : 0;
+}
+
+uint32_t DIALineNumber::getLineNumberEnd() const {
+ DWORD LineEnd = 0;
+ return (S_OK == LineNumber->get_lineNumberEnd(&LineEnd)) ? LineEnd : 0;
+}
+
+uint32_t DIALineNumber::getColumnNumber() const {
+ DWORD Column = 0;
+ return (S_OK == LineNumber->get_columnNumber(&Column)) ? Column : 0;
+}
+
+uint32_t DIALineNumber::getColumnNumberEnd() const {
+ DWORD ColumnEnd = 0;
+ return (S_OK == LineNumber->get_columnNumberEnd(&ColumnEnd)) ? ColumnEnd : 0;
+}
+
+uint32_t DIALineNumber::getAddressSection() const {
+ DWORD Section = 0;
+ return (S_OK == LineNumber->get_addressSection(&Section)) ? Section : 0;
+}
+
+uint32_t DIALineNumber::getAddressOffset() const {
+ DWORD Offset = 0;
+ return (S_OK == LineNumber->get_addressOffset(&Offset)) ? Offset : 0;
+}
+
+uint32_t DIALineNumber::getRelativeVirtualAddress() const {
+ DWORD RVA = 0;
+ return (S_OK == LineNumber->get_relativeVirtualAddress(&RVA)) ? RVA : 0;
+}
+
+uint64_t DIALineNumber::getVirtualAddress() const {
+ ULONGLONG Addr = 0;
+ return (S_OK == LineNumber->get_virtualAddress(&Addr)) ? Addr : 0;
+}
+
+uint32_t DIALineNumber::getLength() const {
+ DWORD Length = 0;
+ return (S_OK == LineNumber->get_length(&Length)) ? Length : 0;
+}
+
+uint32_t DIALineNumber::getSourceFileId() const {
+ DWORD Id = 0;
+ return (S_OK == LineNumber->get_sourceFileId(&Id)) ? Id : 0;
+}
+
+uint32_t DIALineNumber::getCompilandId() const {
+ DWORD Id = 0;
+ return (S_OK == LineNumber->get_compilandId(&Id)) ? Id : 0;
+}
+
+bool DIALineNumber::isStatement() const {
+ BOOL Statement = 0;
+ return (S_OK == LineNumber->get_statement(&Statement)) ? Statement : false;
+}
diff --git a/lib/DebugInfo/PDB/DIA/DIARawSymbol.cpp b/lib/DebugInfo/PDB/DIA/DIARawSymbol.cpp
new file mode 100644
index 0000000..abe0ab5
--- /dev/null
+++ b/lib/DebugInfo/PDB/DIA/DIARawSymbol.cpp
@@ -0,0 +1,1095 @@
+//===- DIARawSymbol.cpp - DIA implementation of IPDBRawSymbol ---*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/ADT/STLExtras.h"
+#include "llvm/DebugInfo/PDB/DIA/DIAEnumSymbols.h"
+#include "llvm/DebugInfo/PDB/DIA/DIARawSymbol.h"
+#include "llvm/DebugInfo/PDB/DIA/DIASession.h"
+#include "llvm/DebugInfo/PDB/PDBExtras.h"
+#include "llvm/Support/ConvertUTF.h"
+#include "llvm/Support/raw_ostream.h"
+
+using namespace llvm;
+
+namespace {
+Variant VariantFromVARIANT(const VARIANT &V) {
+ Variant Result;
+ switch (V.vt) {
+ case VT_I1:
+ Result.Int8 = V.cVal;
+ Result.Type = PDB_VariantType::Int8;
+ break;
+ case VT_I2:
+ Result.Int16 = V.iVal;
+ Result.Type = PDB_VariantType::Int16;
+ break;
+ case VT_I4:
+ Result.Int32 = V.intVal;
+ Result.Type = PDB_VariantType::Int32;
+ break;
+ case VT_I8:
+ Result.Int64 = V.llVal;
+ Result.Type = PDB_VariantType::Int64;
+ break;
+ case VT_UI1:
+ Result.UInt8 = V.bVal;
+ Result.Type = PDB_VariantType::UInt8;
+ break;
+ case VT_UI2:
+ Result.UInt16 = V.uiVal;
+ Result.Type = PDB_VariantType::UInt16;
+ break;
+ case VT_UI4:
+ Result.UInt32 = V.uintVal;
+ Result.Type = PDB_VariantType::UInt32;
+ break;
+ case VT_UI8:
+ Result.UInt64 = V.ullVal;
+ Result.Type = PDB_VariantType::UInt64;
+ break;
+ case VT_BOOL:
+ Result.Bool = (V.boolVal == VARIANT_TRUE) ? true : false;
+ Result.Type = PDB_VariantType::Bool;
+ break;
+ case VT_R4:
+ Result.Single = V.fltVal;
+ Result.Type = PDB_VariantType::Single;
+ break;
+ case VT_R8:
+ Result.Double = V.dblVal;
+ Result.Type = PDB_VariantType::Double;
+ break;
+ default:
+ Result.Type = PDB_VariantType::Unknown;
+ break;
+ }
+ return Result;
+}
+
+template <typename ArgType>
+ArgType PrivateGetDIAValue(IDiaSymbol *Symbol,
+ HRESULT (__stdcall IDiaSymbol::*Method)(ArgType *)) {
+ ArgType Value;
+ if (S_OK == (Symbol->*Method)(&Value))
+ return static_cast<ArgType>(Value);
+
+ return ArgType();
+}
+
+template <typename ArgType, typename RetType>
+RetType PrivateGetDIAValue(IDiaSymbol *Symbol,
+ HRESULT (__stdcall IDiaSymbol::*Method)(ArgType *)) {
+ ArgType Value;
+ if (S_OK == (Symbol->*Method)(&Value))
+ return static_cast<RetType>(Value);
+
+ return RetType();
+}
+
+std::string
+PrivateGetDIAValue(IDiaSymbol *Symbol,
+ HRESULT (__stdcall IDiaSymbol::*Method)(BSTR *)) {
+ CComBSTR Result16;
+ if (S_OK != (Symbol->*Method)(&Result16))
+ return std::string();
+
+ const char *SrcBytes = reinterpret_cast<const char *>(Result16.m_str);
+ llvm::ArrayRef<char> SrcByteArray(SrcBytes, Result16.ByteLength());
+ std::string Result8;
+ if (!llvm::convertUTF16ToUTF8String(SrcByteArray, Result8))
+ return std::string();
+ return Result8;
+}
+
+PDB_UniqueId
+PrivateGetDIAValue(IDiaSymbol *Symbol,
+ HRESULT (__stdcall IDiaSymbol::*Method)(GUID *)) {
+ GUID Result;
+ if (S_OK != (Symbol->*Method)(&Result))
+ return PDB_UniqueId();
+
+ static_assert(sizeof(PDB_UniqueId) == sizeof(GUID),
+ "PDB_UniqueId is the wrong size!");
+ PDB_UniqueId IdResult;
+ ::memcpy(&IdResult, &Result, sizeof(GUID));
+ return IdResult;
+}
+
+template <typename ArgType>
+void DumpDIAValue(llvm::raw_ostream &OS, int Indent, StringRef Name,
+ IDiaSymbol *Symbol,
+ HRESULT (__stdcall IDiaSymbol::*Method)(ArgType *)) {
+ ArgType Value;
+ if (S_OK == (Symbol->*Method)(&Value)) {
+ OS << "\n";
+ OS.indent(Indent);
+ OS << Name << ": " << Value;
+ }
+}
+
+void DumpDIAValue(llvm::raw_ostream &OS, int Indent, StringRef Name,
+ IDiaSymbol *Symbol,
+ HRESULT (__stdcall IDiaSymbol::*Method)(BSTR *)) {
+ BSTR Value = nullptr;
+ if (S_OK != (Symbol->*Method)(&Value))
+ return;
+ const char *Bytes = reinterpret_cast<const char *>(Value);
+ ArrayRef<char> ByteArray(Bytes, ::SysStringByteLen(Value));
+ std::string Result;
+ if (llvm::convertUTF16ToUTF8String(ByteArray, Result)) {
+ OS << "\n";
+ OS.indent(Indent);
+ OS << Name << ": " << Result;
+ }
+ ::SysFreeString(Value);
+}
+
+void DumpDIAValue(llvm::raw_ostream &OS, int Indent, StringRef Name,
+ IDiaSymbol *Symbol,
+ HRESULT (__stdcall IDiaSymbol::*Method)(VARIANT *)) {
+ VARIANT Value;
+ Value.vt = VT_EMPTY;
+ if (S_OK != (Symbol->*Method)(&Value))
+ return;
+ OS << "\n";
+ OS.indent(Indent);
+ Variant V = VariantFromVARIANT(Value);
+ OS << V;
+}
+}
+
+namespace llvm {
+raw_ostream &operator<<(raw_ostream &OS, const GUID &Guid) {
+ const PDB_UniqueId *Id = reinterpret_cast<const PDB_UniqueId *>(&Guid);
+ OS << *Id;
+ return OS;
+}
+}
+
+DIARawSymbol::DIARawSymbol(const DIASession &PDBSession,
+ CComPtr<IDiaSymbol> DiaSymbol)
+ : Session(PDBSession), Symbol(DiaSymbol) {}
+
+#define RAW_METHOD_DUMP(Stream, Method) \
+ DumpDIAValue(Stream, Indent, StringRef(#Method), Symbol, &IDiaSymbol::Method);
+
+void DIARawSymbol::dump(raw_ostream &OS, int Indent) const {
+ RAW_METHOD_DUMP(OS, get_access)
+ RAW_METHOD_DUMP(OS, get_addressOffset)
+ RAW_METHOD_DUMP(OS, get_addressSection)
+ RAW_METHOD_DUMP(OS, get_age)
+ RAW_METHOD_DUMP(OS, get_arrayIndexTypeId)
+ RAW_METHOD_DUMP(OS, get_backEndMajor)
+ RAW_METHOD_DUMP(OS, get_backEndMinor)
+ RAW_METHOD_DUMP(OS, get_backEndBuild)
+ RAW_METHOD_DUMP(OS, get_backEndQFE)
+ RAW_METHOD_DUMP(OS, get_baseDataOffset)
+ RAW_METHOD_DUMP(OS, get_baseDataSlot)
+ RAW_METHOD_DUMP(OS, get_baseSymbolId)
+ RAW_METHOD_DUMP(OS, get_baseType)
+ RAW_METHOD_DUMP(OS, get_bitPosition)
+ RAW_METHOD_DUMP(OS, get_callingConvention)
+ RAW_METHOD_DUMP(OS, get_classParentId)
+ RAW_METHOD_DUMP(OS, get_compilerName)
+ RAW_METHOD_DUMP(OS, get_count)
+ RAW_METHOD_DUMP(OS, get_countLiveRanges)
+ RAW_METHOD_DUMP(OS, get_frontEndMajor)
+ RAW_METHOD_DUMP(OS, get_frontEndMinor)
+ RAW_METHOD_DUMP(OS, get_frontEndBuild)
+ RAW_METHOD_DUMP(OS, get_frontEndQFE)
+ RAW_METHOD_DUMP(OS, get_lexicalParentId)
+ RAW_METHOD_DUMP(OS, get_libraryName)
+ RAW_METHOD_DUMP(OS, get_liveRangeStartAddressOffset)
+ RAW_METHOD_DUMP(OS, get_liveRangeStartAddressSection)
+ RAW_METHOD_DUMP(OS, get_liveRangeStartRelativeVirtualAddress)
+ RAW_METHOD_DUMP(OS, get_localBasePointerRegisterId)
+ RAW_METHOD_DUMP(OS, get_lowerBoundId)
+ RAW_METHOD_DUMP(OS, get_memorySpaceKind)
+ RAW_METHOD_DUMP(OS, get_name)
+ RAW_METHOD_DUMP(OS, get_numberOfAcceleratorPointerTags)
+ RAW_METHOD_DUMP(OS, get_numberOfColumns)
+ RAW_METHOD_DUMP(OS, get_numberOfModifiers)
+ RAW_METHOD_DUMP(OS, get_numberOfRegisterIndices)
+ RAW_METHOD_DUMP(OS, get_numberOfRows)
+ RAW_METHOD_DUMP(OS, get_objectFileName)
+ RAW_METHOD_DUMP(OS, get_oemId)
+ RAW_METHOD_DUMP(OS, get_oemSymbolId)
+ RAW_METHOD_DUMP(OS, get_offsetInUdt)
+ RAW_METHOD_DUMP(OS, get_platform)
+ RAW_METHOD_DUMP(OS, get_rank)
+ RAW_METHOD_DUMP(OS, get_registerId)
+ RAW_METHOD_DUMP(OS, get_registerType)
+ RAW_METHOD_DUMP(OS, get_relativeVirtualAddress)
+ RAW_METHOD_DUMP(OS, get_samplerSlot)
+ RAW_METHOD_DUMP(OS, get_signature)
+ RAW_METHOD_DUMP(OS, get_sizeInUdt)
+ RAW_METHOD_DUMP(OS, get_slot)
+ RAW_METHOD_DUMP(OS, get_sourceFileName)
+ RAW_METHOD_DUMP(OS, get_stride)
+ RAW_METHOD_DUMP(OS, get_subTypeId)
+ RAW_METHOD_DUMP(OS, get_symbolsFileName)
+ RAW_METHOD_DUMP(OS, get_symIndexId)
+ RAW_METHOD_DUMP(OS, get_targetOffset)
+ RAW_METHOD_DUMP(OS, get_targetRelativeVirtualAddress)
+ RAW_METHOD_DUMP(OS, get_targetVirtualAddress)
+ RAW_METHOD_DUMP(OS, get_targetSection)
+ RAW_METHOD_DUMP(OS, get_textureSlot)
+ RAW_METHOD_DUMP(OS, get_timeStamp)
+ RAW_METHOD_DUMP(OS, get_token)
+ RAW_METHOD_DUMP(OS, get_typeId)
+ RAW_METHOD_DUMP(OS, get_uavSlot)
+ RAW_METHOD_DUMP(OS, get_undecoratedName)
+ RAW_METHOD_DUMP(OS, get_unmodifiedTypeId)
+ RAW_METHOD_DUMP(OS, get_upperBoundId)
+ RAW_METHOD_DUMP(OS, get_virtualBaseDispIndex)
+ RAW_METHOD_DUMP(OS, get_virtualBaseOffset)
+ RAW_METHOD_DUMP(OS, get_virtualTableShapeId)
+ RAW_METHOD_DUMP(OS, get_dataKind)
+ RAW_METHOD_DUMP(OS, get_symTag)
+ RAW_METHOD_DUMP(OS, get_guid)
+ RAW_METHOD_DUMP(OS, get_offset)
+ RAW_METHOD_DUMP(OS, get_thisAdjust)
+ RAW_METHOD_DUMP(OS, get_virtualBasePointerOffset)
+ RAW_METHOD_DUMP(OS, get_locationType)
+ RAW_METHOD_DUMP(OS, get_machineType)
+ RAW_METHOD_DUMP(OS, get_thunkOrdinal)
+ RAW_METHOD_DUMP(OS, get_length)
+ RAW_METHOD_DUMP(OS, get_liveRangeLength)
+ RAW_METHOD_DUMP(OS, get_virtualAddress)
+ RAW_METHOD_DUMP(OS, get_udtKind)
+ RAW_METHOD_DUMP(OS, get_constructor)
+ RAW_METHOD_DUMP(OS, get_customCallingConvention)
+ RAW_METHOD_DUMP(OS, get_farReturn)
+ RAW_METHOD_DUMP(OS, get_code)
+ RAW_METHOD_DUMP(OS, get_compilerGenerated)
+ RAW_METHOD_DUMP(OS, get_constType)
+ RAW_METHOD_DUMP(OS, get_editAndContinueEnabled)
+ RAW_METHOD_DUMP(OS, get_function)
+ RAW_METHOD_DUMP(OS, get_stride)
+ RAW_METHOD_DUMP(OS, get_noStackOrdering)
+ RAW_METHOD_DUMP(OS, get_hasAlloca)
+ RAW_METHOD_DUMP(OS, get_hasAssignmentOperator)
+ RAW_METHOD_DUMP(OS, get_isCTypes)
+ RAW_METHOD_DUMP(OS, get_hasCastOperator)
+ RAW_METHOD_DUMP(OS, get_hasDebugInfo)
+ RAW_METHOD_DUMP(OS, get_hasEH)
+ RAW_METHOD_DUMP(OS, get_hasEHa)
+ RAW_METHOD_DUMP(OS, get_hasInlAsm)
+ RAW_METHOD_DUMP(OS, get_framePointerPresent)
+ RAW_METHOD_DUMP(OS, get_inlSpec)
+ RAW_METHOD_DUMP(OS, get_interruptReturn)
+ RAW_METHOD_DUMP(OS, get_hasLongJump)
+ RAW_METHOD_DUMP(OS, get_hasManagedCode)
+ RAW_METHOD_DUMP(OS, get_hasNestedTypes)
+ RAW_METHOD_DUMP(OS, get_noInline)
+ RAW_METHOD_DUMP(OS, get_noReturn)
+ RAW_METHOD_DUMP(OS, get_optimizedCodeDebugInfo)
+ RAW_METHOD_DUMP(OS, get_overloadedOperator)
+ RAW_METHOD_DUMP(OS, get_hasSEH)
+ RAW_METHOD_DUMP(OS, get_hasSecurityChecks)
+ RAW_METHOD_DUMP(OS, get_hasSetJump)
+ RAW_METHOD_DUMP(OS, get_strictGSCheck)
+ RAW_METHOD_DUMP(OS, get_isAcceleratorGroupSharedLocal)
+ RAW_METHOD_DUMP(OS, get_isAcceleratorPointerTagLiveRange)
+ RAW_METHOD_DUMP(OS, get_isAcceleratorStubFunction)
+ RAW_METHOD_DUMP(OS, get_isAggregated)
+ RAW_METHOD_DUMP(OS, get_intro)
+ RAW_METHOD_DUMP(OS, get_isCVTCIL)
+ RAW_METHOD_DUMP(OS, get_isConstructorVirtualBase)
+ RAW_METHOD_DUMP(OS, get_isCxxReturnUdt)
+ RAW_METHOD_DUMP(OS, get_isDataAligned)
+ RAW_METHOD_DUMP(OS, get_isHLSLData)
+ RAW_METHOD_DUMP(OS, get_isHotpatchable)
+ RAW_METHOD_DUMP(OS, get_indirectVirtualBaseClass)
+ RAW_METHOD_DUMP(OS, get_isInterfaceUdt)
+ RAW_METHOD_DUMP(OS, get_intrinsic)
+ RAW_METHOD_DUMP(OS, get_isLTCG)
+ RAW_METHOD_DUMP(OS, get_isLocationControlFlowDependent)
+ RAW_METHOD_DUMP(OS, get_isMSILNetmodule)
+ RAW_METHOD_DUMP(OS, get_isMatrixRowMajor)
+ RAW_METHOD_DUMP(OS, get_managed)
+ RAW_METHOD_DUMP(OS, get_msil)
+ RAW_METHOD_DUMP(OS, get_isMultipleInheritance)
+ RAW_METHOD_DUMP(OS, get_isNaked)
+ RAW_METHOD_DUMP(OS, get_nested)
+ RAW_METHOD_DUMP(OS, get_isOptimizedAway)
+ RAW_METHOD_DUMP(OS, get_packed)
+ RAW_METHOD_DUMP(OS, get_isPointerBasedOnSymbolValue)
+ RAW_METHOD_DUMP(OS, get_isPointerToDataMember)
+ RAW_METHOD_DUMP(OS, get_isPointerToMemberFunction)
+ RAW_METHOD_DUMP(OS, get_pure)
+ RAW_METHOD_DUMP(OS, get_RValueReference)
+ RAW_METHOD_DUMP(OS, get_isRefUdt)
+ RAW_METHOD_DUMP(OS, get_reference)
+ RAW_METHOD_DUMP(OS, get_restrictedType)
+ RAW_METHOD_DUMP(OS, get_isReturnValue)
+ RAW_METHOD_DUMP(OS, get_isSafeBuffers)
+ RAW_METHOD_DUMP(OS, get_scoped)
+ RAW_METHOD_DUMP(OS, get_isSdl)
+ RAW_METHOD_DUMP(OS, get_isSingleInheritance)
+ RAW_METHOD_DUMP(OS, get_isSplitted)
+ RAW_METHOD_DUMP(OS, get_isStatic)
+ RAW_METHOD_DUMP(OS, get_isStripped)
+ RAW_METHOD_DUMP(OS, get_unalignedType)
+ RAW_METHOD_DUMP(OS, get_notReached)
+ RAW_METHOD_DUMP(OS, get_isValueUdt)
+ RAW_METHOD_DUMP(OS, get_virtual)
+ RAW_METHOD_DUMP(OS, get_virtualBaseClass)
+ RAW_METHOD_DUMP(OS, get_isVirtualInheritance)
+ RAW_METHOD_DUMP(OS, get_volatileType)
+ RAW_METHOD_DUMP(OS, get_wasInlined)
+ RAW_METHOD_DUMP(OS, get_unused)
+ RAW_METHOD_DUMP(OS, get_value)
+}
+
+std::unique_ptr<IPDBEnumSymbols>
+DIARawSymbol::findChildren(PDB_SymType Type) const {
+ enum SymTagEnum EnumVal = static_cast<enum SymTagEnum>(Type);
+
+ CComPtr<IDiaEnumSymbols> DiaEnumerator;
+ if (S_OK != Symbol->findChildrenEx(EnumVal, nullptr, nsNone, &DiaEnumerator))
+ return nullptr;
+
+ return llvm::make_unique<DIAEnumSymbols>(Session, DiaEnumerator);
+}
+
+std::unique_ptr<IPDBEnumSymbols>
+DIARawSymbol::findChildren(PDB_SymType Type, StringRef Name,
+ PDB_NameSearchFlags Flags) const {
+ llvm::SmallVector<UTF16, 32> Name16;
+ llvm::convertUTF8ToUTF16String(Name, Name16);
+
+ enum SymTagEnum EnumVal = static_cast<enum SymTagEnum>(Type);
+ DWORD CompareFlags = static_cast<DWORD>(Flags);
+ wchar_t *Name16Str = reinterpret_cast<wchar_t *>(Name16.data());
+
+ CComPtr<IDiaEnumSymbols> DiaEnumerator;
+ if (S_OK !=
+ Symbol->findChildrenEx(EnumVal, Name16Str, CompareFlags, &DiaEnumerator))
+ return nullptr;
+
+ return llvm::make_unique<DIAEnumSymbols>(Session, DiaEnumerator);
+}
+
+std::unique_ptr<IPDBEnumSymbols>
+DIARawSymbol::findChildrenByRVA(PDB_SymType Type, StringRef Name,
+ PDB_NameSearchFlags Flags, uint32_t RVA) const {
+ llvm::SmallVector<UTF16, 32> Name16;
+ llvm::convertUTF8ToUTF16String(Name, Name16);
+
+ enum SymTagEnum EnumVal = static_cast<enum SymTagEnum>(Type);
+ DWORD CompareFlags = static_cast<DWORD>(Flags);
+ wchar_t *Name16Str = reinterpret_cast<wchar_t *>(Name16.data());
+
+ CComPtr<IDiaEnumSymbols> DiaEnumerator;
+ if (S_OK !=
+ Symbol->findChildrenExByRVA(EnumVal, Name16Str, CompareFlags, RVA,
+ &DiaEnumerator))
+ return nullptr;
+
+ return llvm::make_unique<DIAEnumSymbols>(Session, DiaEnumerator);
+}
+
+std::unique_ptr<IPDBEnumSymbols>
+DIARawSymbol::findInlineFramesByRVA(uint32_t RVA) const {
+ CComPtr<IDiaEnumSymbols> DiaEnumerator;
+ if (S_OK != Symbol->findInlineFramesByRVA(RVA, &DiaEnumerator))
+ return nullptr;
+
+ return llvm::make_unique<DIAEnumSymbols>(Session, DiaEnumerator);
+}
+
+void DIARawSymbol::getDataBytes(llvm::SmallVector<uint8_t, 32> &bytes) const {
+ bytes.clear();
+
+ DWORD DataSize = 0;
+ Symbol->get_dataBytes(0, &DataSize, nullptr);
+ if (DataSize == 0)
+ return;
+
+ bytes.resize(DataSize);
+ Symbol->get_dataBytes(DataSize, &DataSize, bytes.data());
+}
+
+PDB_MemberAccess DIARawSymbol::getAccess() const {
+ return PrivateGetDIAValue<DWORD, PDB_MemberAccess>(Symbol,
+ &IDiaSymbol::get_access);
+}
+
+uint32_t DIARawSymbol::getAddressOffset() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_addressOffset);
+}
+
+uint32_t DIARawSymbol::getAddressSection() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_addressSection);
+}
+
+uint32_t DIARawSymbol::getAge() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_age);
+}
+
+uint32_t DIARawSymbol::getArrayIndexTypeId() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_arrayIndexTypeId);
+}
+
+void DIARawSymbol::getBackEndVersion(VersionInfo &Version) const {
+ Version.Major = PrivateGetDIAValue(Symbol, &IDiaSymbol::get_backEndMajor);
+ Version.Minor = PrivateGetDIAValue(Symbol, &IDiaSymbol::get_backEndMinor);
+ Version.Build = PrivateGetDIAValue(Symbol, &IDiaSymbol::get_backEndBuild);
+ Version.QFE = PrivateGetDIAValue(Symbol, &IDiaSymbol::get_backEndQFE);
+}
+
+uint32_t DIARawSymbol::getBaseDataOffset() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_baseDataOffset);
+}
+
+uint32_t DIARawSymbol::getBaseDataSlot() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_baseDataSlot);
+}
+
+uint32_t DIARawSymbol::getBaseSymbolId() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_baseSymbolId);
+}
+
+PDB_BuiltinType DIARawSymbol::getBuiltinType() const {
+ return PrivateGetDIAValue<DWORD, PDB_BuiltinType>(Symbol,
+ &IDiaSymbol::get_baseType);
+}
+
+uint32_t DIARawSymbol::getBitPosition() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_bitPosition);
+}
+
+PDB_CallingConv DIARawSymbol::getCallingConvention() const {
+ return PrivateGetDIAValue<DWORD, PDB_CallingConv>(
+ Symbol, &IDiaSymbol::get_callingConvention);
+}
+
+uint32_t DIARawSymbol::getClassParentId() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_classParentId);
+}
+
+std::string DIARawSymbol::getCompilerName() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_compilerName);
+}
+
+uint32_t DIARawSymbol::getCount() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_count);
+}
+
+uint32_t DIARawSymbol::getCountLiveRanges() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_countLiveRanges);
+}
+
+void DIARawSymbol::getFrontEndVersion(VersionInfo &Version) const {
+ Version.Major = PrivateGetDIAValue(Symbol, &IDiaSymbol::get_frontEndMajor);
+ Version.Minor = PrivateGetDIAValue(Symbol, &IDiaSymbol::get_frontEndMinor);
+ Version.Build = PrivateGetDIAValue(Symbol, &IDiaSymbol::get_frontEndBuild);
+ Version.QFE = PrivateGetDIAValue(Symbol, &IDiaSymbol::get_frontEndQFE);
+}
+
+PDB_Lang DIARawSymbol::getLanguage() const {
+ return PrivateGetDIAValue<DWORD, PDB_Lang>(Symbol, &IDiaSymbol::get_language);
+}
+
+uint32_t DIARawSymbol::getLexicalParentId() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_lexicalParentId);
+}
+
+std::string DIARawSymbol::getLibraryName() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_libraryName);
+}
+
+uint32_t DIARawSymbol::getLiveRangeStartAddressOffset() const {
+ return PrivateGetDIAValue(Symbol,
+ &IDiaSymbol::get_liveRangeStartAddressOffset);
+}
+
+uint32_t DIARawSymbol::getLiveRangeStartAddressSection() const {
+ return PrivateGetDIAValue(Symbol,
+ &IDiaSymbol::get_liveRangeStartAddressSection);
+}
+
+uint32_t DIARawSymbol::getLiveRangeStartRelativeVirtualAddress() const {
+ return PrivateGetDIAValue(
+ Symbol, &IDiaSymbol::get_liveRangeStartRelativeVirtualAddress);
+}
+
+PDB_RegisterId DIARawSymbol::getLocalBasePointerRegisterId() const {
+ return PrivateGetDIAValue<DWORD, PDB_RegisterId>(
+ Symbol, &IDiaSymbol::get_localBasePointerRegisterId);
+}
+
+uint32_t DIARawSymbol::getLowerBoundId() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_lowerBoundId);
+}
+
+uint32_t DIARawSymbol::getMemorySpaceKind() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_memorySpaceKind);
+}
+
+std::string DIARawSymbol::getName() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_name);
+}
+
+uint32_t DIARawSymbol::getNumberOfAcceleratorPointerTags() const {
+ return PrivateGetDIAValue(Symbol,
+ &IDiaSymbol::get_numberOfAcceleratorPointerTags);
+}
+
+uint32_t DIARawSymbol::getNumberOfColumns() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_numberOfColumns);
+}
+
+uint32_t DIARawSymbol::getNumberOfModifiers() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_numberOfModifiers);
+}
+
+uint32_t DIARawSymbol::getNumberOfRegisterIndices() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_numberOfRegisterIndices);
+}
+
+uint32_t DIARawSymbol::getNumberOfRows() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_numberOfRows);
+}
+
+std::string DIARawSymbol::getObjectFileName() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_objectFileName);
+}
+
+uint32_t DIARawSymbol::getOemId() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_oemId);
+}
+
+uint32_t DIARawSymbol::getOemSymbolId() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_oemSymbolId);
+}
+
+uint32_t DIARawSymbol::getOffsetInUdt() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_offsetInUdt);
+}
+
+PDB_Cpu DIARawSymbol::getPlatform() const {
+ return PrivateGetDIAValue<DWORD, PDB_Cpu>(Symbol, &IDiaSymbol::get_platform);
+}
+
+uint32_t DIARawSymbol::getRank() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_rank);
+}
+
+PDB_RegisterId DIARawSymbol::getRegisterId() const {
+ return PrivateGetDIAValue<DWORD, PDB_RegisterId>(Symbol,
+ &IDiaSymbol::get_registerId);
+}
+
+uint32_t DIARawSymbol::getRegisterType() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_registerType);
+}
+
+uint32_t DIARawSymbol::getRelativeVirtualAddress() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_relativeVirtualAddress);
+}
+
+uint32_t DIARawSymbol::getSamplerSlot() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_samplerSlot);
+}
+
+uint32_t DIARawSymbol::getSignature() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_signature);
+}
+
+uint32_t DIARawSymbol::getSizeInUdt() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_sizeInUdt);
+}
+
+uint32_t DIARawSymbol::getSlot() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_slot);
+}
+
+std::string DIARawSymbol::getSourceFileName() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_sourceFileName);
+}
+
+uint32_t DIARawSymbol::getStride() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_stride);
+}
+
+uint32_t DIARawSymbol::getSubTypeId() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_subTypeId);
+}
+
+std::string DIARawSymbol::getSymbolsFileName() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_symbolsFileName);
+}
+
+uint32_t DIARawSymbol::getSymIndexId() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_symIndexId);
+}
+
+uint32_t DIARawSymbol::getTargetOffset() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_targetOffset);
+}
+
+uint32_t DIARawSymbol::getTargetRelativeVirtualAddress() const {
+ return PrivateGetDIAValue(Symbol,
+ &IDiaSymbol::get_targetRelativeVirtualAddress);
+}
+
+uint64_t DIARawSymbol::getTargetVirtualAddress() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_targetVirtualAddress);
+}
+
+uint32_t DIARawSymbol::getTargetSection() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_targetSection);
+}
+
+uint32_t DIARawSymbol::getTextureSlot() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_textureSlot);
+}
+
+uint32_t DIARawSymbol::getTimeStamp() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_timeStamp);
+}
+
+uint32_t DIARawSymbol::getToken() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_token);
+}
+
+uint32_t DIARawSymbol::getTypeId() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_typeId);
+}
+
+uint32_t DIARawSymbol::getUavSlot() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_uavSlot);
+}
+
+std::string DIARawSymbol::getUndecoratedName() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_undecoratedName);
+}
+
+uint32_t DIARawSymbol::getUnmodifiedTypeId() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_unmodifiedTypeId);
+}
+
+uint32_t DIARawSymbol::getUpperBoundId() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_upperBoundId);
+}
+
+Variant DIARawSymbol::getValue() const {
+ VARIANT Value;
+ Value.vt = VT_EMPTY;
+ if (S_OK != Symbol->get_value(&Value))
+ return Variant();
+
+ return VariantFromVARIANT(Value);
+}
+
+uint32_t DIARawSymbol::getVirtualBaseDispIndex() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_virtualBaseDispIndex);
+}
+
+uint32_t DIARawSymbol::getVirtualBaseOffset() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_virtualBaseOffset);
+}
+
+uint32_t DIARawSymbol::getVirtualTableShapeId() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_virtualTableShapeId);
+}
+
+PDB_DataKind DIARawSymbol::getDataKind() const {
+ return PrivateGetDIAValue<DWORD, PDB_DataKind>(Symbol,
+ &IDiaSymbol::get_dataKind);
+}
+
+PDB_SymType DIARawSymbol::getSymTag() const {
+ return PrivateGetDIAValue<DWORD, PDB_SymType>(Symbol,
+ &IDiaSymbol::get_symTag);
+}
+
+PDB_UniqueId DIARawSymbol::getGuid() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_guid);
+}
+
+int32_t DIARawSymbol::getOffset() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_offset);
+}
+
+int32_t DIARawSymbol::getThisAdjust() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_thisAdjust);
+}
+
+int32_t DIARawSymbol::getVirtualBasePointerOffset() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_virtualBasePointerOffset);
+}
+
+PDB_LocType DIARawSymbol::getLocationType() const {
+ return PrivateGetDIAValue<DWORD, PDB_LocType>(Symbol,
+ &IDiaSymbol::get_locationType);
+}
+
+PDB_Machine DIARawSymbol::getMachineType() const {
+ return PrivateGetDIAValue<DWORD, PDB_Machine>(Symbol,
+ &IDiaSymbol::get_machineType);
+}
+
+PDB_ThunkOrdinal DIARawSymbol::getThunkOrdinal() const {
+ return PrivateGetDIAValue<DWORD, PDB_ThunkOrdinal>(
+ Symbol, &IDiaSymbol::get_thunkOrdinal);
+}
+
+uint64_t DIARawSymbol::getLength() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_length);
+}
+
+uint64_t DIARawSymbol::getLiveRangeLength() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_liveRangeLength);
+}
+
+uint64_t DIARawSymbol::getVirtualAddress() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_virtualAddress);
+}
+
+PDB_UdtType DIARawSymbol::getUdtKind() const {
+ return PrivateGetDIAValue<DWORD, PDB_UdtType>(Symbol,
+ &IDiaSymbol::get_udtKind);
+}
+
+bool DIARawSymbol::hasConstructor() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_constructor);
+}
+
+bool DIARawSymbol::hasCustomCallingConvention() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_customCallingConvention);
+}
+
+bool DIARawSymbol::hasFarReturn() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_farReturn);
+}
+
+bool DIARawSymbol::isCode() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_code);
+}
+
+bool DIARawSymbol::isCompilerGenerated() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_compilerGenerated);
+}
+
+bool DIARawSymbol::isConstType() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_constType);
+}
+
+bool DIARawSymbol::isEditAndContinueEnabled() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_editAndContinueEnabled);
+}
+
+bool DIARawSymbol::isFunction() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_function);
+}
+
+bool DIARawSymbol::getAddressTaken() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_addressTaken);
+}
+
+bool DIARawSymbol::getNoStackOrdering() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_noStackOrdering);
+}
+
+bool DIARawSymbol::hasAlloca() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_hasAlloca);
+}
+
+bool DIARawSymbol::hasAssignmentOperator() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_hasAssignmentOperator);
+}
+
+bool DIARawSymbol::hasCTypes() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_isCTypes);
+}
+
+bool DIARawSymbol::hasCastOperator() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_hasCastOperator);
+}
+
+bool DIARawSymbol::hasDebugInfo() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_hasDebugInfo);
+}
+
+bool DIARawSymbol::hasEH() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_hasEH);
+}
+
+bool DIARawSymbol::hasEHa() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_hasEHa);
+}
+
+bool DIARawSymbol::hasInlAsm() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_hasInlAsm);
+}
+
+bool DIARawSymbol::hasInlineAttribute() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_inlSpec);
+}
+
+bool DIARawSymbol::hasInterruptReturn() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_interruptReturn);
+}
+
+bool DIARawSymbol::hasFramePointer() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_framePointerPresent);
+}
+
+bool DIARawSymbol::hasLongJump() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_hasLongJump);
+}
+
+bool DIARawSymbol::hasManagedCode() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_hasManagedCode);
+}
+
+bool DIARawSymbol::hasNestedTypes() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_hasNestedTypes);
+}
+
+bool DIARawSymbol::hasNoInlineAttribute() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_noInline);
+}
+
+bool DIARawSymbol::hasNoReturnAttribute() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_noReturn);
+}
+
+bool DIARawSymbol::hasOptimizedCodeDebugInfo() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_optimizedCodeDebugInfo);
+}
+
+bool DIARawSymbol::hasOverloadedOperator() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_overloadedOperator);
+}
+
+bool DIARawSymbol::hasSEH() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_hasSEH);
+}
+
+bool DIARawSymbol::hasSecurityChecks() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_hasSecurityChecks);
+}
+
+bool DIARawSymbol::hasSetJump() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_hasSetJump);
+}
+
+bool DIARawSymbol::hasStrictGSCheck() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_strictGSCheck);
+}
+
+bool DIARawSymbol::isAcceleratorGroupSharedLocal() const {
+ return PrivateGetDIAValue(Symbol,
+ &IDiaSymbol::get_isAcceleratorGroupSharedLocal);
+}
+
+bool DIARawSymbol::isAcceleratorPointerTagLiveRange() const {
+ return PrivateGetDIAValue(Symbol,
+ &IDiaSymbol::get_isAcceleratorPointerTagLiveRange);
+}
+
+bool DIARawSymbol::isAcceleratorStubFunction() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_isAcceleratorStubFunction);
+}
+
+bool DIARawSymbol::isAggregated() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_isAggregated);
+}
+
+bool DIARawSymbol::isIntroVirtualFunction() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_intro);
+}
+
+bool DIARawSymbol::isCVTCIL() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_isCVTCIL);
+}
+
+bool DIARawSymbol::isConstructorVirtualBase() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_isConstructorVirtualBase);
+}
+
+bool DIARawSymbol::isCxxReturnUdt() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_isCxxReturnUdt);
+}
+
+bool DIARawSymbol::isDataAligned() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_isDataAligned);
+}
+
+bool DIARawSymbol::isHLSLData() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_isHLSLData);
+}
+
+bool DIARawSymbol::isHotpatchable() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_isHotpatchable);
+}
+
+bool DIARawSymbol::isIndirectVirtualBaseClass() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_indirectVirtualBaseClass);
+}
+
+bool DIARawSymbol::isInterfaceUdt() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_isInterfaceUdt);
+}
+
+bool DIARawSymbol::isIntrinsic() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_intrinsic);
+}
+
+bool DIARawSymbol::isLTCG() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_isLTCG);
+}
+
+bool DIARawSymbol::isLocationControlFlowDependent() const {
+ return PrivateGetDIAValue(Symbol,
+ &IDiaSymbol::get_isLocationControlFlowDependent);
+}
+
+bool DIARawSymbol::isMSILNetmodule() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_isMSILNetmodule);
+}
+
+bool DIARawSymbol::isMatrixRowMajor() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_isMatrixRowMajor);
+}
+
+bool DIARawSymbol::isManagedCode() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_managed);
+}
+
+bool DIARawSymbol::isMSILCode() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_msil);
+}
+
+bool DIARawSymbol::isMultipleInheritance() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_isMultipleInheritance);
+}
+
+bool DIARawSymbol::isNaked() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_isNaked);
+}
+
+bool DIARawSymbol::isNested() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_nested);
+}
+
+bool DIARawSymbol::isOptimizedAway() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_isOptimizedAway);
+}
+
+bool DIARawSymbol::isPacked() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_packed);
+}
+
+bool DIARawSymbol::isPointerBasedOnSymbolValue() const {
+ return PrivateGetDIAValue(Symbol,
+ &IDiaSymbol::get_isPointerBasedOnSymbolValue);
+}
+
+bool DIARawSymbol::isPointerToDataMember() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_isPointerToDataMember);
+}
+
+bool DIARawSymbol::isPointerToMemberFunction() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_isPointerToMemberFunction);
+}
+
+bool DIARawSymbol::isPureVirtual() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_pure);
+}
+
+bool DIARawSymbol::isRValueReference() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_RValueReference);
+}
+
+bool DIARawSymbol::isRefUdt() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_isRefUdt);
+}
+
+bool DIARawSymbol::isReference() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_reference);
+}
+
+bool DIARawSymbol::isRestrictedType() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_restrictedType);
+}
+
+bool DIARawSymbol::isReturnValue() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_isReturnValue);
+}
+
+bool DIARawSymbol::isSafeBuffers() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_isSafeBuffers);
+}
+
+bool DIARawSymbol::isScoped() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_scoped);
+}
+
+bool DIARawSymbol::isSdl() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_isSdl);
+}
+
+bool DIARawSymbol::isSingleInheritance() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_isSingleInheritance);
+}
+
+bool DIARawSymbol::isSplitted() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_isSplitted);
+}
+
+bool DIARawSymbol::isStatic() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_isStatic);
+}
+
+bool DIARawSymbol::hasPrivateSymbols() const {
+ // hasPrivateSymbols is the opposite of isStripped, but we expose
+ // hasPrivateSymbols as a more intuitive interface.
+ return !PrivateGetDIAValue(Symbol, &IDiaSymbol::get_isStripped);
+}
+
+bool DIARawSymbol::isUnalignedType() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_unalignedType);
+}
+
+bool DIARawSymbol::isUnreached() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_notReached);
+}
+
+bool DIARawSymbol::isValueUdt() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_isValueUdt);
+}
+
+bool DIARawSymbol::isVirtual() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_virtual);
+}
+
+bool DIARawSymbol::isVirtualBaseClass() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_virtualBaseClass);
+}
+
+bool DIARawSymbol::isVirtualInheritance() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_isVirtualInheritance);
+}
+
+bool DIARawSymbol::isVolatileType() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_volatileType);
+}
+
+bool DIARawSymbol::wasInlined() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_wasInlined);
+}
+
+std::string DIARawSymbol::getUnused() const {
+ return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_unused);
+}
diff --git a/lib/DebugInfo/PDB/DIA/DIASession.cpp b/lib/DebugInfo/PDB/DIA/DIASession.cpp
new file mode 100644
index 0000000..24791f2
--- /dev/null
+++ b/lib/DebugInfo/PDB/DIA/DIASession.cpp
@@ -0,0 +1,117 @@
+//===- DIASession.cpp - DIA implementation of IPDBSession -------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/ADT/STLExtras.h"
+#include "llvm/DebugInfo/PDB/DIA/DIAEnumDebugStreams.h"
+#include "llvm/DebugInfo/PDB/DIA/DIAEnumSourceFiles.h"
+#include "llvm/DebugInfo/PDB/DIA/DIARawSymbol.h"
+#include "llvm/DebugInfo/PDB/DIA/DIASession.h"
+#include "llvm/DebugInfo/PDB/DIA/DIASourceFile.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolCompiland.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolExe.h"
+#include "llvm/Support/ConvertUTF.h"
+
+using namespace llvm;
+
+namespace {}
+
+DIASession::DIASession(CComPtr<IDiaSession> DiaSession) : Session(DiaSession) {}
+
+DIASession *DIASession::createFromPdb(StringRef Path) {
+ CComPtr<IDiaDataSource> DataSource;
+ CComPtr<IDiaSession> Session;
+
+ // We assume that CoInitializeEx has already been called by the executable.
+ HRESULT Result = ::CoCreateInstance(CLSID_DiaSource, nullptr,
+ CLSCTX_INPROC_SERVER, IID_IDiaDataSource,
+ reinterpret_cast<LPVOID *>(&DataSource));
+ if (FAILED(Result))
+ return nullptr;
+
+ llvm::SmallVector<UTF16, 128> Path16;
+ if (!llvm::convertUTF8ToUTF16String(Path, Path16))
+ return nullptr;
+
+ const wchar_t *Path16Str = reinterpret_cast<const wchar_t*>(Path16.data());
+ if (FAILED(DataSource->loadDataFromPdb(Path16Str)))
+ return nullptr;
+
+ if (FAILED(DataSource->openSession(&Session)))
+ return nullptr;
+ return new DIASession(Session);
+}
+
+uint64_t DIASession::getLoadAddress() const {
+ uint64_t LoadAddress;
+ bool success = (S_OK == Session->get_loadAddress(&LoadAddress));
+ return (success) ? LoadAddress : 0;
+}
+
+void DIASession::setLoadAddress(uint64_t Address) {
+ Session->put_loadAddress(Address);
+}
+
+std::unique_ptr<PDBSymbolExe> DIASession::getGlobalScope() const {
+ CComPtr<IDiaSymbol> GlobalScope;
+ if (S_OK != Session->get_globalScope(&GlobalScope))
+ return nullptr;
+
+ auto RawSymbol = llvm::make_unique<DIARawSymbol>(*this, GlobalScope);
+ auto PdbSymbol(PDBSymbol::create(*this, std::move(RawSymbol)));
+ std::unique_ptr<PDBSymbolExe> ExeSymbol(
+ static_cast<PDBSymbolExe *>(PdbSymbol.release()));
+ return ExeSymbol;
+}
+
+std::unique_ptr<PDBSymbol> DIASession::getSymbolById(uint32_t SymbolId) const {
+ CComPtr<IDiaSymbol> LocatedSymbol;
+ if (S_OK != Session->symbolById(SymbolId, &LocatedSymbol))
+ return nullptr;
+
+ auto RawSymbol = llvm::make_unique<DIARawSymbol>(*this, LocatedSymbol);
+ return PDBSymbol::create(*this, std::move(RawSymbol));
+}
+
+std::unique_ptr<IPDBEnumSourceFiles> DIASession::getAllSourceFiles() const {
+ CComPtr<IDiaEnumSourceFiles> Files;
+ if (S_OK != Session->findFile(nullptr, nullptr, nsNone, &Files))
+ return nullptr;
+
+ return llvm::make_unique<DIAEnumSourceFiles>(*this, Files);
+}
+
+std::unique_ptr<IPDBEnumSourceFiles> DIASession::getSourceFilesForCompiland(
+ const PDBSymbolCompiland &Compiland) const {
+ CComPtr<IDiaEnumSourceFiles> Files;
+
+ const DIARawSymbol &RawSymbol =
+ static_cast<const DIARawSymbol &>(Compiland.getRawSymbol());
+ if (S_OK !=
+ Session->findFile(RawSymbol.getDiaSymbol(), nullptr, nsNone, &Files))
+ return nullptr;
+
+ return llvm::make_unique<DIAEnumSourceFiles>(*this, Files);
+}
+
+std::unique_ptr<IPDBSourceFile>
+DIASession::getSourceFileById(uint32_t FileId) const {
+ CComPtr<IDiaSourceFile> LocatedFile;
+ if (S_OK != Session->findFileById(FileId, &LocatedFile))
+ return nullptr;
+
+ return llvm::make_unique<DIASourceFile>(*this, LocatedFile);
+}
+
+std::unique_ptr<IPDBEnumDataStreams> DIASession::getDebugStreams() const {
+ CComPtr<IDiaEnumDebugStreams> DiaEnumerator;
+ if (S_OK != Session->getEnumDebugStreams(&DiaEnumerator))
+ return nullptr;
+
+ return llvm::make_unique<DIAEnumDebugStreams>(DiaEnumerator);
+}
diff --git a/lib/DebugInfo/PDB/DIA/DIASourceFile.cpp b/lib/DebugInfo/PDB/DIA/DIASourceFile.cpp
new file mode 100644
index 0000000..0a9c444
--- /dev/null
+++ b/lib/DebugInfo/PDB/DIA/DIASourceFile.cpp
@@ -0,0 +1,67 @@
+//===- DIASourceFile.cpp - DIA implementation of IPDBSourceFile -*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/DebugInfo/PDB/DIA/DIAEnumSymbols.h"
+#include "llvm/DebugInfo/PDB/DIA/DIASession.h"
+#include "llvm/DebugInfo/PDB/DIA/DIASourceFile.h"
+#include "llvm/Support/ConvertUTF.h"
+
+using namespace llvm;
+
+DIASourceFile::DIASourceFile(const DIASession &PDBSession,
+ CComPtr<IDiaSourceFile> DiaSourceFile)
+ : Session(PDBSession), SourceFile(DiaSourceFile) {}
+
+std::string DIASourceFile::getFileName() const {
+ CComBSTR FileName16;
+ HRESULT Result = SourceFile->get_fileName(&FileName16);
+ if (S_OK != Result)
+ return std::string();
+
+ std::string FileName8;
+ llvm::ArrayRef<char> FileNameBytes(reinterpret_cast<char *>(FileName16.m_str),
+ FileName16.ByteLength());
+ llvm::convertUTF16ToUTF8String(FileNameBytes, FileName8);
+ return FileName8;
+}
+
+uint32_t DIASourceFile::getUniqueId() const {
+ DWORD Id;
+ return (S_OK == SourceFile->get_uniqueId(&Id)) ? Id : 0;
+}
+
+std::string DIASourceFile::getChecksum() const {
+ DWORD ByteSize = 0;
+ HRESULT Result = SourceFile->get_checksum(0, &ByteSize, nullptr);
+ if (ByteSize == 0)
+ return std::string();
+ std::vector<BYTE> ChecksumBytes(ByteSize);
+ Result = SourceFile->get_checksum(ByteSize, &ByteSize, &ChecksumBytes[0]);
+ if (S_OK != Result)
+ return std::string();
+ return std::string(ChecksumBytes.begin(), ChecksumBytes.end());
+}
+
+PDB_Checksum DIASourceFile::getChecksumType() const {
+ DWORD Type;
+ HRESULT Result = SourceFile->get_checksumType(&Type);
+ if (S_OK != Result)
+ return PDB_Checksum::None;
+ return static_cast<PDB_Checksum>(Type);
+}
+
+std::unique_ptr<IPDBEnumSymbols> DIASourceFile::getCompilands() const {
+ CComPtr<IDiaEnumSymbols> DiaEnumerator;
+ HRESULT Result = SourceFile->get_compilands(&DiaEnumerator);
+ if (S_OK != Result)
+ return nullptr;
+
+ return std::unique_ptr<IPDBEnumSymbols>(
+ new DIAEnumSymbols(Session, DiaEnumerator));
+}
diff --git a/lib/DebugInfo/PDB/IPDBSourceFile.cpp b/lib/DebugInfo/PDB/IPDBSourceFile.cpp
new file mode 100644
index 0000000..3abe59d
--- /dev/null
+++ b/lib/DebugInfo/PDB/IPDBSourceFile.cpp
@@ -0,0 +1,32 @@
+//===- IPDBSourceFile.cpp - base interface for a PDB source file *- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/DebugInfo/PDB/IPDBSourceFile.h"
+
+#include "llvm/DebugInfo/PDB/PDBExtras.h"
+#include "llvm/Support/Format.h"
+#include "llvm/Support/raw_ostream.h"
+
+using namespace llvm;
+
+IPDBSourceFile::~IPDBSourceFile() {}
+
+void IPDBSourceFile::dump(raw_ostream &OS, int Indent) const {
+ OS.indent(Indent);
+ PDB_Checksum ChecksumType = getChecksumType();
+ OS << "[";
+ if (ChecksumType != PDB_Checksum::None) {
+ OS << ChecksumType << ": ";
+ std::string Checksum = getChecksum();
+ for (uint8_t c : Checksum)
+ OS << format_hex_no_prefix(c, 2, true);
+ } else
+ OS << "No checksum";
+ OS << "] " << getFileName() << "\n";
+}
diff --git a/lib/DebugInfo/PDB/LLVMBuild.txt b/lib/DebugInfo/PDB/LLVMBuild.txt
new file mode 100644
index 0000000..690598a
--- /dev/null
+++ b/lib/DebugInfo/PDB/LLVMBuild.txt
@@ -0,0 +1,23 @@
+;===- ./lib/DebugInfo/PDB/LLVMBuild.txt ------------------------*- Conf -*--===;
+;
+; The LLVM Compiler Infrastructure
+;
+; This file is distributed under the University of Illinois Open Source
+; License. See LICENSE.TXT for details.
+;
+;===------------------------------------------------------------------------===;
+;
+; This is an LLVMBuild description file for the components in this subdirectory.
+;
+; For more information on the LLVMBuild system, please see:
+;
+; http://llvm.org/docs/LLVMBuild.html
+;
+;===------------------------------------------------------------------------===;
+
+[component_0]
+type = Library
+name = DebugInfoPDB
+parent = DebugInfo
+required_libraries = Support
+
diff --git a/lib/DebugInfo/PDB/Makefile b/lib/DebugInfo/PDB/Makefile
new file mode 100644
index 0000000..444019e
--- /dev/null
+++ b/lib/DebugInfo/PDB/Makefile
@@ -0,0 +1,14 @@
+##===- lib/DebugInfo/PDB/Makefile --------------------------*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+LEVEL = ../../..
+LIBRARYNAME = LLVMDebugInfoPDB
+BUILD_ARCHIVE := 1
+
+include $(LEVEL)/Makefile.common
diff --git a/lib/DebugInfo/PDB/PDB.cpp b/lib/DebugInfo/PDB/PDB.cpp
new file mode 100644
index 0000000..aa84c28
--- /dev/null
+++ b/lib/DebugInfo/PDB/PDB.cpp
@@ -0,0 +1,30 @@
+//===- PDB.cpp - base header file for creating a PDB reader -----*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/DebugInfo/PDB/PDB.h"
+
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Config/config.h"
+#include "llvm/DebugInfo/PDB/IPDBSession.h"
+#include "llvm/DebugInfo/PDB/PDB.h"
+
+#if HAVE_DIA_SDK
+#include "llvm/DebugInfo/PDB/DIA/DIASession.h"
+#endif
+
+using namespace llvm;
+
+std::unique_ptr<IPDBSession> llvm::createPDBReader(PDB_ReaderType Type,
+ StringRef Path) {
+ // Create the correct concrete instance type based on the value of Type.
+#if HAVE_DIA_SDK
+ return std::unique_ptr<DIASession>(DIASession::createFromPdb(Path));
+#endif
+ return nullptr;
+}
diff --git a/lib/DebugInfo/PDB/PDBExtras.cpp b/lib/DebugInfo/PDB/PDBExtras.cpp
new file mode 100644
index 0000000..1002b2e
--- /dev/null
+++ b/lib/DebugInfo/PDB/PDBExtras.cpp
@@ -0,0 +1,346 @@
+//===- PDBExtras.cpp - helper functions and classes for PDBs -----*- C++-*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/DebugInfo/PDB/PDBExtras.h"
+
+#include "llvm/ADT/ArrayRef.h"
+
+using namespace llvm;
+
+#define CASE_OUTPUT_ENUM_CLASS_STR(Class, Value, Str, Stream) \
+ case Class::Value: \
+ Stream << Str; \
+ break;
+
+#define CASE_OUTPUT_ENUM_CLASS_NAME(Class, Value, Stream) \
+ CASE_OUTPUT_ENUM_CLASS_STR(Class, Value, #Value, Stream)
+
+raw_ostream &llvm::operator<<(raw_ostream &OS, const PDB_VariantType &Type) {
+ switch (Type) {
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_VariantType, Bool, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_VariantType, Single, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_VariantType, Double, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_VariantType, Int8, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_VariantType, Int16, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_VariantType, Int32, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_VariantType, Int64, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_VariantType, UInt8, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_VariantType, UInt16, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_VariantType, UInt32, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_VariantType, UInt64, OS)
+ default:
+ OS << "Unknown";
+ }
+ return OS;
+}
+
+raw_ostream &llvm::operator<<(raw_ostream &OS, const PDB_CallingConv &Conv) {
+ OS << "__";
+ switch (Conv) {
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, NearCdecl, "cdecl", OS)
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, FarCdecl, "cdecl", OS)
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, NearPascal, "pascal", OS)
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, FarPascal, "pascal", OS)
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, NearFastcall, "fastcall", OS)
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, FarFastcall, "fastcall", OS)
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, Skipped, "skippedcall", OS)
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, NearStdcall, "stdcall", OS)
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, FarStdcall, "stdcall", OS)
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, NearSyscall, "syscall", OS)
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, FarSyscall, "syscall", OS)
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, Thiscall, "thiscall", OS)
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, MipsCall, "mipscall", OS)
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, Generic, "genericcall", OS)
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, Alphacall, "alphacall", OS)
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, Ppccall, "ppccall", OS)
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, SuperHCall, "superhcall", OS)
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, Armcall, "armcall", OS)
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, AM33call, "am33call", OS)
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, Tricall, "tricall", OS)
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, Sh5call, "sh5call", OS)
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, M32R, "m32rcall", OS)
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, Clrcall, "clrcall", OS)
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, Inline, "inlinecall", OS)
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, NearVectorcall, "vectorcall",
+ OS)
+ default:
+ OS << "unknowncall";
+ }
+ return OS;
+}
+
+raw_ostream &llvm::operator<<(raw_ostream &OS, const PDB_DataKind &Data) {
+ switch (Data) {
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_DataKind, Unknown, "unknown", OS)
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_DataKind, Local, "local", OS)
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_DataKind, StaticLocal, "static local", OS)
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_DataKind, Param, "param", OS)
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_DataKind, ObjectPtr, "this ptr", OS)
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_DataKind, FileStatic, "static global", OS)
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_DataKind, Global, "global", OS)
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_DataKind, Member, "member", OS)
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_DataKind, StaticMember, "static member", OS)
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_DataKind, Constant, "const", OS)
+ }
+ return OS;
+}
+
+raw_ostream &llvm::operator<<(raw_ostream &OS, const PDB_RegisterId &Reg) {
+ switch (Reg) {
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, AL, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, CL, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, DL, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, BL, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, AH, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, CH, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, DH, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, BH, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, AX, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, CX, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, DX, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, BX, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, SP, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, BP, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, SI, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, DI, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, EAX, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, ECX, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, EDX, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, EBX, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, ESP, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, EBP, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, ESI, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, EDI, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, ES, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, CS, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, SS, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, DS, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, FS, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, GS, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, IP, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, RAX, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, RBX, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, RCX, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, RDX, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, RSI, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, RDI, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, RBP, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, RSP, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, R8, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, R9, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, R10, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, R11, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, R12, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, R13, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, R14, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, R15, OS)
+ default:
+ OS << static_cast<int>(Reg);
+ }
+ return OS;
+}
+
+raw_ostream &llvm::operator<<(raw_ostream &OS, const PDB_LocType &Loc) {
+ switch (Loc) {
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_LocType, Static, "static", OS)
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_LocType, TLS, "tls", OS)
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_LocType, RegRel, "regrel", OS)
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_LocType, ThisRel, "thisrel", OS)
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_LocType, Enregistered, "register", OS)
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_LocType, BitField, "bitfield", OS)
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_LocType, Slot, "slot", OS)
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_LocType, IlRel, "IL rel", OS)
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_LocType, MetaData, "metadata", OS)
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_LocType, Constant, "constant", OS)
+ default:
+ OS << "Unknown";
+ }
+ return OS;
+}
+
+raw_ostream &llvm::operator<<(raw_ostream &OS, const PDB_ThunkOrdinal &Thunk) {
+ switch (Thunk) {
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_ThunkOrdinal, BranchIsland, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_ThunkOrdinal, Pcode, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_ThunkOrdinal, Standard, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_ThunkOrdinal, ThisAdjustor, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_ThunkOrdinal, TrampIncremental, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_ThunkOrdinal, UnknownLoad, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_ThunkOrdinal, Vcall, OS)
+ }
+ return OS;
+}
+
+raw_ostream &llvm::operator<<(raw_ostream &OS, const PDB_Checksum &Checksum) {
+ switch (Checksum) {
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Checksum, None, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Checksum, MD5, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Checksum, SHA1, OS)
+ }
+ return OS;
+}
+
+raw_ostream &llvm::operator<<(raw_ostream &OS, const PDB_Lang &Lang) {
+ switch (Lang) {
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, C, OS)
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_Lang, Cpp, "C++", OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, Fortran, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, Masm, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, Pascal, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, Basic, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, Cobol, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, Link, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, Cvtres, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, Cvtpgd, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, CSharp, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, VB, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, ILAsm, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, Java, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, JScript, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, MSIL, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, HLSL, OS)
+ }
+ return OS;
+}
+
+raw_ostream &llvm::operator<<(raw_ostream &OS, const PDB_SymType &Tag) {
+ switch (Tag) {
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, Exe, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, Compiland, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, CompilandDetails, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, CompilandEnv, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, Function, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, Block, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, Data, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, Annotation, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, Label, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, PublicSymbol, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, UDT, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, Enum, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, FunctionSig, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, PointerType, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, ArrayType, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, BuiltinType, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, Typedef, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, BaseClass, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, Friend, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, FunctionArg, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, FuncDebugStart, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, FuncDebugEnd, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, UsingNamespace, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, VTableShape, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, VTable, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, Custom, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, Thunk, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, CustomType, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, ManagedType, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, Dimension, OS)
+ default:
+ OS << "Unknown";
+ }
+ return OS;
+}
+
+raw_ostream &llvm::operator<<(raw_ostream &OS, const PDB_BuiltinType &Type) {
+ switch (Type) {
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_BuiltinType, Void, "void", OS)
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_BuiltinType, Char, "char", OS)
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_BuiltinType, WCharT, "wchar_t", OS)
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_BuiltinType, Int, "int", OS)
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_BuiltinType, UInt, "uint", OS)
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_BuiltinType, Float, "float", OS)
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_BuiltinType, BCD, "BCD", OS)
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_BuiltinType, Bool, "bool", OS)
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_BuiltinType, Long, "long", OS)
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_BuiltinType, ULong, "ulong", OS)
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_BuiltinType, Currency, "CURRENCY", OS)
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_BuiltinType, Date, "DATE", OS)
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_BuiltinType, Variant, "VARIANT", OS)
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_BuiltinType, Complex, "complex", OS)
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_BuiltinType, Bitfield, "bitfield", OS)
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_BuiltinType, BSTR, "BSTR", OS)
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_BuiltinType, HResult, "HRESULT", OS)
+ default:
+ break;
+ }
+ return OS;
+}
+
+raw_ostream &llvm::operator<<(raw_ostream &OS, const PDB_UniqueId &Id) {
+ static const char *Lookup = "0123456789ABCDEF";
+
+ static_assert(sizeof(PDB_UniqueId) == 16, "Expected 16-byte GUID");
+ ArrayRef<uint8_t> GuidBytes(reinterpret_cast<const uint8_t*>(&Id), 16);
+ OS << "{";
+ for (int i=0; i < 16;) {
+ uint8_t Byte = GuidBytes[i];
+ uint8_t HighNibble = (Byte >> 4) & 0xF;
+ uint8_t LowNibble = Byte & 0xF;
+ OS << Lookup[HighNibble] << Lookup[LowNibble];
+ ++i;
+ if (i>=4 && i<=10 && i%2==0)
+ OS << "-";
+ }
+ OS << "}";
+ return OS;
+}
+
+raw_ostream &llvm::operator<<(raw_ostream &OS, const Variant &Value) {
+ switch (Value.Type) {
+ case PDB_VariantType::Bool:
+ OS << (Value.Bool ? "true" : "false");
+ break;
+ case PDB_VariantType::Double:
+ OS << Value.Double;
+ break;
+ case PDB_VariantType::Int16:
+ OS << Value.Int16;
+ break;
+ case PDB_VariantType::Int32:
+ OS << Value.Int32;
+ break;
+ case PDB_VariantType::Int64:
+ OS << Value.Int64;
+ break;
+ case PDB_VariantType::Int8:
+ OS << Value.Int8;
+ break;
+ case PDB_VariantType::Single:
+ OS << Value.Single;
+ break;
+ case PDB_VariantType::UInt16:
+ OS << Value.Double;
+ break;
+ case PDB_VariantType::UInt32:
+ OS << Value.UInt32;
+ break;
+ case PDB_VariantType::UInt64:
+ OS << Value.UInt64;
+ break;
+ case PDB_VariantType::UInt8:
+ OS << Value.UInt8;
+ break;
+ default:
+ OS << Value.Type;
+ }
+ OS << " {" << Value.Type << "}";
+ return OS;
+}
+
+raw_ostream &llvm::operator<<(raw_ostream &OS, const VersionInfo &Version) {
+ OS << Version.Major << "." << Version.Minor << "." << Version.Build;
+ return OS;
+}
+
+raw_ostream &llvm::operator<<(raw_ostream &OS, const TagStats &Stats) {
+ for (auto Tag : Stats) {
+ OS << Tag.first << ":" << Tag.second << " ";
+ }
+ return OS;
+}
diff --git a/lib/DebugInfo/PDB/PDBInterfaceAnchors.cpp b/lib/DebugInfo/PDB/PDBInterfaceAnchors.cpp
new file mode 100644
index 0000000..7b6268d
--- /dev/null
+++ b/lib/DebugInfo/PDB/PDBInterfaceAnchors.cpp
@@ -0,0 +1,28 @@
+//===- PDBInterfaceAnchors.h - defines class anchor funcions ----*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Class anchors are necessary per the LLVM Coding style guide, to ensure that
+// the vtable is only generated in this object file, and not in every object
+// file that incldues the corresponding header.
+//===----------------------------------------------------------------------===//
+
+#include "llvm/DebugInfo/PDB/IPDBDataStream.h"
+#include "llvm/DebugInfo/PDB/IPDBLineNumber.h"
+#include "llvm/DebugInfo/PDB/IPDBRawSymbol.h"
+#include "llvm/DebugInfo/PDB/IPDBSession.h"
+#include "llvm/DebugInfo/PDB/IPDBRawSymbol.h"
+
+using namespace llvm;
+
+IPDBSession::~IPDBSession() {}
+
+IPDBDataStream::~IPDBDataStream() {}
+
+IPDBRawSymbol::~IPDBRawSymbol() {}
+
+IPDBLineNumber::~IPDBLineNumber() {}
diff --git a/lib/DebugInfo/PDB/PDBSymDumper.cpp b/lib/DebugInfo/PDB/PDBSymDumper.cpp
new file mode 100644
index 0000000..0f29c74
--- /dev/null
+++ b/lib/DebugInfo/PDB/PDBSymDumper.cpp
@@ -0,0 +1,177 @@
+//===- PDBSymDumper.cpp - ---------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
+#include "llvm/Support/ErrorHandling.h"
+
+using namespace llvm;
+
+#define PDB_SYMDUMP_UNREACHABLE(Type) \
+ if (RequireImpl) \
+ llvm_unreachable("Attempt to dump " #Type " with no dump implementation");
+
+PDBSymDumper::PDBSymDumper(bool ShouldRequireImpl)
+ : RequireImpl(ShouldRequireImpl) {}
+
+PDBSymDumper::~PDBSymDumper() {}
+
+void PDBSymDumper::dump(const PDBSymbolAnnotation &Symbol, raw_ostream &OS,
+ int Indent) {
+ PDB_SYMDUMP_UNREACHABLE(PDBSymbolAnnotation)
+}
+
+void PDBSymDumper::dump(const PDBSymbolBlock &Symbol, raw_ostream &OS,
+ int Indent) {
+ PDB_SYMDUMP_UNREACHABLE(PDBSymbolBlock)
+}
+
+void PDBSymDumper::dump(const PDBSymbolCompiland &Symbol, raw_ostream &OS,
+ int Indent) {
+ PDB_SYMDUMP_UNREACHABLE(PDBSymbolCompiland)
+}
+
+void PDBSymDumper::dump(const PDBSymbolCompilandDetails &Symbol,
+ raw_ostream &OS, int Indent) {
+ PDB_SYMDUMP_UNREACHABLE(PDBSymbolCompilandDetails)
+}
+
+void PDBSymDumper::dump(const PDBSymbolCompilandEnv &Symbol, raw_ostream &OS,
+ int Indent) {
+ PDB_SYMDUMP_UNREACHABLE(PDBSymbolCompilandEnv)
+}
+
+void PDBSymDumper::dump(const PDBSymbolCustom &Symbol, raw_ostream &OS,
+ int Indent) {
+ PDB_SYMDUMP_UNREACHABLE(PDBSymbolCustom)
+}
+
+void PDBSymDumper::dump(const PDBSymbolData &Symbol, raw_ostream &OS,
+ int Indent) {
+ PDB_SYMDUMP_UNREACHABLE(PDBSymbolData)
+}
+
+void PDBSymDumper::dump(const PDBSymbolExe &Symbol, raw_ostream &OS,
+ int Indent) {
+ PDB_SYMDUMP_UNREACHABLE(PDBSymbolExe)
+}
+
+void PDBSymDumper::dump(const PDBSymbolFunc &Symbol, raw_ostream &OS,
+ int Indent) {
+ PDB_SYMDUMP_UNREACHABLE(PDBSymbolFunc)
+}
+
+void PDBSymDumper::dump(const PDBSymbolFuncDebugEnd &Symbol, raw_ostream &OS,
+ int Indent) {
+ PDB_SYMDUMP_UNREACHABLE(PDBSymbolFuncDebugEnd)
+}
+
+void PDBSymDumper::dump(const PDBSymbolFuncDebugStart &Symbol, raw_ostream &OS,
+ int Indent) {
+ PDB_SYMDUMP_UNREACHABLE(PDBSymbolFuncDebugStart)
+}
+
+void PDBSymDumper::dump(const PDBSymbolLabel &Symbol, raw_ostream &OS,
+ int Indent) {
+ PDB_SYMDUMP_UNREACHABLE(PDBSymbolLabel)
+}
+
+void PDBSymDumper::dump(const PDBSymbolPublicSymbol &Symbol, raw_ostream &OS,
+ int Indent) {
+ PDB_SYMDUMP_UNREACHABLE(PDBSymbolPublicSymbol)
+}
+
+void PDBSymDumper::dump(const PDBSymbolThunk &Symbol, raw_ostream &OS,
+ int Indent) {
+ PDB_SYMDUMP_UNREACHABLE(PDBSymbolThunk)
+}
+
+void PDBSymDumper::dump(const PDBSymbolTypeArray &Symbol, raw_ostream &OS,
+ int Indent) {
+ PDB_SYMDUMP_UNREACHABLE(PDBSymbolTypeArray)
+}
+
+void PDBSymDumper::dump(const PDBSymbolTypeBaseClass &Symbol, raw_ostream &OS,
+ int Indent) {
+ PDB_SYMDUMP_UNREACHABLE(PDBSymbolTypeBaseClass)
+}
+
+void PDBSymDumper::dump(const PDBSymbolTypeBuiltin &Symbol, raw_ostream &OS,
+ int Indent) {
+ PDB_SYMDUMP_UNREACHABLE(PDBSymbolTypeBuiltin)
+}
+
+void PDBSymDumper::dump(const PDBSymbolTypeCustom &Symbol, raw_ostream &OS,
+ int Indent) {
+ PDB_SYMDUMP_UNREACHABLE(PDBSymbolTypeCustom)
+}
+
+void PDBSymDumper::dump(const PDBSymbolTypeDimension &Symbol, raw_ostream &OS,
+ int Indent) {
+ PDB_SYMDUMP_UNREACHABLE(PDBSymbolTypeDimension)
+}
+
+void PDBSymDumper::dump(const PDBSymbolTypeEnum &Symbol, raw_ostream &OS,
+ int Indent) {
+ PDB_SYMDUMP_UNREACHABLE(PDBSymbolTypeEnum)
+}
+
+void PDBSymDumper::dump(const PDBSymbolTypeFriend &Symbol, raw_ostream &OS,
+ int Indent) {
+ PDB_SYMDUMP_UNREACHABLE(PDBSymbolTypeFriend)
+}
+
+void PDBSymDumper::dump(const PDBSymbolTypeFunctionArg &Symbol, raw_ostream &OS,
+ int Indent) {
+ PDB_SYMDUMP_UNREACHABLE(PDBSymbolTypeFunctionArg)
+}
+
+void PDBSymDumper::dump(const PDBSymbolTypeFunctionSig &Symbol, raw_ostream &OS,
+ int Indent) {
+ PDB_SYMDUMP_UNREACHABLE(PDBSymbolTypeFunctionSig)
+}
+
+void PDBSymDumper::dump(const PDBSymbolTypeManaged &Symbol, raw_ostream &OS,
+ int Indent) {
+ PDB_SYMDUMP_UNREACHABLE(PDBSymbolTypeManaged)
+}
+
+void PDBSymDumper::dump(const PDBSymbolTypePointer &Symbol, raw_ostream &OS,
+ int Indent) {
+ PDB_SYMDUMP_UNREACHABLE(PDBSymbolTypePointer)
+}
+
+void PDBSymDumper::dump(const PDBSymbolTypeTypedef &Symbol, raw_ostream &OS,
+ int Indent) {
+ PDB_SYMDUMP_UNREACHABLE(PDBSymbolTypeTypedef)
+}
+
+void PDBSymDumper::dump(const PDBSymbolTypeUDT &Symbol, raw_ostream &OS,
+ int Indent) {
+ PDB_SYMDUMP_UNREACHABLE(PDBSymbolTypeUDT)
+}
+
+void PDBSymDumper::dump(const PDBSymbolTypeVTable &Symbol, raw_ostream &OS,
+ int Indent) {
+ PDB_SYMDUMP_UNREACHABLE(PDBSymbolTypeVTable)
+}
+
+void PDBSymDumper::dump(const PDBSymbolTypeVTableShape &Symbol, raw_ostream &OS,
+ int Indent) {
+ PDB_SYMDUMP_UNREACHABLE(PDBSymbolTypeVTableShape)
+}
+
+void PDBSymDumper::dump(const PDBSymbolUnknown &Symbol, raw_ostream &OS,
+ int Indent) {
+ PDB_SYMDUMP_UNREACHABLE(PDBSymbolUnknown)
+}
+
+void PDBSymDumper::dump(const PDBSymbolUsingNamespace &Symbol, raw_ostream &OS,
+ int Indent) {
+ PDB_SYMDUMP_UNREACHABLE(PDBSymbolUsingNamespace)
+}
diff --git a/lib/DebugInfo/PDB/PDBSymbol.cpp b/lib/DebugInfo/PDB/PDBSymbol.cpp
new file mode 100644
index 0000000..f9aaf3a
--- /dev/null
+++ b/lib/DebugInfo/PDB/PDBSymbol.cpp
@@ -0,0 +1,151 @@
+//===- PDBSymbol.cpp - base class for user-facing symbol types --*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/DebugInfo/PDB/PDBSymbol.h"
+
+#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
+#include "llvm/DebugInfo/PDB/IPDBRawSymbol.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolAnnotation.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolBlock.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolCompiland.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolCompilandDetails.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolCompilandEnv.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolCustom.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolData.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolExe.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolFunc.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolFuncDebugEnd.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolFuncDebugStart.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolLabel.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolPublicSymbol.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolThunk.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeArray.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeBaseClass.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeCustom.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeDimension.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeFriend.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeFunctionArg.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeFunctionSig.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeManaged.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypePointer.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeTypedef.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeUDT.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeVTable.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeVTableShape.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolUnknown.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolUsingNamespace.h"
+#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
+#include <memory>
+#include <utility>
+
+#include <memory>
+#include <utility>
+
+using namespace llvm;
+
+PDBSymbol::PDBSymbol(const IPDBSession &PDBSession,
+ std::unique_ptr<IPDBRawSymbol> Symbol)
+ : Session(PDBSession), RawSymbol(std::move(Symbol)) {}
+
+PDBSymbol::~PDBSymbol() {}
+
+#define FACTORY_SYMTAG_CASE(Tag, Type) \
+ case PDB_SymType::Tag: \
+ return std::unique_ptr<PDBSymbol>(new Type(PDBSession, std::move(Symbol)));
+
+std::unique_ptr<PDBSymbol>
+PDBSymbol::create(const IPDBSession &PDBSession,
+ std::unique_ptr<IPDBRawSymbol> Symbol) {
+ switch (Symbol->getSymTag()) {
+ FACTORY_SYMTAG_CASE(Exe, PDBSymbolExe)
+ FACTORY_SYMTAG_CASE(Compiland, PDBSymbolCompiland)
+ FACTORY_SYMTAG_CASE(CompilandDetails, PDBSymbolCompilandDetails)
+ FACTORY_SYMTAG_CASE(CompilandEnv, PDBSymbolCompilandEnv)
+ FACTORY_SYMTAG_CASE(Function, PDBSymbolFunc)
+ FACTORY_SYMTAG_CASE(Block, PDBSymbolBlock)
+ FACTORY_SYMTAG_CASE(Data, PDBSymbolData)
+ FACTORY_SYMTAG_CASE(Annotation, PDBSymbolAnnotation)
+ FACTORY_SYMTAG_CASE(Label, PDBSymbolLabel)
+ FACTORY_SYMTAG_CASE(PublicSymbol, PDBSymbolPublicSymbol)
+ FACTORY_SYMTAG_CASE(UDT, PDBSymbolTypeUDT)
+ FACTORY_SYMTAG_CASE(Enum, PDBSymbolTypeEnum)
+ FACTORY_SYMTAG_CASE(FunctionSig, PDBSymbolTypeFunctionSig)
+ FACTORY_SYMTAG_CASE(PointerType, PDBSymbolTypePointer)
+ FACTORY_SYMTAG_CASE(ArrayType, PDBSymbolTypeArray)
+ FACTORY_SYMTAG_CASE(BuiltinType, PDBSymbolTypeBuiltin)
+ FACTORY_SYMTAG_CASE(Typedef, PDBSymbolTypeTypedef)
+ FACTORY_SYMTAG_CASE(BaseClass, PDBSymbolTypeBaseClass)
+ FACTORY_SYMTAG_CASE(Friend, PDBSymbolTypeFriend)
+ FACTORY_SYMTAG_CASE(FunctionArg, PDBSymbolTypeFunctionArg)
+ FACTORY_SYMTAG_CASE(FuncDebugStart, PDBSymbolFuncDebugStart)
+ FACTORY_SYMTAG_CASE(FuncDebugEnd, PDBSymbolFuncDebugEnd)
+ FACTORY_SYMTAG_CASE(UsingNamespace, PDBSymbolUsingNamespace)
+ FACTORY_SYMTAG_CASE(VTableShape, PDBSymbolTypeVTableShape)
+ FACTORY_SYMTAG_CASE(VTable, PDBSymbolTypeVTable)
+ FACTORY_SYMTAG_CASE(Custom, PDBSymbolCustom)
+ FACTORY_SYMTAG_CASE(Thunk, PDBSymbolThunk)
+ FACTORY_SYMTAG_CASE(CustomType, PDBSymbolTypeCustom)
+ FACTORY_SYMTAG_CASE(ManagedType, PDBSymbolTypeManaged)
+ FACTORY_SYMTAG_CASE(Dimension, PDBSymbolTypeDimension)
+ default:
+ return std::unique_ptr<PDBSymbol>(
+ new PDBSymbolUnknown(PDBSession, std::move(Symbol)));
+ }
+}
+
+#define TRY_DUMP_TYPE(Type) \
+ if (const Type *DerivedThis = dyn_cast<Type>(this)) \
+ Dumper.dump(OS, Indent, *DerivedThis);
+
+#define ELSE_TRY_DUMP_TYPE(Type, Dumper) else TRY_DUMP_TYPE(Type, Dumper)
+
+void PDBSymbol::defaultDump(raw_ostream &OS, int Indent) const {
+ RawSymbol->dump(OS, Indent);
+}
+
+PDB_SymType PDBSymbol::getSymTag() const { return RawSymbol->getSymTag(); }
+
+std::unique_ptr<IPDBEnumSymbols> PDBSymbol::findAllChildren() const {
+ return findAllChildren(PDB_SymType::None);
+}
+
+std::unique_ptr<IPDBEnumSymbols>
+PDBSymbol::findAllChildren(PDB_SymType Type) const {
+ return RawSymbol->findChildren(Type);
+}
+
+std::unique_ptr<IPDBEnumSymbols>
+PDBSymbol::findChildren(PDB_SymType Type, StringRef Name,
+ PDB_NameSearchFlags Flags) const {
+ return RawSymbol->findChildren(Type, Name, Flags);
+}
+
+std::unique_ptr<IPDBEnumSymbols>
+PDBSymbol::findChildrenByRVA(PDB_SymType Type, StringRef Name,
+ PDB_NameSearchFlags Flags, uint32_t RVA) const {
+ return RawSymbol->findChildrenByRVA(Type, Name, Flags, RVA);
+}
+
+std::unique_ptr<IPDBEnumSymbols>
+PDBSymbol::findInlineFramesByRVA(uint32_t RVA) const {
+ return RawSymbol->findInlineFramesByRVA(RVA);
+}
+
+std::unique_ptr<IPDBEnumSymbols>
+PDBSymbol::getChildStats(TagStats &Stats) const {
+ std::unique_ptr<IPDBEnumSymbols> Result(findAllChildren());
+ Stats.clear();
+ while (auto Child = Result->getNext()) {
+ ++Stats[Child->getSymTag()];
+ }
+ Result->reset();
+ return Result;
+}
diff --git a/lib/DebugInfo/PDB/PDBSymbolAnnotation.cpp b/lib/DebugInfo/PDB/PDBSymbolAnnotation.cpp
new file mode 100644
index 0000000..4c76e3b
--- /dev/null
+++ b/lib/DebugInfo/PDB/PDBSymbolAnnotation.cpp
@@ -0,0 +1,25 @@
+//===- PDBSymbolAnnotation.cpp - --------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/DebugInfo/PDB/PDBSymbolAnnotation.h"
+
+#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
+
+#include <utility>
+
+using namespace llvm;
+
+PDBSymbolAnnotation::PDBSymbolAnnotation(const IPDBSession &PDBSession,
+ std::unique_ptr<IPDBRawSymbol> Symbol)
+ : PDBSymbol(PDBSession, std::move(Symbol)) {}
+
+void PDBSymbolAnnotation::dump(raw_ostream &OS, int Indent,
+ PDBSymDumper &Dumper) const {
+ Dumper.dump(*this, OS, Indent);
+}
diff --git a/lib/DebugInfo/PDB/PDBSymbolBlock.cpp b/lib/DebugInfo/PDB/PDBSymbolBlock.cpp
new file mode 100644
index 0000000..bb159d5
--- /dev/null
+++ b/lib/DebugInfo/PDB/PDBSymbolBlock.cpp
@@ -0,0 +1,26 @@
+//===- PDBSymbolBlock.cpp - -------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/DebugInfo/PDB/PDBSymbolBlock.h"
+
+#include "llvm/DebugInfo/PDB/PDBSymbol.h"
+#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
+
+#include <utility>
+
+using namespace llvm;
+
+PDBSymbolBlock::PDBSymbolBlock(const IPDBSession &PDBSession,
+ std::unique_ptr<IPDBRawSymbol> Symbol)
+ : PDBSymbol(PDBSession, std::move(Symbol)) {}
+
+void PDBSymbolBlock::dump(raw_ostream &OS, int Indent,
+ PDBSymDumper &Dumper) const {
+ Dumper.dump(*this, OS, Indent);
+}
diff --git a/lib/DebugInfo/PDB/PDBSymbolCompiland.cpp b/lib/DebugInfo/PDB/PDBSymbolCompiland.cpp
new file mode 100644
index 0000000..0c9b190
--- /dev/null
+++ b/lib/DebugInfo/PDB/PDBSymbolCompiland.cpp
@@ -0,0 +1,25 @@
+//===- PDBSymbolCompiland.cpp - compiland details --------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/DebugInfo/PDB/PDBSymbolCompiland.h"
+
+#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
+
+#include <utility>
+
+using namespace llvm;
+
+PDBSymbolCompiland::PDBSymbolCompiland(const IPDBSession &PDBSession,
+ std::unique_ptr<IPDBRawSymbol> Symbol)
+ : PDBSymbol(PDBSession, std::move(Symbol)) {}
+
+void PDBSymbolCompiland::dump(raw_ostream &OS, int Indent,
+ PDBSymDumper &Dumper) const {
+ Dumper.dump(*this, OS, Indent);
+}
diff --git a/lib/DebugInfo/PDB/PDBSymbolCompilandDetails.cpp b/lib/DebugInfo/PDB/PDBSymbolCompilandDetails.cpp
new file mode 100644
index 0000000..208d68f
--- /dev/null
+++ b/lib/DebugInfo/PDB/PDBSymbolCompilandDetails.cpp
@@ -0,0 +1,26 @@
+//===- PDBSymbolCompilandDetails.cpp - compiland details --------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/DebugInfo/PDB/PDBSymbolCompilandDetails.h"
+
+#include "llvm/DebugInfo/PDB/PDBSymbol.h"
+#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
+
+#include <utility>
+
+using namespace llvm;
+
+PDBSymbolCompilandDetails::PDBSymbolCompilandDetails(
+ const IPDBSession &PDBSession, std::unique_ptr<IPDBRawSymbol> Symbol)
+ : PDBSymbol(PDBSession, std::move(Symbol)) {}
+
+void PDBSymbolCompilandDetails::dump(raw_ostream &OS, int Indent,
+ PDBSymDumper &Dumper) const {
+ Dumper.dump(*this, OS, Indent);
+}
diff --git a/lib/DebugInfo/PDB/PDBSymbolCompilandEnv.cpp b/lib/DebugInfo/PDB/PDBSymbolCompilandEnv.cpp
new file mode 100644
index 0000000..c54b8fb
--- /dev/null
+++ b/lib/DebugInfo/PDB/PDBSymbolCompilandEnv.cpp
@@ -0,0 +1,32 @@
+//===- PDBSymbolCompilandEnv.cpp - compiland env variables ------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/DebugInfo/PDB/PDBSymbolCompilandEnv.h"
+
+#include "llvm/DebugInfo/PDB/IPDBRawSymbol.h"
+#include "llvm/DebugInfo/PDB/PDBSymbol.h"
+#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
+
+#include <utility>
+
+using namespace llvm;
+
+PDBSymbolCompilandEnv::PDBSymbolCompilandEnv(
+ const IPDBSession &PDBSession, std::unique_ptr<IPDBRawSymbol> Symbol)
+ : PDBSymbol(PDBSession, std::move(Symbol)) {}
+
+std::string PDBSymbolCompilandEnv::getValue() const {
+ // call RawSymbol->getValue() and convert the result to an std::string.
+ return std::string();
+}
+
+void PDBSymbolCompilandEnv::dump(raw_ostream &OS, int Indent,
+ PDBSymDumper &Dumper) const {
+ Dumper.dump(*this, OS, Indent);
+}
diff --git a/lib/DebugInfo/PDB/PDBSymbolCustom.cpp b/lib/DebugInfo/PDB/PDBSymbolCustom.cpp
new file mode 100644
index 0000000..1b6b50b
--- /dev/null
+++ b/lib/DebugInfo/PDB/PDBSymbolCustom.cpp
@@ -0,0 +1,31 @@
+//===- PDBSymbolCustom.cpp - compiler-specific types ------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/DebugInfo/PDB/PDBSymbolCustom.h"
+
+#include "llvm/DebugInfo/PDB/IPDBRawSymbol.h"
+#include "llvm/DebugInfo/PDB/PDBSymbol.h"
+#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
+
+#include <utility>
+
+using namespace llvm;
+
+PDBSymbolCustom::PDBSymbolCustom(const IPDBSession &PDBSession,
+ std::unique_ptr<IPDBRawSymbol> CustomSymbol)
+ : PDBSymbol(PDBSession, std::move(CustomSymbol)) {}
+
+void PDBSymbolCustom::getDataBytes(llvm::SmallVector<uint8_t, 32> &bytes) {
+ RawSymbol->getDataBytes(bytes);
+}
+
+void PDBSymbolCustom::dump(raw_ostream &OS, int Indent,
+ PDBSymDumper &Dumper) const {
+ Dumper.dump(*this, OS, Indent);
+} \ No newline at end of file
diff --git a/lib/DebugInfo/PDB/PDBSymbolData.cpp b/lib/DebugInfo/PDB/PDBSymbolData.cpp
new file mode 100644
index 0000000..6bf7e0f
--- /dev/null
+++ b/lib/DebugInfo/PDB/PDBSymbolData.cpp
@@ -0,0 +1,30 @@
+//===- PDBSymbolData.cpp - PDB data (e.g. variable) accessors ---*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/DebugInfo/PDB/PDBSymbolData.h"
+
+#include "llvm/DebugInfo/PDB/IPDBSession.h"
+#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
+
+#include <utility>
+
+using namespace llvm;
+
+PDBSymbolData::PDBSymbolData(const IPDBSession &PDBSession,
+ std::unique_ptr<IPDBRawSymbol> DataSymbol)
+ : PDBSymbol(PDBSession, std::move(DataSymbol)) {}
+
+std::unique_ptr<PDBSymbol> PDBSymbolData::getType() const {
+ return Session.getSymbolById(getTypeId());
+}
+
+void PDBSymbolData::dump(raw_ostream &OS, int Indent,
+ PDBSymDumper &Dumper) const {
+ Dumper.dump(*this, OS, Indent);
+} \ No newline at end of file
diff --git a/lib/DebugInfo/PDB/PDBSymbolExe.cpp b/lib/DebugInfo/PDB/PDBSymbolExe.cpp
new file mode 100644
index 0000000..ef09193
--- /dev/null
+++ b/lib/DebugInfo/PDB/PDBSymbolExe.cpp
@@ -0,0 +1,25 @@
+//===- PDBSymbolExe.cpp - ---------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/DebugInfo/PDB/PDBSymbolExe.h"
+
+#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
+
+#include <utility>
+
+using namespace llvm;
+
+PDBSymbolExe::PDBSymbolExe(const IPDBSession &PDBSession,
+ std::unique_ptr<IPDBRawSymbol> Symbol)
+ : PDBSymbol(PDBSession, std::move(Symbol)) {}
+
+void PDBSymbolExe::dump(raw_ostream &OS, int Indent,
+ PDBSymDumper &Dumper) const {
+ Dumper.dump(*this, OS, Indent);
+}
diff --git a/lib/DebugInfo/PDB/PDBSymbolFunc.cpp b/lib/DebugInfo/PDB/PDBSymbolFunc.cpp
new file mode 100644
index 0000000..e2d859f
--- /dev/null
+++ b/lib/DebugInfo/PDB/PDBSymbolFunc.cpp
@@ -0,0 +1,104 @@
+//===- PDBSymbolFunc.cpp - --------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/DebugInfo/PDB/PDBSymbolFunc.h"
+
+#include "llvm/DebugInfo/PDB/ConcreteSymbolEnumerator.h"
+#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
+#include "llvm/DebugInfo/PDB/IPDBSession.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolData.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeFunctionSig.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeUDT.h"
+#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
+#include "llvm/DebugInfo/PDB/PDBTypes.h"
+
+#include <unordered_set>
+#include <utility>
+#include <vector>
+
+using namespace llvm;
+
+namespace {
+class FunctionArgEnumerator : public IPDBEnumChildren<PDBSymbolData> {
+public:
+ typedef ConcreteSymbolEnumerator<PDBSymbolData> ArgEnumeratorType;
+
+ FunctionArgEnumerator(const IPDBSession &PDBSession,
+ const PDBSymbolFunc &PDBFunc)
+ : Session(PDBSession), Func(PDBFunc) {
+ // Arguments can appear multiple times if they have live range
+ // information, so we only take the first occurrence.
+ std::unordered_set<std::string> SeenNames;
+ auto DataChildren = Func.findAllChildren<PDBSymbolData>();
+ while (auto Child = DataChildren->getNext()) {
+ if (Child->getDataKind() == PDB_DataKind::Param) {
+ std::string Name = Child->getName();
+ if (SeenNames.find(Name) != SeenNames.end())
+ continue;
+ Args.push_back(std::move(Child));
+ SeenNames.insert(Name);
+ }
+ }
+ reset();
+ }
+
+ uint32_t getChildCount() const { return Args.size(); }
+
+ std::unique_ptr<PDBSymbolData> getChildAtIndex(uint32_t Index) const {
+ if (Index >= Args.size())
+ return nullptr;
+
+ return Session.getConcreteSymbolById<PDBSymbolData>(
+ Args[Index]->getSymIndexId());
+ }
+
+ std::unique_ptr<PDBSymbolData> getNext() {
+ if (CurIter == Args.end())
+ return nullptr;
+ const auto &Result = **CurIter;
+ ++CurIter;
+ return Session.getConcreteSymbolById<PDBSymbolData>(Result.getSymIndexId());
+ }
+
+ void reset() { CurIter = Args.empty() ? Args.end() : Args.begin(); }
+
+ FunctionArgEnumerator *clone() const {
+ return new FunctionArgEnumerator(Session, Func);
+ }
+
+private:
+ typedef std::vector<std::unique_ptr<PDBSymbolData>> ArgListType;
+ const IPDBSession &Session;
+ const PDBSymbolFunc &Func;
+ ArgListType Args;
+ ArgListType::const_iterator CurIter;
+};
+}
+
+PDBSymbolFunc::PDBSymbolFunc(const IPDBSession &PDBSession,
+ std::unique_ptr<IPDBRawSymbol> Symbol)
+ : PDBSymbol(PDBSession, std::move(Symbol)) {}
+
+std::unique_ptr<PDBSymbolTypeFunctionSig> PDBSymbolFunc::getSignature() const {
+ return Session.getConcreteSymbolById<PDBSymbolTypeFunctionSig>(getTypeId());
+}
+
+std::unique_ptr<IPDBEnumChildren<PDBSymbolData>>
+PDBSymbolFunc::getArguments() const {
+ return llvm::make_unique<FunctionArgEnumerator>(Session, *this);
+}
+
+std::unique_ptr<PDBSymbolTypeUDT> PDBSymbolFunc::getClassParent() const {
+ return Session.getConcreteSymbolById<PDBSymbolTypeUDT>(getClassParentId());
+}
+
+void PDBSymbolFunc::dump(raw_ostream &OS, int Indent,
+ PDBSymDumper &Dumper) const {
+ Dumper.dump(*this, OS, Indent);
+}
diff --git a/lib/DebugInfo/PDB/PDBSymbolFuncDebugEnd.cpp b/lib/DebugInfo/PDB/PDBSymbolFuncDebugEnd.cpp
new file mode 100644
index 0000000..c207488
--- /dev/null
+++ b/lib/DebugInfo/PDB/PDBSymbolFuncDebugEnd.cpp
@@ -0,0 +1,26 @@
+//===- PDBSymbolFuncDebugEnd.cpp - ------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/DebugInfo/PDB/PDBSymbolFuncDebugEnd.h"
+
+#include "llvm/DebugInfo/PDB/PDBSymbol.h"
+#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
+
+#include <utility>
+
+using namespace llvm;
+
+PDBSymbolFuncDebugEnd::PDBSymbolFuncDebugEnd(
+ const IPDBSession &PDBSession, std::unique_ptr<IPDBRawSymbol> Symbol)
+ : PDBSymbol(PDBSession, std::move(Symbol)) {}
+
+void PDBSymbolFuncDebugEnd::dump(raw_ostream &OS, int Indent,
+ PDBSymDumper &Dumper) const {
+ Dumper.dump(*this, OS, Indent);
+}
diff --git a/lib/DebugInfo/PDB/PDBSymbolFuncDebugStart.cpp b/lib/DebugInfo/PDB/PDBSymbolFuncDebugStart.cpp
new file mode 100644
index 0000000..83df22e
--- /dev/null
+++ b/lib/DebugInfo/PDB/PDBSymbolFuncDebugStart.cpp
@@ -0,0 +1,26 @@
+//===- PDBSymbolFuncDebugStart.cpp - ----------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/DebugInfo/PDB/PDBSymbolFuncDebugStart.h"
+
+#include "llvm/DebugInfo/PDB/PDBSymbol.h"
+#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
+
+#include <utility>
+
+using namespace llvm;
+
+PDBSymbolFuncDebugStart::PDBSymbolFuncDebugStart(
+ const IPDBSession &PDBSession, std::unique_ptr<IPDBRawSymbol> Symbol)
+ : PDBSymbol(PDBSession, std::move(Symbol)) {}
+
+void PDBSymbolFuncDebugStart::dump(raw_ostream &OS, int Indent,
+ PDBSymDumper &Dumper) const {
+ Dumper.dump(*this, OS, Indent);
+}
diff --git a/lib/DebugInfo/PDB/PDBSymbolLabel.cpp b/lib/DebugInfo/PDB/PDBSymbolLabel.cpp
new file mode 100644
index 0000000..ce569e2
--- /dev/null
+++ b/lib/DebugInfo/PDB/PDBSymbolLabel.cpp
@@ -0,0 +1,25 @@
+//===- PDBSymbolLabel.cpp - -------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/DebugInfo/PDB/PDBSymbolLabel.h"
+
+#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
+
+#include <utility>
+
+using namespace llvm;
+
+PDBSymbolLabel::PDBSymbolLabel(const IPDBSession &PDBSession,
+ std::unique_ptr<IPDBRawSymbol> Symbol)
+ : PDBSymbol(PDBSession, std::move(Symbol)) {}
+
+void PDBSymbolLabel::dump(raw_ostream &OS, int Indent,
+ PDBSymDumper &Dumper) const {
+ Dumper.dump(*this, OS, Indent);
+}
diff --git a/lib/DebugInfo/PDB/PDBSymbolPublicSymbol.cpp b/lib/DebugInfo/PDB/PDBSymbolPublicSymbol.cpp
new file mode 100644
index 0000000..a7f156c
--- /dev/null
+++ b/lib/DebugInfo/PDB/PDBSymbolPublicSymbol.cpp
@@ -0,0 +1,26 @@
+//===- PDBSymbolPublicSymbol.cpp - ------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/DebugInfo/PDB/PDBSymbolPublicSymbol.h"
+
+#include "llvm/DebugInfo/PDB/PDBSymbol.h"
+#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
+
+#include <utility>
+
+using namespace llvm;
+
+PDBSymbolPublicSymbol::PDBSymbolPublicSymbol(
+ const IPDBSession &PDBSession, std::unique_ptr<IPDBRawSymbol> Symbol)
+ : PDBSymbol(PDBSession, std::move(Symbol)) {}
+
+void PDBSymbolPublicSymbol::dump(raw_ostream &OS, int Indent,
+ PDBSymDumper &Dumper) const {
+ Dumper.dump(*this, OS, Indent);
+}
diff --git a/lib/DebugInfo/PDB/PDBSymbolThunk.cpp b/lib/DebugInfo/PDB/PDBSymbolThunk.cpp
new file mode 100644
index 0000000..edade83
--- /dev/null
+++ b/lib/DebugInfo/PDB/PDBSymbolThunk.cpp
@@ -0,0 +1,25 @@
+//===- PDBSymbolThunk.cpp - -------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/DebugInfo/PDB/PDBSymbolThunk.h"
+
+#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
+
+#include <utility>
+
+using namespace llvm;
+
+PDBSymbolThunk::PDBSymbolThunk(const IPDBSession &PDBSession,
+ std::unique_ptr<IPDBRawSymbol> Symbol)
+ : PDBSymbol(PDBSession, std::move(Symbol)) {}
+
+void PDBSymbolThunk::dump(raw_ostream &OS, int Indent,
+ PDBSymDumper &Dumper) const {
+ Dumper.dump(*this, OS, Indent);
+}
diff --git a/lib/DebugInfo/PDB/PDBSymbolTypeArray.cpp b/lib/DebugInfo/PDB/PDBSymbolTypeArray.cpp
new file mode 100644
index 0000000..ffe6c80
--- /dev/null
+++ b/lib/DebugInfo/PDB/PDBSymbolTypeArray.cpp
@@ -0,0 +1,30 @@
+//===- PDBSymbolTypeArray.cpp - ---------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeArray.h"
+
+#include "llvm/DebugInfo/PDB/IPDBSession.h"
+#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
+
+#include <utility>
+
+using namespace llvm;
+
+PDBSymbolTypeArray::PDBSymbolTypeArray(const IPDBSession &PDBSession,
+ std::unique_ptr<IPDBRawSymbol> Symbol)
+ : PDBSymbol(PDBSession, std::move(Symbol)) {}
+
+std::unique_ptr<PDBSymbol> PDBSymbolTypeArray::getElementType() const {
+ return Session.getSymbolById(getTypeId());
+}
+
+void PDBSymbolTypeArray::dump(raw_ostream &OS, int Indent,
+ PDBSymDumper &Dumper) const {
+ Dumper.dump(*this, OS, Indent);
+}
diff --git a/lib/DebugInfo/PDB/PDBSymbolTypeBaseClass.cpp b/lib/DebugInfo/PDB/PDBSymbolTypeBaseClass.cpp
new file mode 100644
index 0000000..c44cc52
--- /dev/null
+++ b/lib/DebugInfo/PDB/PDBSymbolTypeBaseClass.cpp
@@ -0,0 +1,26 @@
+//===- PDBSymbolTypeBaseClass.cpp - -----------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeBaseClass.h"
+
+#include "llvm/DebugInfo/PDB/PDBSymbol.h"
+#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
+
+#include <utility>
+
+using namespace llvm;
+
+PDBSymbolTypeBaseClass::PDBSymbolTypeBaseClass(
+ const IPDBSession &PDBSession, std::unique_ptr<IPDBRawSymbol> Symbol)
+ : PDBSymbol(PDBSession, std::move(Symbol)) {}
+
+void PDBSymbolTypeBaseClass::dump(raw_ostream &OS, int Indent,
+ PDBSymDumper &Dumper) const {
+ Dumper.dump(*this, OS, Indent);
+}
diff --git a/lib/DebugInfo/PDB/PDBSymbolTypeBuiltin.cpp b/lib/DebugInfo/PDB/PDBSymbolTypeBuiltin.cpp
new file mode 100644
index 0000000..f0c94c7
--- /dev/null
+++ b/lib/DebugInfo/PDB/PDBSymbolTypeBuiltin.cpp
@@ -0,0 +1,25 @@
+//===- PDBSymbolTypeBuiltin.cpp - ------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h"
+
+#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
+
+#include <utility>
+
+using namespace llvm;
+
+PDBSymbolTypeBuiltin::PDBSymbolTypeBuiltin(
+ const IPDBSession &PDBSession, std::unique_ptr<IPDBRawSymbol> Symbol)
+ : PDBSymbol(PDBSession, std::move(Symbol)) {}
+
+void PDBSymbolTypeBuiltin::dump(raw_ostream &OS, int Indent,
+ PDBSymDumper &Dumper) const {
+ Dumper.dump(*this, OS, Indent);
+}
diff --git a/lib/DebugInfo/PDB/PDBSymbolTypeCustom.cpp b/lib/DebugInfo/PDB/PDBSymbolTypeCustom.cpp
new file mode 100644
index 0000000..0fa8f45
--- /dev/null
+++ b/lib/DebugInfo/PDB/PDBSymbolTypeCustom.cpp
@@ -0,0 +1,26 @@
+//===- PDBSymbolTypeCustom.cpp - --------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeCustom.h"
+
+#include "llvm/DebugInfo/PDB/PDBSymbol.h"
+#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
+
+#include <utility>
+
+using namespace llvm;
+
+PDBSymbolTypeCustom::PDBSymbolTypeCustom(const IPDBSession &PDBSession,
+ std::unique_ptr<IPDBRawSymbol> Symbol)
+ : PDBSymbol(PDBSession, std::move(Symbol)) {}
+
+void PDBSymbolTypeCustom::dump(raw_ostream &OS, int Indent,
+ PDBSymDumper &Dumper) const {
+ Dumper.dump(*this, OS, Indent);
+}
diff --git a/lib/DebugInfo/PDB/PDBSymbolTypeDimension.cpp b/lib/DebugInfo/PDB/PDBSymbolTypeDimension.cpp
new file mode 100644
index 0000000..47fb08d
--- /dev/null
+++ b/lib/DebugInfo/PDB/PDBSymbolTypeDimension.cpp
@@ -0,0 +1,27 @@
+//===- PDBSymbolTypeDimension.cpp - --------------------------------*- C++
+//-*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeDimension.h"
+
+#include "llvm/DebugInfo/PDB/PDBSymbol.h"
+#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
+
+#include <utility>
+
+using namespace llvm;
+
+PDBSymbolTypeDimension::PDBSymbolTypeDimension(
+ const IPDBSession &PDBSession, std::unique_ptr<IPDBRawSymbol> Symbol)
+ : PDBSymbol(PDBSession, std::move(Symbol)) {}
+
+void PDBSymbolTypeDimension::dump(raw_ostream &OS, int Indent,
+ PDBSymDumper &Dumper) const {
+ Dumper.dump(*this, OS, Indent);
+}
diff --git a/lib/DebugInfo/PDB/PDBSymbolTypeEnum.cpp b/lib/DebugInfo/PDB/PDBSymbolTypeEnum.cpp
new file mode 100644
index 0000000..121d41e
--- /dev/null
+++ b/lib/DebugInfo/PDB/PDBSymbolTypeEnum.cpp
@@ -0,0 +1,25 @@
+//===- PDBSymbolTypeEnum.cpp - --------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h"
+
+#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
+
+#include <utility>
+
+using namespace llvm;
+
+PDBSymbolTypeEnum::PDBSymbolTypeEnum(const IPDBSession &PDBSession,
+ std::unique_ptr<IPDBRawSymbol> Symbol)
+ : PDBSymbol(PDBSession, std::move(Symbol)) {}
+
+void PDBSymbolTypeEnum::dump(raw_ostream &OS, int Indent,
+ PDBSymDumper &Dumper) const {
+ Dumper.dump(*this, OS, Indent);
+}
diff --git a/lib/DebugInfo/PDB/PDBSymbolTypeFriend.cpp b/lib/DebugInfo/PDB/PDBSymbolTypeFriend.cpp
new file mode 100644
index 0000000..b2bf72e
--- /dev/null
+++ b/lib/DebugInfo/PDB/PDBSymbolTypeFriend.cpp
@@ -0,0 +1,26 @@
+//===- PDBSymbolTypeFriend.cpp - --------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeFriend.h"
+
+#include "llvm/DebugInfo/PDB/PDBSymbol.h"
+#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
+
+#include <utility>
+
+using namespace llvm;
+
+PDBSymbolTypeFriend::PDBSymbolTypeFriend(const IPDBSession &PDBSession,
+ std::unique_ptr<IPDBRawSymbol> Symbol)
+ : PDBSymbol(PDBSession, std::move(Symbol)) {}
+
+void PDBSymbolTypeFriend::dump(raw_ostream &OS, int Indent,
+ PDBSymDumper &Dumper) const {
+ Dumper.dump(*this, OS, Indent);
+}
diff --git a/lib/DebugInfo/PDB/PDBSymbolTypeFunctionArg.cpp b/lib/DebugInfo/PDB/PDBSymbolTypeFunctionArg.cpp
new file mode 100644
index 0000000..f394c04
--- /dev/null
+++ b/lib/DebugInfo/PDB/PDBSymbolTypeFunctionArg.cpp
@@ -0,0 +1,25 @@
+//===- PDBSymbolTypeFunctionArg.cpp - --------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeFunctionArg.h"
+
+#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
+
+#include <utility>
+
+using namespace llvm;
+
+PDBSymbolTypeFunctionArg::PDBSymbolTypeFunctionArg(
+ const IPDBSession &PDBSession, std::unique_ptr<IPDBRawSymbol> Symbol)
+ : PDBSymbol(PDBSession, std::move(Symbol)) {}
+
+void PDBSymbolTypeFunctionArg::dump(raw_ostream &OS, int Indent,
+ PDBSymDumper &Dumper) const {
+ Dumper.dump(*this, OS, Indent);
+}
diff --git a/lib/DebugInfo/PDB/PDBSymbolTypeFunctionSig.cpp b/lib/DebugInfo/PDB/PDBSymbolTypeFunctionSig.cpp
new file mode 100644
index 0000000..1ba397b
--- /dev/null
+++ b/lib/DebugInfo/PDB/PDBSymbolTypeFunctionSig.cpp
@@ -0,0 +1,89 @@
+//===- PDBSymbolTypeFunctionSig.cpp - --------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeFunctionSig.h"
+
+#include "llvm/DebugInfo/PDB/ConcreteSymbolEnumerator.h"
+#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
+#include "llvm/DebugInfo/PDB/IPDBSession.h"
+#include "llvm/DebugInfo/PDB/PDBSymbol.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeFunctionArg.h"
+#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
+
+#include <utility>
+
+using namespace llvm;
+
+namespace {
+class FunctionArgEnumerator : public IPDBEnumSymbols {
+public:
+ typedef ConcreteSymbolEnumerator<PDBSymbolTypeFunctionArg> ArgEnumeratorType;
+
+ FunctionArgEnumerator(const IPDBSession &PDBSession,
+ const PDBSymbolTypeFunctionSig &Sig)
+ : Session(PDBSession),
+ Enumerator(Sig.findAllChildren<PDBSymbolTypeFunctionArg>()) {}
+
+ FunctionArgEnumerator(const IPDBSession &PDBSession,
+ std::unique_ptr<ArgEnumeratorType> ArgEnumerator)
+ : Session(PDBSession), Enumerator(std::move(ArgEnumerator)) {}
+
+ uint32_t getChildCount() const { return Enumerator->getChildCount(); }
+
+ std::unique_ptr<PDBSymbol> getChildAtIndex(uint32_t Index) const {
+ auto FunctionArgSymbol = Enumerator->getChildAtIndex(Index);
+ if (!FunctionArgSymbol)
+ return nullptr;
+ return Session.getSymbolById(FunctionArgSymbol->getTypeId());
+ }
+
+ std::unique_ptr<PDBSymbol> getNext() {
+ auto FunctionArgSymbol = Enumerator->getNext();
+ if (!FunctionArgSymbol)
+ return nullptr;
+ return Session.getSymbolById(FunctionArgSymbol->getTypeId());
+ }
+
+ void reset() { Enumerator->reset(); }
+
+ MyType *clone() const {
+ std::unique_ptr<ArgEnumeratorType> Clone(Enumerator->clone());
+ return new FunctionArgEnumerator(Session, std::move(Clone));
+ }
+
+private:
+ const IPDBSession &Session;
+ std::unique_ptr<ArgEnumeratorType> Enumerator;
+};
+}
+
+PDBSymbolTypeFunctionSig::PDBSymbolTypeFunctionSig(
+ const IPDBSession &PDBSession, std::unique_ptr<IPDBRawSymbol> Symbol)
+ : PDBSymbol(PDBSession, std::move(Symbol)) {}
+
+std::unique_ptr<PDBSymbol> PDBSymbolTypeFunctionSig::getReturnType() const {
+ return Session.getSymbolById(getTypeId());
+}
+
+std::unique_ptr<IPDBEnumSymbols>
+PDBSymbolTypeFunctionSig::getArguments() const {
+ return llvm::make_unique<FunctionArgEnumerator>(Session, *this);
+}
+
+std::unique_ptr<PDBSymbol> PDBSymbolTypeFunctionSig::getClassParent() const {
+ uint32_t ClassId = getClassParentId();
+ if (ClassId == 0)
+ return nullptr;
+ return Session.getSymbolById(ClassId);
+}
+
+void PDBSymbolTypeFunctionSig::dump(raw_ostream &OS, int Indent,
+ PDBSymDumper &Dumper) const {
+ Dumper.dump(*this, OS, Indent);
+}
diff --git a/lib/DebugInfo/PDB/PDBSymbolTypeManaged.cpp b/lib/DebugInfo/PDB/PDBSymbolTypeManaged.cpp
new file mode 100644
index 0000000..e04fb66
--- /dev/null
+++ b/lib/DebugInfo/PDB/PDBSymbolTypeManaged.cpp
@@ -0,0 +1,26 @@
+//===- PDBSymboTypelManaged.cpp - ------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeManaged.h"
+
+#include "llvm/DebugInfo/PDB/PDBSymbol.h"
+#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
+
+#include <utility>
+
+using namespace llvm;
+
+PDBSymbolTypeManaged::PDBSymbolTypeManaged(
+ const IPDBSession &PDBSession, std::unique_ptr<IPDBRawSymbol> Symbol)
+ : PDBSymbol(PDBSession, std::move(Symbol)) {}
+
+void PDBSymbolTypeManaged::dump(raw_ostream &OS, int Indent,
+ PDBSymDumper &Dumper) const {
+ Dumper.dump(*this, OS, Indent);
+}
diff --git a/lib/DebugInfo/PDB/PDBSymbolTypePointer.cpp b/lib/DebugInfo/PDB/PDBSymbolTypePointer.cpp
new file mode 100644
index 0000000..d274bf5
--- /dev/null
+++ b/lib/DebugInfo/PDB/PDBSymbolTypePointer.cpp
@@ -0,0 +1,30 @@
+//===- PDBSymbolTypePointer.cpp -----------------------------------*- C++ -===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/DebugInfo/PDB/PDBSymbolTypePointer.h"
+
+#include "llvm/DebugInfo/PDB/IPDBSession.h"
+#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
+
+#include <utility>
+
+using namespace llvm;
+
+PDBSymbolTypePointer::PDBSymbolTypePointer(
+ const IPDBSession &PDBSession, std::unique_ptr<IPDBRawSymbol> Symbol)
+ : PDBSymbol(PDBSession, std::move(Symbol)) {}
+
+std::unique_ptr<PDBSymbol> PDBSymbolTypePointer::getPointeeType() const {
+ return Session.getSymbolById(getTypeId());
+}
+
+void PDBSymbolTypePointer::dump(raw_ostream &OS, int Indent,
+ PDBSymDumper &Dumper) const {
+ Dumper.dump(*this, OS, Indent);
+}
diff --git a/lib/DebugInfo/PDB/PDBSymbolTypeTypedef.cpp b/lib/DebugInfo/PDB/PDBSymbolTypeTypedef.cpp
new file mode 100644
index 0000000..12e3ead
--- /dev/null
+++ b/lib/DebugInfo/PDB/PDBSymbolTypeTypedef.cpp
@@ -0,0 +1,25 @@
+//===- PDBSymbolTypeTypedef.cpp ---------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeTypedef.h"
+
+#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
+
+#include <utility>
+
+using namespace llvm;
+
+PDBSymbolTypeTypedef::PDBSymbolTypeTypedef(
+ const IPDBSession &PDBSession, std::unique_ptr<IPDBRawSymbol> Symbol)
+ : PDBSymbol(PDBSession, std::move(Symbol)) {}
+
+void PDBSymbolTypeTypedef::dump(raw_ostream &OS, int Indent,
+ PDBSymDumper &Dumper) const {
+ Dumper.dump(*this, OS, Indent);
+}
diff --git a/lib/DebugInfo/PDB/PDBSymbolTypeUDT.cpp b/lib/DebugInfo/PDB/PDBSymbolTypeUDT.cpp
new file mode 100644
index 0000000..8a72368
--- /dev/null
+++ b/lib/DebugInfo/PDB/PDBSymbolTypeUDT.cpp
@@ -0,0 +1,25 @@
+//===- PDBSymbolTypeUDT.cpp - --------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeUDT.h"
+
+#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
+
+#include <utility>
+
+using namespace llvm;
+
+PDBSymbolTypeUDT::PDBSymbolTypeUDT(const IPDBSession &PDBSession,
+ std::unique_ptr<IPDBRawSymbol> Symbol)
+ : PDBSymbol(PDBSession, std::move(Symbol)) {}
+
+void PDBSymbolTypeUDT::dump(raw_ostream &OS, int Indent,
+ PDBSymDumper &Dumper) const {
+ Dumper.dump(*this, OS, Indent);
+}
diff --git a/lib/DebugInfo/PDB/PDBSymbolTypeVTable.cpp b/lib/DebugInfo/PDB/PDBSymbolTypeVTable.cpp
new file mode 100644
index 0000000..a100526
--- /dev/null
+++ b/lib/DebugInfo/PDB/PDBSymbolTypeVTable.cpp
@@ -0,0 +1,25 @@
+//===- PDBSymbolTypeVTable.cpp - --------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeVTable.h"
+
+#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
+
+#include <utility>
+
+using namespace llvm;
+
+PDBSymbolTypeVTable::PDBSymbolTypeVTable(const IPDBSession &PDBSession,
+ std::unique_ptr<IPDBRawSymbol> Symbol)
+ : PDBSymbol(PDBSession, std::move(Symbol)) {}
+
+void PDBSymbolTypeVTable::dump(raw_ostream &OS, int Indent,
+ PDBSymDumper &Dumper) const {
+ Dumper.dump(*this, OS, Indent);
+}
diff --git a/lib/DebugInfo/PDB/PDBSymbolTypeVTableShape.cpp b/lib/DebugInfo/PDB/PDBSymbolTypeVTableShape.cpp
new file mode 100644
index 0000000..6aaa668
--- /dev/null
+++ b/lib/DebugInfo/PDB/PDBSymbolTypeVTableShape.cpp
@@ -0,0 +1,26 @@
+//===- PDBSymbolTypeVTableShape.cpp - ---------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeVTableShape.h"
+
+#include "llvm/DebugInfo/PDB/PDBSymbol.h"
+#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
+
+#include <utility>
+
+using namespace llvm;
+
+PDBSymbolTypeVTableShape::PDBSymbolTypeVTableShape(
+ const IPDBSession &PDBSession, std::unique_ptr<IPDBRawSymbol> Symbol)
+ : PDBSymbol(PDBSession, std::move(Symbol)) {}
+
+void PDBSymbolTypeVTableShape::dump(raw_ostream &OS, int Indent,
+ PDBSymDumper &Dumper) const {
+ Dumper.dump(*this, OS, Indent);
+}
diff --git a/lib/DebugInfo/PDB/PDBSymbolUnknown.cpp b/lib/DebugInfo/PDB/PDBSymbolUnknown.cpp
new file mode 100644
index 0000000..9cfb88a
--- /dev/null
+++ b/lib/DebugInfo/PDB/PDBSymbolUnknown.cpp
@@ -0,0 +1,26 @@
+//===- PDBSymbolUnknown.cpp - -----------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/DebugInfo/PDB/PDBSymbolUnknown.h"
+
+#include "llvm/DebugInfo/PDB/PDBSymbol.h"
+#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
+
+#include <utility>
+
+using namespace llvm;
+
+PDBSymbolUnknown::PDBSymbolUnknown(const IPDBSession &PDBSession,
+ std::unique_ptr<IPDBRawSymbol> Symbol)
+ : PDBSymbol(PDBSession, std::move(Symbol)) {}
+
+void PDBSymbolUnknown::dump(raw_ostream &OS, int Indent,
+ PDBSymDumper &Dumper) const {
+ Dumper.dump(*this, OS, Indent);
+}
diff --git a/lib/DebugInfo/PDB/PDBSymbolUsingNamespace.cpp b/lib/DebugInfo/PDB/PDBSymbolUsingNamespace.cpp
new file mode 100644
index 0000000..9176dfb
--- /dev/null
+++ b/lib/DebugInfo/PDB/PDBSymbolUsingNamespace.cpp
@@ -0,0 +1,26 @@
+//===- PDBSymbolUsingNamespace.cpp - ------------------- --------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/DebugInfo/PDB/PDBSymbolUsingNamespace.h"
+
+#include "llvm/DebugInfo/PDB/PDBSymbol.h"
+#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
+
+#include <utility>
+
+using namespace llvm;
+
+PDBSymbolUsingNamespace::PDBSymbolUsingNamespace(
+ const IPDBSession &PDBSession, std::unique_ptr<IPDBRawSymbol> Symbol)
+ : PDBSymbol(PDBSession, std::move(Symbol)) {}
+
+void PDBSymbolUsingNamespace::dump(raw_ostream &OS, int Indent,
+ PDBSymDumper &Dumper) const {
+ Dumper.dump(*this, OS, Indent);
+}