diff options
Diffstat (limited to 'test/CodeGen')
-rw-r--r-- | test/CodeGen/attributes.c | 2 | ||||
-rw-r--r-- | test/CodeGen/stack-protector.c | 22 | ||||
-rw-r--r-- | test/CodeGen/unwind-attr.c | 4 |
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) { } |