Zachary Turner | 0e9e663 | 2015-02-06 20:30:52 +0000 | [diff] [blame] | 1 | //===- PDB.cpp - base header file for creating a PDB reader -----*- 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 | |
Zachary Turner | 52c9f88 | 2015-02-14 03:53:56 +0000 | [diff] [blame] | 10 | #include "llvm/DebugInfo/PDB/PDB.h" |
| 11 | |
Zachary Turner | 0e9e663 | 2015-02-06 20:30:52 +0000 | [diff] [blame] | 12 | #include "llvm/ADT/StringRef.h" |
Zachary Turner | 52c9f88 | 2015-02-14 03:53:56 +0000 | [diff] [blame] | 13 | #include "llvm/Config/config.h" |
Zachary Turner | 0e9e663 | 2015-02-06 20:30:52 +0000 | [diff] [blame] | 14 | #include "llvm/DebugInfo/PDB/IPDBSession.h" |
Chandler Carruth | 71f308a | 2015-02-13 09:09:03 +0000 | [diff] [blame] | 15 | #include "llvm/DebugInfo/PDB/PDB.h" |
Zachary Turner | 52c9f88 | 2015-02-14 03:53:56 +0000 | [diff] [blame] | 16 | |
Zachary Turner | cffff26 | 2015-02-10 21:17:52 +0000 | [diff] [blame] | 17 | #if HAVE_DIA_SDK |
| 18 | #include "llvm/DebugInfo/PDB/DIA/DIASession.h" |
| 19 | #endif |
Zachary Turner | 0e9e663 | 2015-02-06 20:30:52 +0000 | [diff] [blame] | 20 | |
| 21 | using namespace llvm; |
| 22 | |
Zachary Turner | 4b08354 | 2015-04-17 22:40:36 +0000 | [diff] [blame] | 23 | PDB_ErrorCode llvm::loadDataForPDB(PDB_ReaderType Type, StringRef Path, |
| 24 | std::unique_ptr<IPDBSession> &Session) { |
Zachary Turner | 0e9e663 | 2015-02-06 20:30:52 +0000 | [diff] [blame] | 25 | // Create the correct concrete instance type based on the value of Type. |
Zachary Turner | cffff26 | 2015-02-10 21:17:52 +0000 | [diff] [blame] | 26 | #if HAVE_DIA_SDK |
Zachary Turner | ccf0415 | 2015-02-28 20:23:18 +0000 | [diff] [blame] | 27 | return DIASession::createFromPdb(Path, Session); |
Zachary Turner | cffff26 | 2015-02-10 21:17:52 +0000 | [diff] [blame] | 28 | #endif |
Zachary Turner | ccf0415 | 2015-02-28 20:23:18 +0000 | [diff] [blame] | 29 | return PDB_ErrorCode::NoPdbImpl; |
Zachary Turner | 0e9e663 | 2015-02-06 20:30:52 +0000 | [diff] [blame] | 30 | } |
Zachary Turner | 4b08354 | 2015-04-17 22:40:36 +0000 | [diff] [blame] | 31 | |
| 32 | PDB_ErrorCode llvm::loadDataForEXE(PDB_ReaderType Type, StringRef Path, |
| 33 | std::unique_ptr<IPDBSession> &Session) { |
Dave Bartolomeo | ea039c1 | 2015-12-17 20:54:16 +0000 | [diff] [blame^] | 34 | // Create the correct concrete instance type based on the value of Type. |
Zachary Turner | 4b08354 | 2015-04-17 22:40:36 +0000 | [diff] [blame] | 35 | #if HAVE_DIA_SDK |
| 36 | return DIASession::createFromExe(Path, Session); |
| 37 | #endif |
| 38 | return PDB_ErrorCode::NoPdbImpl; |
| 39 | } |