summaryrefslogtreecommitdiffstats
path: root/clang/test/Frontend/backend-diagnostic.c
diff options
context:
space:
mode:
authorQuentin Colombet <qcolombet@apple.com>2014-02-06 18:30:43 +0000
committerQuentin Colombet <qcolombet@apple.com>2014-02-06 18:30:43 +0000
commit728c5540eef2622fa30c0ca42727b111ff182ce1 (patch)
tree136c98799cabc697c5b47250441ac7a500ff36a6 /clang/test/Frontend/backend-diagnostic.c
parent9c0b64c92d5e0bbd94f4ebde94eaac76df34cfaf (diff)
downloadbcm5719-llvm-728c5540eef2622fa30c0ca42727b111ff182ce1.tar.gz
bcm5719-llvm-728c5540eef2622fa30c0ca42727b111ff182ce1.zip
Wired-up the new LLVM diagnostic system into clang diagnostic system.
The approach is similar to the existing inline-asm reporting, just more general. <rdar://problem/15886278> llvm-svn: 200931
Diffstat (limited to 'clang/test/Frontend/backend-diagnostic.c')
-rw-r--r--clang/test/Frontend/backend-diagnostic.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/clang/test/Frontend/backend-diagnostic.c b/clang/test/Frontend/backend-diagnostic.c
new file mode 100644
index 00000000000..acb15f27d1a
--- /dev/null
+++ b/clang/test/Frontend/backend-diagnostic.c
@@ -0,0 +1,34 @@
+// REQUIRES: x86-registered-target
+// Play around with backend reporting:
+// _REGULAR_: Regular behavior, no warning switch enabled.
+// _PROMOTE_: Promote warning to error.
+// _IGNORE_: Drop backend warning.
+//
+// RUN: not %clang_cc1 %s -mllvm -warn-stack-size=0 -S -o - -triple=i386-apple-darwin 2> %t.err
+// RUN: FileCheck < %t.err %s --check-prefix=REGULAR --check-prefix=ASM
+// RUN: not %clang_cc1 %s -mllvm -warn-stack-size=0 -S -o - -triple=i386-apple-darwin -Werror=frame-larger-than 2> %t.err
+// RUN: FileCheck < %t.err %s --check-prefix=PROMOTE --check-prefix=ASM
+// RUN: not %clang_cc1 %s -mllvm -warn-stack-size=0 -S -o - -triple=i386-apple-darwin -Wno-frame-larger-than 2> %t.err
+// RUN: FileCheck < %t.err %s --check-prefix=IGNORE --check-prefix=ASM
+//
+// Currently the stack size reporting cannot be checked with -verify because
+// no source location is attached to the diagnostic. Therefore do not emit
+// them for the -verify test for now.
+// RUN: %clang_cc1 %s -S -o - -triple=i386-apple-darwin -verify
+
+extern void doIt(char *);
+
+// REGULAR: warning: stack size exceeded ({{[0-9]+}}) in stackSizeWarning
+// PROMOTE: error: stack size exceeded ({{[0-9]+}}) in stackSizeWarning
+// IGNORE-NOT: stack size exceeded ({{[0-9]+}}) in stackSizeWarning
+void stackSizeWarning() {
+ char buffer[80];
+ doIt(buffer);
+}
+
+// ASM: inline assembly requires more registers than available
+void inlineAsmError(int x0, int x1, int x2, int x3, int x4,
+ int x5, int x6, int x7, int x8, int x9) {
+ __asm__("hello world": : "r" (x0),"r" (x1),"r" (x2),"r" (x3), // expected-error + {{inline assembly requires more registers than available}}
+ "r" (x4),"r" (x5),"r" (x6),"r" (x7),"r" (x8),"r" (x9));
+}
OpenPOWER on IntegriCloud