summaryrefslogtreecommitdiff
path: root/test/CodeGen
diff options
context:
space:
mode:
authorEd Schouten <ed@FreeBSD.org>2009-07-04 13:58:54 +0000
committerEd Schouten <ed@FreeBSD.org>2009-07-04 13:58:54 +0000
commit5362a71c02e7d448a8ce98cf00c47e353fba5d04 (patch)
tree8ddfe382e1c6d590dc240e76f7cd45cea5c78e24 /test/CodeGen
parent4ebdf5c4f587daef4e0be499802eac3a7a49bf2f (diff)
Notes
Diffstat (limited to 'test/CodeGen')
-rw-r--r--test/CodeGen/attributes.c2
-rw-r--r--test/CodeGen/stack-protector.c22
-rw-r--r--test/CodeGen/unwind-attr.c4
3 files changed, 25 insertions, 3 deletions
diff --git a/test/CodeGen/attributes.c b/test/CodeGen/attributes.c
index a5de4f4b42a2..8f157f3d314b 100644
--- a/test/CodeGen/attributes.c
+++ b/test/CodeGen/attributes.c
@@ -60,7 +60,7 @@ int t17() {
extern int t18 __attribute__((weak_import));
int t18 = 1;
-// RUN: grep 'define i[0-9]* @t19() nounwind {' %t &&
+// RUN: grep 'define i[0-9]* @t19()' %t &&
extern int t19(void) __attribute__((weak_import));
int t19(void) {
return 10;
diff --git a/test/CodeGen/stack-protector.c b/test/CodeGen/stack-protector.c
new file mode 100644
index 000000000000..bdac853aed62
--- /dev/null
+++ b/test/CodeGen/stack-protector.c
@@ -0,0 +1,22 @@
+// RUN: clang-cc -triple i686-unknown-unknown -emit-llvm -o %t %s &&
+// RUN: not grep 'ssp' %t &&
+// RUN: clang-cc -triple i686-apple-darwin9 -emit-llvm -o %t %s &&
+// RUN: not grep 'ssp' %t &&
+// RUN: clang-cc -triple i686-apple-darwin10 -emit-llvm -o %t %s &&
+// RUN: grep 'ssp' %t &&
+// RUN: clang -fstack-protector-all -emit-llvm -S -o %t %s &&
+// RUN: grep 'sspreq' %t &&
+// RUN: clang -fstack-protector -emit-llvm -S -o %t %s &&
+// RUN: grep 'ssp' %t &&
+// RUN: clang -fno-stack-protector -emit-llvm -S -o %t %s &&
+// RUN: not grep 'ssp' %t &&
+// RUN: true
+
+#include <stdio.h>
+#include <string.h>
+
+void test1(const char *msg) {
+ char a[strlen(msg) + 1];
+ strcpy(a, msg);
+ printf("%s\n", a);
+}
diff --git a/test/CodeGen/unwind-attr.c b/test/CodeGen/unwind-attr.c
index b2890c4c10de..4954a0b59ce4 100644
--- a/test/CodeGen/unwind-attr.c
+++ b/test/CodeGen/unwind-attr.c
@@ -1,5 +1,5 @@
-// RUN: clang-cc -fexceptions -emit-llvm -o - %s | grep "@foo() {" | count 1 &&
-// RUN: clang-cc -emit-llvm -o - %s | grep "@foo() nounwind {" | count 1
+// RUN: clang-cc -fexceptions -emit-llvm -o - %s | grep "@foo()" | not grep nounwind &&
+// RUN: clang-cc -emit-llvm -o - %s | grep "@foo()" | grep nounwind
int foo(void) {
}