diff options
author | Zachary Turner <zturner@google.com> | 2015-02-10 22:43:25 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2015-02-10 22:43:25 +0000 |
commit | a5549178f12d3d4dad72e1ab8efbb6fc9ed0d2c9 (patch) | |
tree | 9012681968824b47f3c3f208cd91fa82cf48aa5d /llvm/unittests/DebugInfo/PDB/PDBApiTest.cpp | |
parent | ca19485f08fc41bb7de5be925c06735937b3ea50 (diff) | |
download | bcm5719-llvm-a5549178f12d3d4dad72e1ab8efbb6fc9ed0d2c9.tar.gz bcm5719-llvm-a5549178f12d3d4dad72e1ab8efbb6fc9ed0d2c9.zip |
Rewrite llvm-pdbdump in terms of LLVMDebugInfoPDB.
This makes llvm-pdbdump available on all platforms, although it
will currently fail to create a dumper if there is no PDB reader
implementation for the current platform.
It implements dumping of compilands and children, which is less
information than was previously available, but it has to be
rewritten from scratch using the new set of interfaces, so the
rest of the functionality will be added back in subsequent commits.
llvm-svn: 228755
Diffstat (limited to 'llvm/unittests/DebugInfo/PDB/PDBApiTest.cpp')
-rw-r--r-- | llvm/unittests/DebugInfo/PDB/PDBApiTest.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/llvm/unittests/DebugInfo/PDB/PDBApiTest.cpp b/llvm/unittests/DebugInfo/PDB/PDBApiTest.cpp index 5c9b377ba4b..fd65d10dfed 100644 --- a/llvm/unittests/DebugInfo/PDB/PDBApiTest.cpp +++ b/llvm/unittests/DebugInfo/PDB/PDBApiTest.cpp @@ -7,7 +7,6 @@ // //===----------------------------------------------------------------------===// -#include <type_traits> #include <unordered_map> #include "llvm/DebugInfo/PDB/IPDBEnumChildren.h" @@ -51,16 +50,6 @@ #include "gtest/gtest.h" using namespace llvm; -namespace std { - template<> - struct hash<PDB_SymType> { - public: - std::size_t operator()(PDB_SymType Symbol) const { - return std::hash<int>()(static_cast<int>(Symbol)); - } - }; -} - namespace { #define MOCK_SYMBOL_ACCESSOR(Func) \ @@ -82,18 +71,27 @@ class MockSession : public IPDBSession { getSourceFileById(uint32_t SymbolId) const override { return nullptr; } - std::unique_ptr<IPDBEnumDataStreams> getDebugStreams() const override { + std::unique_ptr<IPDBEnumSourceFiles> getAllSourceFiles() const override { + return nullptr; + } + std::unique_ptr<IPDBEnumSourceFiles> getSourceFilesForCompiland( + const PDBSymbolCompiland &Compiland) const override { return nullptr; } }; class MockRawSymbol : public IPDBRawSymbol { public: - MockRawSymbol(PDB_SymType SymType) : Type(SymType) {} + MockRawSymbol(const IPDBSession &PDBSession, PDB_SymType SymType) + : Session(PDBSession), Type(SymType) {} - void dump(llvm::raw_ostream &OS) const override {} + void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override {} std::unique_ptr<IPDBEnumSymbols> + findChildren(PDB_SymType Type) const override { + return nullptr; + } + std::unique_ptr<IPDBEnumSymbols> findChildren(PDB_SymType Type, StringRef Name, PDB_NameSearchFlags Flags) const override { return nullptr; @@ -206,6 +204,7 @@ public: MOCK_SYMBOL_ACCESSOR(hasDebugInfo) MOCK_SYMBOL_ACCESSOR(hasEH) MOCK_SYMBOL_ACCESSOR(hasEHa) + MOCK_SYMBOL_ACCESSOR(hasFramePointer) MOCK_SYMBOL_ACCESSOR(hasInlAsm) MOCK_SYMBOL_ACCESSOR(hasInlineAttribute) MOCK_SYMBOL_ACCESSOR(hasInterruptReturn) @@ -270,6 +269,7 @@ public: MOCK_SYMBOL_ACCESSOR(isVolatileType) private: + const IPDBSession &Session; PDB_SymType Type; }; @@ -334,7 +334,7 @@ private: std::unique_ptr<IPDBSession> Session; void InsertItemWithTag(PDB_SymType Tag) { - auto RawSymbol = std::unique_ptr<IPDBRawSymbol>(new MockRawSymbol(Tag)); + auto RawSymbol = std::make_unique<MockRawSymbol>(*Session, Tag); auto Symbol = PDBSymbol::create(*Session, std::move(RawSymbol)); SymbolMap.insert(std::make_pair(Tag, std::move(Symbol))); } |