aboutsummaryrefslogtreecommitdiff
path: root/clang/test/CodeGen/WebAssembly
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/CodeGen/WebAssembly')
-rw-r--r--clang/test/CodeGen/WebAssembly/musttail.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/clang/test/CodeGen/WebAssembly/musttail.c b/clang/test/CodeGen/WebAssembly/musttail.c
new file mode 100644
index 0000000..37fed70
--- /dev/null
+++ b/clang/test/CodeGen/WebAssembly/musttail.c
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 %s -triple wasm32-unknown-unknown -target-feature +tail-call -o /dev/null -emit-llvm -verify=tail
+// RUN: %clang_cc1 %s -triple wasm32-unknown-unknown -o /dev/null -emit-llvm -verify=notail
+
+int foo(int x) {
+ return x;
+}
+
+#if __has_attribute(musttail)
+// tail-warning@+1 {{HAS IT}}
+#warning HAS IT
+#else
+// notail-warning@+1 {{DOES NOT HAVE}}
+#warning DOES NOT HAVE
+#endif
+
+int bar(int x)
+{
+ // notail-warning@+1 {{unknown attribute 'clang::musttail' ignored}}
+ [[clang::musttail]] return foo(1);
+}