[PATCH] When producing an InlineAsm warning, don't automatically promote it to an error
Alp Toker
alp at nuanti.com
Thu Jun 5 12:53:36 PDT 2014
On 05/06/2014 21:59, Joey Gouly wrote:
> Pretty much as the title says. Just make sure we pick the right diagnostic according to the diagnostic produced by the backend.
Cool.
>
> http://reviews.llvm.org/D4036
>
> Files:
> lib/CodeGen/CodeGenAction.cpp
> test/CodeGen/arm-asm-deprecated.c
>
> Index: lib/CodeGen/CodeGenAction.cpp
> ===================================================================
> --- lib/CodeGen/CodeGenAction.cpp
> +++ lib/CodeGen/CodeGenAction.cpp
> @@ -297,13 +297,24 @@
> FullSourceLoc Loc;
> if (D.getLoc() != SMLoc())
> Loc = ConvertBackendLocation(D, Context->getSourceManager());
> -
>
> + unsigned DiagID;
> + switch (D.getKind()) {
> + case llvm::SourceMgr::DK_Error:
> + DiagID = diag::err_fe_inline_asm;
> + break;
> + case llvm::SourceMgr::DK_Warning:
> + DiagID = diag::warn_fe_inline_asm;
> + break;
> + case llvm::SourceMgr::DK_Note:
> + DiagID = diag::note_fe_inline_asm;
> + break;
> + }
It's a shame we can't use the crummy ComputeDiagID() macro. Hopefully
this will all become consistent at some point.
> // 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.
s/ as being an error//
> if (LocCookie.isValid()) {
> - Diags.Report(LocCookie, diag::err_fe_inline_asm).AddString(Message);
> + Diags.Report(LocCookie, DiagID).AddString(Message);
>
> if (D.getLoc().isValid()) {
> DiagnosticBuilder B = Diags.Report(Loc, diag::note_fe_inline_asm_here);
> @@ -322,7 +333,7 @@
> // Otherwise, report the backend error as occurring in the generated .s file.
> // If Loc is invalid, we still need to report the error, it just gets no
> // location info.
s/error/issue/g
> - Diags.Report(Loc, diag::err_fe_inline_asm).AddString(Message);
> + Diags.Report(Loc, DiagID).AddString(Message);
> }
>
> #define ComputeDiagID(Severity, GroupName, DiagID) \
> Index: test/CodeGen/arm-asm-deprecated.c
> ===================================================================
> --- test/CodeGen/arm-asm-deprecated.c
> +++ test/CodeGen/arm-asm-deprecated.c
> @@ -0,0 +1,8 @@
> +// REQUIRES: arm-registered-target
> +// RUN: %clang_cc1 -triple armv8 -target-feature +neon %s -S -o /dev/null 2>&1 | FileCheck %s --check-prefix=CHECK-v8
> +// RUN: not %clang_cc1 -triple armv8 -target-feature +neon %s -S -o /dev/null -Werror 2>&1 | FileCheck %s --check-prefix=CHECK-v8-Werror
> +
> +void set_endian() {
> + asm("setend be"); // CHECK-v8: warning: deprecated
> + // CHECK-v8-Werror: error: deprecated
> +}
Can you provide an x86 test instead/as well? Frontend folk tend to
enable only the native workstation backend and would appreciate having
some coverage.
Alp.
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
--
http://www.nuanti.com
the browser experts
More information about the cfe-commits
mailing list