LLVM 22.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"
18
19using namespace llvm;
20using namespace llvm::pdb;
21
23 std::unique_ptr<IPDBSession> &Session) {
24 // Create the correct concrete instance type based on the value of Type.
27
28#if LLVM_ENABLE_DIA_SDK
29 return DIASession::createFromPdb(Path, Session);
30#else
32#endif
33}
34
36 std::unique_ptr<IPDBSession> &Session) {
37 // Create the correct concrete instance type based on the value of Type.
40 if (!PdbPath)
41 return PdbPath.takeError();
42 return NativeSession::createFromPdbPath(PdbPath.get(), Session);
43 }
44
45#if LLVM_ENABLE_DIA_SDK
46 return DIASession::createFromExe(Path, Session);
47#else
49#endif
50}
Lightweight error class with error context and mandatory checking.
Definition Error.h:159
Tagged union holding either a T or a Error.
Definition Error.h:485
Error takeError()
Take ownership of the stored error.
Definition Error.h:612
reference get()
Returns a reference to the stored T value.
Definition Error.h:582
StringRef - Represent a constant reference to a string, i.e.
Definition StringRef.h:55
static Error createFromExe(StringRef Path, std::unique_ptr< IPDBSession > &Session)
static Error createFromPdb(StringRef Path, std::unique_ptr< IPDBSession > &Session)
static Expected< std::string > searchForPdb(const PdbSearchOptions &Opts)
static Error createFromPdbPath(StringRef PdbPath, std::unique_ptr< IPDBSession > &Session)
LLVM_ABI Error loadDataForEXE(PDB_ReaderType Type, StringRef Path, std::unique_ptr< IPDBSession > &Session)
Definition PDB.cpp:35
PDB_ReaderType
Specifies which PDB reader implementation is to be used.
Definition PDBTypes.h:80
LLVM_ABI Error loadDataForPDB(PDB_ReaderType Type, StringRef Path, std::unique_ptr< IPDBSession > &Session)
Definition PDB.cpp:22
This is an optimization pass for GlobalISel generic memory operations.
Error make_error(ArgTs &&... Args)
Make a Error instance representing failure using the given error info type.
Definition Error.h:340