diff --git a/test/DebugInfo/llvm-symbolizer.test b/test/DebugInfo/llvm-symbolizer.test index 163bd8ecb30..d094bf9b146 100644 --- a/test/DebugInfo/llvm-symbolizer.test +++ b/test/DebugInfo/llvm-symbolizer.test @@ -23,3 +23,6 @@ CHECK-NEXT: dwarfdump-inl-test.cc: CHECK: _Z3do1v CHECK-NEXT: dwarfdump-test3-decl.h:7 + +RUN: echo "unexisting-file 0x1234" > %t.input2 +RUN: llvm-symbolizer < %t.input2 diff --git a/tools/llvm-symbolizer/LLVMSymbolize.cpp b/tools/llvm-symbolizer/LLVMSymbolize.cpp index 29d91a0e92a..2596a4e0834 100644 --- a/tools/llvm-symbolizer/LLVMSymbolize.cpp +++ b/tools/llvm-symbolizer/LLVMSymbolize.cpp @@ -200,8 +200,8 @@ static bool getObjectEndianness(const ObjectFile *Obj, bool &IsLittleEndian) { static ObjectFile *getObjectFile(const std::string &Path) { OwningPtr Buff; - if (error_code ec = MemoryBuffer::getFile(Path, Buff)) - error(ec); + if (error(MemoryBuffer::getFile(Path, Buff))) + return 0; return ObjectFile::createObjectFile(Buff.take()); }