Author: lattner Date: Mon Jun 14 19:03:12 2010 New Revision: 105978 URL: http://llvm.org/viewvc/llvm-project?rev=105978&view=rev Log: fix the inline asm diagnostics to emit the error on the primary source code location instead of on the note. Previously we generated:
<inline asm>:1:2: error: unrecognized instruction barf ^ t.c:4:8: note: generated from here asm ("barf"); ^ Now we generate: t.c:4:8: error: unrecognized instruction asm ("barf"); ^ <inline asm>:1:2: note: instantated into assembly here barf ^ Modified: cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td cfe/trunk/lib/Frontend/CodeGenAction.cpp Modified: cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td?rev=105978&r1=105977&r2=105978&view=diff ============================================================================== --- cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td (original) +++ cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td Mon Jun 14 19:03:12 2010 @@ -18,7 +18,10 @@ DefaultFatal; // Error generated by the backend. def err_fe_inline_asm : Error<"%0">, CatInlineAsm; -def note_fe_inline_asm_here : Note<"generated from here">; +def note_fe_inline_asm_here : Note<"instantated into assembly here">; + + + def err_fe_invalid_code_complete_file : Error< "cannot locate code-completion file %0">, DefaultFatal; def err_fe_stdout_binary : Error<"unable to change standard output to binary">, Modified: cfe/trunk/lib/Frontend/CodeGenAction.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CodeGenAction.cpp?rev=105978&r1=105977&r2=105978&view=diff ============================================================================== --- cfe/trunk/lib/Frontend/CodeGenAction.cpp (original) +++ cfe/trunk/lib/Frontend/CodeGenAction.cpp Mon Jun 14 19:03:12 2010 @@ -200,19 +200,28 @@ if (Message.startswith("error: ")) Message = Message.substr(7); - // There are two cases: the SMDiagnostic could have a inline asm source - // location or it might not. If it does, translate the location. + // If the SMDiagnostic has an inline asm source location, translate it. FullSourceLoc Loc; if (D.getLoc() != SMLoc()) Loc = ConvertBackendLocation(D, Context->getSourceManager()); - Diags.Report(Loc, diag::err_fe_inline_asm).AddString(Message); + - // This could be a problem with no clang-level source location information. - // In this case, LocCookie is invalid. If there is source level information, - // print an "generated from" note. - if (LocCookie.isValid()) + // If this problem has clang-level source location information, report the + // issue as being an error in the source with a note showing the instantiated + // code. + if (LocCookie.isValid()) { Diags.Report(FullSourceLoc(LocCookie, Context->getSourceManager()), - diag::note_fe_inline_asm_here); + diag::err_fe_inline_asm).AddString(Message); + + if (D.getLoc().isValid()) + Diags.Report(Loc, diag::note_fe_inline_asm_here); + return; + } + + // Otherwise, report the backend error as occuring in the generated .s file. + // If Loc is invalid, we still need to report the error, it just gets no + // location info. + Diags.Report(Loc, diag::err_fe_inline_asm).AddString(Message); } // _______________________________________________ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits