summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2018-06-25 18:47:32 +0000
committerSam Clegg <sbc@chromium.org>2018-06-25 18:47:32 +0000
commit6fd7d680b0a6d101cbeb93f16f3e90a14d8c4fe9 (patch)
tree69b2448eff4efc1a85918bf70f39c570da0224e7 /clang/test
parenta46bcbec583b5ac8256c0698efe77d04789e1b92 (diff)
downloadbcm5719-llvm-6fd7d680b0a6d101cbeb93f16f3e90a14d8c4fe9.tar.gz
bcm5719-llvm-6fd7d680b0a6d101cbeb93f16f3e90a14d8c4fe9.zip
[WebAssembly] Add no-prototype attribute to prototype-less C functions
The WebAssembly backend in particular benefits from being able to distinguish between varargs functions (...) and prototype-less C functions. Differential Revision: https://reviews.llvm.org/D48443 llvm-svn: 335510
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/CodeGen/no-prototype.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/clang/test/CodeGen/no-prototype.c b/clang/test/CodeGen/no-prototype.c
new file mode 100644
index 00000000000..6030357b70f
--- /dev/null
+++ b/clang/test/CodeGen/no-prototype.c
@@ -0,0 +1,20 @@
+// REQUIRES: webassembly-registered-target
+// RUN: %clang_cc1 -triple wasm32 -emit-llvm %s -o - | FileCheck %s
+
+int foo();
+
+int bar(int a) {
+ return foo();
+}
+
+int baz() {
+ return foo();
+}
+
+// CHECK: define i32 @bar(i32 %a) [[BAR_ATTR:#[0-9]+]] {
+// CHECK: declare i32 @foo(...) [[FOO_ATTR:#[0-9]+]]
+// CHECK: define i32 @baz() [[BAZ_ATTR:#[0-9]+]] {
+
+// CHECK: attributes [[FOO_ATTR]] = { {{.*}}"no-prototype"{{.*}} }
+// CHECK-NOT: attributes [[BAR_ATTR]] = { {{.*}}"no-prototype"{{.*}} }
+// CHECK-NOT: attributes [[BAZ_ATTR]] = { {{.*}}"no-prototype"{{.*}} }
OpenPOWER on IntegriCloud