r210286 - When an inline-asm diagnostic is reported by the backend, report it with the
Joey Gouly
joey.gouly at gmail.com
Thu Jun 5 14:23:42 PDT 2014
Author: joey
Date: Thu Jun 5 16:23:42 2014
New Revision: 210286
URL: http://llvm.org/viewvc/llvm-project?rev=210286&view=rev
Log:
When an inline-asm diagnostic is reported by the backend, report it with the
correct severity.
Previously all inline-asm diagnostics were reported as errors.
Added:
cfe/trunk/test/CodeGen/arm-asm-deprecated.c
cfe/trunk/test/CodeGen/x86-64-inline-asm.c
Modified:
cfe/trunk/lib/CodeGen/CodeGenAction.cpp
Modified: cfe/trunk/lib/CodeGen/CodeGenAction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenAction.cpp?rev=210286&r1=210285&r2=210286&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenAction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenAction.cpp Thu Jun 5 16:23:42 2014
@@ -297,13 +297,24 @@ void BackendConsumer::InlineAsmDiagHandl
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;
+ }
// 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
+ // issue in the source with a note showing the instantiated
// code.
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);
@@ -319,10 +330,10 @@ void BackendConsumer::InlineAsmDiagHandl
return;
}
- // 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
+ // Otherwise, report the backend issue as occurring in the generated .s file.
+ // If Loc is invalid, we still need to report the issue, it just gets no
// location info.
- Diags.Report(Loc, diag::err_fe_inline_asm).AddString(Message);
+ Diags.Report(Loc, DiagID).AddString(Message);
}
#define ComputeDiagID(Severity, GroupName, DiagID) \
Added: cfe/trunk/test/CodeGen/arm-asm-deprecated.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/arm-asm-deprecated.c?rev=210286&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/arm-asm-deprecated.c (added)
+++ cfe/trunk/test/CodeGen/arm-asm-deprecated.c Thu Jun 5 16:23:42 2014
@@ -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
+}
Added: cfe/trunk/test/CodeGen/x86-64-inline-asm.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/x86-64-inline-asm.c?rev=210286&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/x86-64-inline-asm.c (added)
+++ cfe/trunk/test/CodeGen/x86-64-inline-asm.c Thu Jun 5 16:23:42 2014
@@ -0,0 +1,7 @@
+// REQUIRES: x86-registered-target
+// RUN: %clang_cc1 -triple x86_64 %s -S -o /dev/null 2>&1 | FileCheck %s
+// RUN: not %clang_cc1 -triple x86_64 %s -S -o /dev/null -Werror 2>&1 | FileCheck %s --check-prefix=CHECK-Werror
+void f() {
+ asm("movaps %xmm3, (%esi, 2)"); // CHECK: warning: scale factor without index register is ignored
+ // CHECK-Werror: error: scale factor without index register is ignored
+}
More information about the cfe-commits
mailing list