summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/PDB/PDB.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/DebugInfo/PDB/PDB.cpp')
-rw-r--r--llvm/lib/DebugInfo/PDB/PDB.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/llvm/lib/DebugInfo/PDB/PDB.cpp b/llvm/lib/DebugInfo/PDB/PDB.cpp
index 501d4f5985b..c1b21c12036 100644
--- a/llvm/lib/DebugInfo/PDB/PDB.cpp
+++ b/llvm/lib/DebugInfo/PDB/PDB.cpp
@@ -23,8 +23,15 @@ using namespace llvm::pdb;
Error llvm::pdb::loadDataForPDB(PDB_ReaderType Type, StringRef Path,
std::unique_ptr<IPDBSession> &Session) {
// Create the correct concrete instance type based on the value of Type.
- if (Type == PDB_ReaderType::Native)
- return NativeSession::createFromPdb(Path, Session);
+ if (Type == PDB_ReaderType::Native) {
+ ErrorOr<std::unique_ptr<MemoryBuffer>> ErrorOrBuffer =
+ MemoryBuffer::getFileOrSTDIN(Path, /*FileSize=*/-1,
+ /*RequiresNullTerminator=*/false);
+ if (!ErrorOrBuffer)
+ return make_error<GenericError>(generic_error_code::invalid_path, Path);
+
+ return NativeSession::createFromPdb(std::move(*ErrorOrBuffer), Session);
+ }
#if LLVM_ENABLE_DIA_SDK
return DIASession::createFromPdb(Path, Session);
OpenPOWER on IntegriCloud