[X86] Add support for tbyte memory operand size for Intel-syntax x86 assembly
[oota-llvm.git] / unittests / DebugInfo / PDB / PDBApiTest.cpp
index 5c9b377ba4b354a842d9ba548a45b88fe4f0e177..ebd3d7bb6b3ca649a9d51401a6aa81b2ed36d13d 100644 (file)
@@ -7,9 +7,9 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include <type_traits>
 #include <unordered_map>
 
+#include "llvm/ADT/STLExtras.h"
 #include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
 #include "llvm/DebugInfo/PDB/IPDBRawSymbol.h"
 #include "llvm/DebugInfo/PDB/IPDBSession.h"
 #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,6 +72,24 @@ class MockSession : public IPDBSession {
   getSourceFileById(uint32_t SymbolId) const override {
     return nullptr;
   }
+
+  std::unique_ptr<PDBSymbol>
+  findSymbolByAddress(uint64_t Address, PDB_SymType Type) const override {
+    return nullptr;
+  }
+  std::unique_ptr<IPDBEnumLineNumbers>
+  findLineNumbersByAddress(uint64_t Address, uint32_t Length) const override {
+    return nullptr;
+  }
+
+  std::unique_ptr<IPDBEnumSourceFiles> getAllSourceFiles() const override {
+    return nullptr;
+  }
+  std::unique_ptr<IPDBEnumSourceFiles> getSourceFilesForCompiland(
+      const PDBSymbolCompiland &Compiland) const override {
+    return nullptr;
+  }
+
   std::unique_ptr<IPDBEnumDataStreams> getDebugStreams() const override {
     return nullptr;
   }
@@ -89,10 +97,15 @@ class MockSession : public IPDBSession {
 
 class MockRawSymbol : public IPDBRawSymbol {
 public:
-  MockRawSymbol(PDB_SymType SymType) : Type(SymType) {}
+  MockRawSymbol(PDB_SymType SymType)
+      : Type(SymType) {}
 
-  void dump(llvm::raw_ostream &OS) const override {}
+  void dump(raw_ostream &OS, int Indent) 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 {
@@ -206,6 +219,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)
@@ -268,6 +282,9 @@ public:
   MOCK_SYMBOL_ACCESSOR(isVirtualBaseClass)
   MOCK_SYMBOL_ACCESSOR(isVirtualInheritance)
   MOCK_SYMBOL_ACCESSOR(isVolatileType)
+  MOCK_SYMBOL_ACCESSOR(getValue)
+  MOCK_SYMBOL_ACCESSOR(wasInlined)
+  MOCK_SYMBOL_ACCESSOR(getUnused)
 
 private:
   PDB_SymType Type;
@@ -334,7 +351,7 @@ private:
   std::unique_ptr<IPDBSession> Session;
 
   void InsertItemWithTag(PDB_SymType Tag) {
-    auto RawSymbol = std::unique_ptr<IPDBRawSymbol>(new MockRawSymbol(Tag));
+    auto RawSymbol = llvm::make_unique<MockRawSymbol>(Tag);
     auto Symbol = PDBSymbol::create(*Session, std::move(RawSymbol));
     SymbolMap.insert(std::make_pair(Tag, std::move(Symbol)));
   }