LLVM  5.0.0
PDB.cpp
Go to the documentation of this file.
1 //===- PDB.cpp - base header file for creating a PDB reader ---------------===//
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 #include "llvm/DebugInfo/PDB/PDB.h"
11 #include "llvm/ADT/StringRef.h"
12 #include "llvm/Config/config.h"
14 #if LLVM_ENABLE_DIA_SDK
16 #endif
18 #include "llvm/Support/Error.h"
19 
20 using namespace llvm;
21 using namespace llvm::pdb;
22 
24  std::unique_ptr<IPDBSession> &Session) {
25  // Create the correct concrete instance type based on the value of Type.
26  if (Type == PDB_ReaderType::Native)
27  return NativeSession::createFromPdb(Path, Session);
28 
29 #if LLVM_ENABLE_DIA_SDK
30  return DIASession::createFromPdb(Path, Session);
31 #else
32  return make_error<GenericError>("DIA is not installed on the system");
33 #endif
34 }
35 
37  std::unique_ptr<IPDBSession> &Session) {
38  // Create the correct concrete instance type based on the value of Type.
39  if (Type == PDB_ReaderType::Native)
40  return NativeSession::createFromExe(Path, Session);
41 
42 #if LLVM_ENABLE_DIA_SDK
43  return DIASession::createFromExe(Path, Session);
44 #else
45  return make_error<GenericError>("DIA is not installed on the system");
46 #endif
47 }
static Error createFromExe(StringRef Path, std::unique_ptr< IPDBSession > &Session)
PDB_ReaderType
Specifies which PDB reader implementation is to be used.
Definition: PDBTypes.h:68
static Error createFromPdb(StringRef Path, std::unique_ptr< IPDBSession > &Session)
Definition: DIASession.cpp:93
static Error createFromPdb(StringRef Path, std::unique_ptr< IPDBSession > &Session)
Error loadDataForEXE(PDB_ReaderType Type, StringRef Path, std::unique_ptr< IPDBSession > &Session)
Definition: PDB.cpp:36
The instances of the Type class are immutable: once they are created, they are never changed...
Definition: Type.h:46
Error loadDataForPDB(PDB_ReaderType Type, StringRef Path, std::unique_ptr< IPDBSession > &Session)
Definition: PDB.cpp:23
static Error createFromExe(StringRef Path, std::unique_ptr< IPDBSession > &Session)
Definition: DIASession.cpp:119
Lightweight error class with error context and mandatory checking.
Definition: Error.h:156
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49