[llvm] r201915 - Switch the LLVM error reporting on the new diagnostic system.
Quentin Colombet
qcolombet at apple.com
Fri Feb 21 16:34:11 PST 2014
Author: qcolombet
Date: Fri Feb 21 18:34:11 2014
New Revision: 201915
URL: http://llvm.org/viewvc/llvm-project?rev=201915&view=rev
Log:
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>
Modified:
llvm/trunk/lib/IR/LLVMContext.cpp
Modified: llvm/trunk/lib/IR/LLVMContext.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/LLVMContext.cpp?rev=201915&r1=201914&r2=201915&view=diff
==============================================================================
--- llvm/trunk/lib/IR/LLVMContext.cpp (original)
+++ llvm/trunk/lib/IR/LLVMContext.cpp Fri Feb 21 18:34:11 2014
@@ -115,17 +115,12 @@ void *LLVMContext::getDiagnosticContext(
}
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 Diagnos
}
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));
}
//===----------------------------------------------------------------------===//
More information about the llvm-commits
mailing list