LLVM  14.0.0git
PDB.cpp
Go to the documentation of this file.
1 //===- PDB.cpp - base header file for creating a PDB reader ---------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
10 #include "llvm/ADT/StringRef.h"
11 #include "llvm/Config/config.h"
13 #if LLVM_ENABLE_DIA_SDK
15 #endif
17 #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.
27  return NativeSession::createFromPdbPath(Path, Session);
28 
29 #if LLVM_ENABLE_DIA_SDK
30  return DIASession::createFromPdb(Path, Session);
31 #else
32  return make_error<PDBError>(pdb_error_code::dia_sdk_not_present);
33 #endif
34 }
35 
37  std::unique_ptr<IPDBSession> &Session) {
38  // Create the correct concrete instance type based on the value of Type.
41  if (!PdbPath)
42  return PdbPath.takeError();
43  return NativeSession::createFromPdbPath(PdbPath.get(), Session);
44  }
45 
46 #if LLVM_ENABLE_DIA_SDK
47  return DIASession::createFromExe(Path, Session);
48 #else
49  return make_error<PDBError>(pdb_error_code::dia_sdk_not_present);
50 #endif
51 }
MemoryBuffer.h
llvm
This file implements support for optimizing divisions by a constant.
Definition: AllocatorList.h:23
StringRef.h
Error.h
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
llvm::Expected
Tagged union holding either a T or a Error.
Definition: APFloat.h:42
llvm::pdb::loadDataForEXE
Error loadDataForEXE(PDB_ReaderType Type, StringRef Path, std::unique_ptr< IPDBSession > &Session)
Definition: PDB.cpp:36
PDB.h
llvm::pdb::DIASession::createFromExe
static Error createFromExe(StringRef Path, std::unique_ptr< IPDBSession > &Session)
Definition: DIASession.cpp:113
llvm::pdb::NativeSession::createFromPdbPath
static Error createFromPdbPath(StringRef PdbPath, std::unique_ptr< IPDBSession > &Session)
Definition: NativeSession.cpp:111
llvm::pdb::PDB_ReaderType
PDB_ReaderType
Specifies which PDB reader implementation is to be used.
Definition: PDBTypes.h:80
llvm::pdb
Definition: ConcreteSymbolEnumerator.h:20
GenericError.h
llvm::pdb::DIASession::createFromPdb
static Error createFromPdb(StringRef Path, std::unique_ptr< IPDBSession > &Session)
Definition: DIASession.cpp:87
llvm::pdb::loadDataForPDB
Error loadDataForPDB(PDB_ReaderType Type, StringRef Path, std::unique_ptr< IPDBSession > &Session)
Definition: PDB.cpp:23
llvm::pdb::PDB_ReaderType::Native
@ Native
DIASession.h
llvm::pdb::pdb_error_code::dia_sdk_not_present
@ dia_sdk_not_present
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
llvm::Expected::get
reference get()
Returns a reference to the stored T value.
Definition: Error.h:569
llvm::Error
Lightweight error class with error context and mandatory checking.
Definition: Error.h:157
llvm::pdb::NativeSession::searchForPdb
static Expected< std::string > searchForPdb(const PdbSearchOptions &Opts)
Definition: NativeSession.cpp:165
llvm::Expected::takeError
Error takeError()
Take ownership of the stored error.
Definition: Error.h:599
NativeSession.h