[DebugInfoPDB] Add DIA implementation for getSrcLineOnTypeDefn

Summary: This helps to determine the line number for a PDB type with definition

Reviewers: zturner, llvm-commits, rnk

Reviewed By: zturner

Subscribers: rengolin, JDevlieghere

Differential Revision: https://reviews.llvm.org/D44119

llvm-svn: 326857
This commit is contained in:
Aaron Smith 2018-03-07 00:33:09 +00:00
parent 9ad216cc06
commit 1feeb98c08
6 changed files with 25 additions and 0 deletions

View File

@ -103,6 +103,7 @@ public:
uint32_t getSizeInUdt() const override;
uint32_t getSlot() const override;
std::string getSourceFileName() const override;
std::unique_ptr<IPDBLineNumber> getSrcLineOnTypeDefn() const override;
uint32_t getStride() const override;
uint32_t getSubTypeId() const override;
std::string getSymbolsFileName() const override;

View File

@ -115,6 +115,8 @@ public:
virtual uint32_t getSizeInUdt() const = 0;
virtual uint32_t getSlot() const = 0;
virtual std::string getSourceFileName() const = 0;
virtual std::unique_ptr<IPDBLineNumber>
getSrcLineOnTypeDefn() const = 0;
virtual uint32_t getStride() const = 0;
virtual uint32_t getSubTypeId() const = 0;
virtual std::string getSymbolsFileName() const = 0;

View File

@ -108,6 +108,7 @@ public:
uint32_t getSizeInUdt() const override;
uint32_t getSlot() const override;
std::string getSourceFileName() const override;
std::unique_ptr<IPDBLineNumber> getSrcLineOnTypeDefn() const override;
uint32_t getStride() const override;
uint32_t getSubTypeId() const override;
std::string getSymbolsFileName() const override;

View File

@ -13,6 +13,7 @@
#include "llvm/DebugInfo/CodeView/Formatters.h"
#include "llvm/DebugInfo/PDB/DIA/DIAEnumLineNumbers.h"
#include "llvm/DebugInfo/PDB/DIA/DIAEnumSymbols.h"
#include "llvm/DebugInfo/PDB/DIA/DIALineNumber.h"
#include "llvm/DebugInfo/PDB/DIA/DIASession.h"
#include "llvm/DebugInfo/PDB/PDBExtras.h"
#include "llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h"
@ -748,6 +749,15 @@ std::string DIARawSymbol::getSourceFileName() const {
return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_sourceFileName);
}
std::unique_ptr<IPDBLineNumber>
DIARawSymbol::getSrcLineOnTypeDefn() const {
CComPtr<IDiaLineNumber> LineNumber;
if (FAILED(Symbol->getSrcLineOnTypeDefn(&LineNumber)) || !LineNumber)
return nullptr;
return llvm::make_unique<DIALineNumber>(LineNumber);
}
uint32_t DIARawSymbol::getStride() const {
return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_stride);
}

View File

@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
#include "llvm/DebugInfo/PDB/IPDBLineNumber.h"
#include "llvm/DebugInfo/PDB/Native/NativeRawSymbol.h"
#include "llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h"
@ -278,6 +279,11 @@ std::string NativeRawSymbol::getSourceFileName() const {
return {};
}
std::unique_ptr<IPDBLineNumber>
NativeRawSymbol::getSrcLineOnTypeDefn() const {
return nullptr;
}
uint32_t NativeRawSymbol::getStride() const {
return 0;
}

View File

@ -11,6 +11,7 @@
#include "llvm/ADT/STLExtras.h"
#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
#include "llvm/DebugInfo/PDB/IPDBLineNumber.h"
#include "llvm/DebugInfo/PDB/IPDBRawSymbol.h"
#include "llvm/DebugInfo/PDB/IPDBSession.h"
#include "llvm/DebugInfo/PDB/IPDBSourceFile.h"
@ -195,6 +196,10 @@ public:
return {};
}
std::unique_ptr<IPDBLineNumber> getSrcLineOnTypeDefn() const override {
return nullptr;
}
MOCK_SYMBOL_ACCESSOR(getAccess)
MOCK_SYMBOL_ACCESSOR(getAddressOffset)
MOCK_SYMBOL_ACCESSOR(getAddressSection)