sanwou01 updated this revision to Diff 88188.
sanwou01 added a comment.

Use clang_cc1 -verify for testing as suggested by @rnk.

@echristo, llc does use the same diags interfaces as clang, however, it is
lacking the infrastructure to make use of LocCookies.

In any case, I think this test is useful to prevent regressions in inline
assembly diagnostics in clang.


https://reviews.llvm.org/D29770

Files:
  test/Misc/inline-asm-diags.c


Index: test/Misc/inline-asm-diags.c
===================================================================
--- /dev/null
+++ test/Misc/inline-asm-diags.c
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -S -emit-obj -triple armv7a-arm-none-eabi %s -o /dev/null 
-verify
+
+void foo2() {
+       asm(" wibble"); // expected-error{{invalid instruction}}
+}
+
+void foo() {
+       asm(" .word -bar");  // expected-error {{expected relocatable 
expression}}
+       asm(" .word -foo");  // expected-error {{expected relocatable 
expression}}
+}
+
+// expected-note@1 {{instantiated into assembly here}}
+// expected-note@1 {{instantiated into assembly here}}
+// expected-note@1 {{instantiated into assembly here}}


Index: test/Misc/inline-asm-diags.c
===================================================================
--- /dev/null
+++ test/Misc/inline-asm-diags.c
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -S -emit-obj -triple armv7a-arm-none-eabi %s -o /dev/null -verify
+
+void foo2() {
+	asm(" wibble"); // expected-error{{invalid instruction}}
+}
+
+void foo() {
+	asm(" .word -bar");  // expected-error {{expected relocatable expression}}
+	asm(" .word -foo");  // expected-error {{expected relocatable expression}}
+}
+
+// expected-note@1 {{instantiated into assembly here}}
+// expected-note@1 {{instantiated into assembly here}}
+// expected-note@1 {{instantiated into assembly here}}
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to