diff options
author | Zachary Turner <zturner@google.com> | 2016-05-06 20:51:57 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2016-05-06 20:51:57 +0000 |
commit | 819e77d196f208cc8ef15b4186e07ecb14a115c8 (patch) | |
tree | 409e2ff42a99563c75759c4c22116c35eb60569c /llvm/lib/DebugInfo/PDB/Raw/InfoStream.cpp | |
parent | 091fcfa3a7632b6bbfbefdac84e0425d827d288c (diff) | |
download | llvm-819e77d196f208cc8ef15b4186e07ecb14a115c8.zip llvm-819e77d196f208cc8ef15b4186e07ecb14a115c8.tar.gz llvm-819e77d196f208cc8ef15b4186e07ecb14a115c8.tar.bz2 |
Port DebugInfoPDB over to using llvm::Error.
Differential Revision: http://reviews.llvm.org/D19940
Reviewed By: rnk
llvm-svn: 268791
Diffstat (limited to 'llvm/lib/DebugInfo/PDB/Raw/InfoStream.cpp')
-rw-r--r-- | llvm/lib/DebugInfo/PDB/Raw/InfoStream.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/llvm/lib/DebugInfo/PDB/Raw/InfoStream.cpp b/llvm/lib/DebugInfo/PDB/Raw/InfoStream.cpp index 210dffd..be90285 100644 --- a/llvm/lib/DebugInfo/PDB/Raw/InfoStream.cpp +++ b/llvm/lib/DebugInfo/PDB/Raw/InfoStream.cpp @@ -11,6 +11,7 @@ #include "llvm/ADT/BitVector.h" #include "llvm/ADT/SmallVector.h" #include "llvm/DebugInfo/PDB/Raw/RawConstants.h" +#include "llvm/DebugInfo/PDB/Raw/RawError.h" #include "llvm/DebugInfo/PDB/Raw/StreamReader.h" using namespace llvm; @@ -18,7 +19,7 @@ using namespace llvm::pdb; InfoStream::InfoStream(PDBFile &File) : Pdb(File), Stream(StreamPDB, File) {} -std::error_code InfoStream::reload() { +Error InfoStream::reload() { StreamReader Reader(Stream); struct Header { @@ -29,19 +30,20 @@ std::error_code InfoStream::reload() { }; Header H; - Reader.readObject(&H); + if (auto EC = Reader.readObject(&H)) + return make_error<RawError>(raw_error_code::corrupt_file, + "PDB Stream does not contain a header."); if (H.Version < PdbRaw_ImplVer::PdbImplVC70) - return std::make_error_code(std::errc::not_supported); + return make_error<RawError>(raw_error_code::corrupt_file, + "Unsupported PDB stream version."); Version = H.Version; Signature = H.Signature; Age = H.Age; Guid = H.Guid; - NamedStreams.load(Reader); - - return std::error_code(); + return NamedStreams.load(Reader); } uint32_t InfoStream::getNamedStreamIndex(llvm::StringRef Name) const { |