aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGen/stack-protector.c
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2016-07-23 20:44:14 +0000
committerDimitry Andric <dim@FreeBSD.org>2016-07-23 20:44:14 +0000
commit2b6b257f4e5503a7a2675bdb8735693db769f75c (patch)
treee85e046ae7003fe3bcc8b5454cd0fa3f7407b470 /test/CodeGen/stack-protector.c
parentb4348ed0b7e90c0831b925fbee00b5f179a99796 (diff)
Notes
Diffstat (limited to 'test/CodeGen/stack-protector.c')
-rw-r--r--test/CodeGen/stack-protector.c37
1 files changed, 20 insertions, 17 deletions
diff --git a/test/CodeGen/stack-protector.c b/test/CodeGen/stack-protector.c
index ecfbc90faa28..7a45a2f4acf6 100644
--- a/test/CodeGen/stack-protector.c
+++ b/test/CodeGen/stack-protector.c
@@ -1,13 +1,13 @@
-// RUN: %clang_cc1 -emit-llvm -o - %s -stack-protector 0 | FileCheck -check-prefix=NOSSP %s
-// NOSSP: define {{.*}}void @test1(i8* %msg) #0 {
-// RUN: %clang_cc1 -emit-llvm -o - %s -stack-protector 1 | FileCheck -check-prefix=WITHSSP %s
-// WITHSSP: define {{.*}}void @test1(i8* %msg) #0 {
-// RUN: %clang_cc1 -emit-llvm -o - %s -stack-protector 2 | FileCheck -check-prefix=SSPSTRONG %s
-// SSPSTRONG: define {{.*}}void @test1(i8* %msg) #0 {
-// RUN: %clang_cc1 -emit-llvm -o - %s -stack-protector 3 | FileCheck -check-prefix=SSPREQ %s
-// SSPREQ: define {{.*}}void @test1(i8* %msg) #0 {
-// RUN: %clang_cc1 -emit-llvm -o - %s -fsanitize=safe-stack | FileCheck -check-prefix=SAFESTACK %s
-// SAFESTACK: define {{.*}}void @test1(i8* %msg) #0 {
+// RUN: %clang_cc1 -emit-llvm -o - %s -stack-protector 0 | FileCheck -check-prefix=DEF -check-prefix=NOSSP %s
+// RUN: %clang_cc1 -emit-llvm -o - %s -stack-protector 1 | FileCheck -check-prefix=DEF -check-prefix=SSP %s
+// RUN: %clang_cc1 -emit-llvm -o - %s -stack-protector 2 | FileCheck -check-prefix=DEF -check-prefix=SSPSTRONG %s
+// RUN: %clang_cc1 -emit-llvm -o - %s -stack-protector 3 | FileCheck -check-prefix=DEF -check-prefix=SSPREQ %s
+
+// RUN: %clang_cc1 -emit-llvm -o - %s -fsanitize=safe-stack | FileCheck -check-prefix=DEF -check-prefix=SAFESTACK-NOSSP %s
+// RUN: %clang_cc1 -emit-llvm -o - %s -fsanitize=safe-stack -stack-protector 0 | FileCheck -check-prefix=DEF -check-prefix=SAFESTACK-NOSSP %s
+// RUN: %clang_cc1 -emit-llvm -o - %s -fsanitize=safe-stack -stack-protector 1 | FileCheck -check-prefix=DEF -check-prefix=SAFESTACK-SSP %s
+// RUN: %clang_cc1 -emit-llvm -o - %s -fsanitize=safe-stack -stack-protector 2 | FileCheck -check-prefix=DEF -check-prefix=SAFESTACK-SSPSTRONG %s
+// RUN: %clang_cc1 -emit-llvm -o - %s -fsanitize=safe-stack -stack-protector 3 | FileCheck -check-prefix=DEF -check-prefix=SAFESTACK-SSPREQ %s
typedef __SIZE_TYPE__ size_t;
@@ -15,18 +15,21 @@ int printf(const char * _Format, ...);
size_t strlen(const char *s);
char *strcpy(char *s1, const char *s2);
+// DEF: define {{.*}}void @test1(i8* %msg) #[[A:.*]] {
void test1(const char *msg) {
char a[strlen(msg) + 1];
strcpy(a, msg);
printf("%s\n", a);
}
-// NOSSP: attributes #{{.*}} = { nounwind{{.*}} }
-
-// WITHSSP: attributes #{{.*}} = { nounwind ssp{{.*}} }
-
-// SSPSTRONG: attributes #{{.*}} = { nounwind sspstrong{{.*}} }
+// NOSSP-NOT: attributes #[[A]] = {{.*}} ssp
+// SSP: attributes #[[A]] = {{.*}} ssp{{ }}
+// SSPSTRONG: attributes #[[A]] = {{.*}} sspstrong
+// SSPREQ: attributes #[[A]] = {{.*}} sspreq
-// SSPREQ: attributes #{{.*}} = { nounwind sspreq{{.*}} }
+// SAFESTACK-NOSSP: attributes #[[A]] = {{.*}} safestack
+// SAFESTACK-NOSSP-NOT: ssp
-// SAFESTACK: attributes #{{.*}} = { nounwind safestack{{.*}} }
+// SAFESTACK-SSP: attributes #[[A]] = {{.*}} safestack ssp{{ }}
+// SAFESTACK-SSPSTRONG: attributes #[[A]] = {{.*}} safestack sspstrong
+// SAFESTACK-SSPREQ: attributes #[[A]] = {{.*}} safestack sspreq