diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2017-12-18 20:10:56 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2017-12-18 20:10:56 +0000 | 
| commit | 044eb2f6afba375a914ac9d8024f8f5142bb912e (patch) | |
| tree | 1475247dc9f9fe5be155ebd4c9069c75aadf8c20 /lib/DebugInfo/PDB/PDB.cpp | |
| parent | eb70dddbd77e120e5d490bd8fbe7ff3f8fa81c6b (diff) | |
Notes
Diffstat (limited to 'lib/DebugInfo/PDB/PDB.cpp')
| -rw-r--r-- | lib/DebugInfo/PDB/PDB.cpp | 12 | 
1 files changed, 10 insertions, 2 deletions
| diff --git a/lib/DebugInfo/PDB/PDB.cpp b/lib/DebugInfo/PDB/PDB.cpp index 501d4f5985b7..40f5ae9ba845 100644 --- a/lib/DebugInfo/PDB/PDB.cpp +++ b/lib/DebugInfo/PDB/PDB.cpp @@ -16,6 +16,7 @@  #endif  #include "llvm/DebugInfo/PDB/Native/NativeSession.h"  #include "llvm/Support/Error.h" +#include "llvm/Support/MemoryBuffer.h"  using namespace llvm;  using namespace llvm::pdb; @@ -23,8 +24,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); | 
