diff options
author | Quentin Colombet <qcolombet@apple.com> | 2014-02-22 00:34:11 +0000 |
---|---|---|
committer | Quentin Colombet <qcolombet@apple.com> | 2014-02-22 00:34:11 +0000 |
commit | dec8d55b1d947d1174f5a540bb0b14a895ed2cb4 (patch) | |
tree | 4a8b4ed56c5aa2b8fcd1ac273b29c5dcf2c3f425 /llvm/lib/IR/LLVMContext.cpp | |
parent | 0afa2d2f2baee02ff20926603ead9dab02504f06 (diff) | |
download | bcm5719-llvm-dec8d55b1d947d1174f5a540bb0b14a895ed2cb4.tar.gz bcm5719-llvm-dec8d55b1d947d1174f5a540bb0b14a895ed2cb4.zip |
Switch the LLVM error reporting on the new diagnostic system.
The LLVM diagnostic are now wired-up in clang (since r200931),
thus the user experience will not be impacted by this change
anymore.
Related to <rdar://problem/15886697>
llvm-svn: 201915
Diffstat (limited to 'llvm/lib/IR/LLVMContext.cpp')
-rw-r--r-- | llvm/lib/IR/LLVMContext.cpp | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/llvm/lib/IR/LLVMContext.cpp b/llvm/lib/IR/LLVMContext.cpp index bae83dd3015..d9d6de15447 100644 --- a/llvm/lib/IR/LLVMContext.cpp +++ b/llvm/lib/IR/LLVMContext.cpp @@ -115,17 +115,12 @@ void *LLVMContext::getDiagnosticContext() const { } void LLVMContext::emitError(const Twine &ErrorStr) { - emitError(0U, ErrorStr); + diagnose(DiagnosticInfoInlineAsm(ErrorStr)); } void LLVMContext::emitError(const Instruction *I, const Twine &ErrorStr) { - unsigned LocCookie = 0; - if (const MDNode *SrcLoc = I->getMetadata("srcloc")) { - if (SrcLoc->getNumOperands() != 0) - if (const ConstantInt *CI = dyn_cast<ConstantInt>(SrcLoc->getOperand(0))) - LocCookie = CI->getZExtValue(); - } - return emitError(LocCookie, ErrorStr); + assert (I && "Invalid instruction"); + diagnose(DiagnosticInfoInlineAsm(*I, ErrorStr)); } void LLVMContext::diagnose(const DiagnosticInfo &DI) { @@ -154,16 +149,7 @@ void LLVMContext::diagnose(const DiagnosticInfo &DI) { } void LLVMContext::emitError(unsigned LocCookie, const Twine &ErrorStr) { - // If there is no error handler installed, just print the error and exit. - if (pImpl->InlineAsmDiagHandler == 0) { - errs() << "error: " << ErrorStr << "\n"; - exit(1); - } - - // If we do have an error handler, we can report the error and keep going. - SMDiagnostic Diag("", SourceMgr::DK_Error, ErrorStr.str()); - - pImpl->InlineAsmDiagHandler(Diag, pImpl->InlineAsmDiagContext, LocCookie); + diagnose(DiagnosticInfoInlineAsm(LocCookie, ErrorStr)); } //===----------------------------------------------------------------------===// |