Fix non-windows builds unhappy about a missing header.
[oota-llvm.git] / include / llvm / DebugInfo / PDB / IPDBSession.h
1 //===- IPDBSession.h - base interface for a PDB symbol context --*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef LLVM_DEBUGINFO_PDB_IPDBSESSION_H
11 #define LLVM_DEBUGINFO_PDB_IPDBSESSION_H
12
13 #include <memory>
14
15 #include "PDBTypes.h"
16 #include "llvm/Support/Casting.h"
17
18 namespace llvm {
19
20 class PDBSymbolCompiland;
21 class PDBSymbolExe;
22
23 /// IPDBSession defines an interface used to provide a context for querying
24 /// debug information from a debug data source (for example, a PDB).
25 class IPDBSession {
26 public:
27   virtual ~IPDBSession();
28
29   virtual uint64_t getLoadAddress() const = 0;
30   virtual void setLoadAddress(uint64_t Address) = 0;
31   virtual std::unique_ptr<PDBSymbolExe> getGlobalScope() const = 0;
32   virtual std::unique_ptr<PDBSymbol> getSymbolById(uint32_t SymbolId) const = 0;
33
34   template <typename T>
35   std::unique_ptr<T> getConcreteSymbolById(uint32_t SymbolId) const {
36     auto Symbol(getSymbolById(SymbolId));
37     if (!Symbol)
38       return nullptr;
39
40     T *ConcreteSymbol = dyn_cast<T>(Symbol.get());
41     if (!ConcreteSymbol)
42       return nullptr;
43     Symbol.release();
44     return std::unique_ptr<T>(ConcreteSymbol);
45   }
46
47   virtual std::unique_ptr<IPDBEnumSourceFiles> getAllSourceFiles() const = 0;
48   virtual std::unique_ptr<IPDBEnumSourceFiles>
49   getSourceFilesForCompiland(const PDBSymbolCompiland &Compiland) const = 0;
50   virtual std::unique_ptr<IPDBSourceFile>
51   getSourceFileById(uint32_t FileId) const = 0;
52
53   virtual std::unique_ptr<IPDBEnumDataStreams> getDebugStreams() const = 0;
54 };
55 }
56
57 #endif