Home | History | Annotate | Download | only in CodeGen
      1 // RUN: %clang_cc1 -emit-llvm -o - %s -stack-protector 0 | FileCheck -check-prefix=NOSSP %s
      2 // NOSSP: define void @test1(i8* %msg) #0 {
      3 // RUN: %clang_cc1 -emit-llvm -o - %s -stack-protector 1 | FileCheck -check-prefix=WITHSSP %s
      4 // WITHSSP: define void @test1(i8* %msg) #0 {
      5 // RUN: %clang_cc1 -emit-llvm -o - %s -stack-protector 2 | FileCheck -check-prefix=SSPSTRONG %s
      6 // SSPSTRONG: define void @test1(i8* %msg) #0 {
      7 // RUN: %clang_cc1 -emit-llvm -o - %s -stack-protector 3 | FileCheck -check-prefix=SSPREQ %s
      8 // SSPREQ: define void @test1(i8* %msg) #0 {
      9 
     10 typedef __SIZE_TYPE__ size_t;
     11 
     12 int printf(const char * _Format, ...);
     13 size_t strlen(const char *s);
     14 char *strcpy(char *s1, const char *s2);
     15 
     16 void test1(const char *msg) {
     17   char a[strlen(msg) + 1];
     18   strcpy(a, msg);
     19   printf("%s\n", a);
     20 }
     21 
     22 // NOSSP: attributes #{{.*}} = { nounwind{{.*}} }
     23 
     24 // WITHSSP: attributes #{{.*}} = { nounwind ssp{{.*}} }
     25 
     26 // SSPSTRONG: attributes #{{.*}} = { nounwind sspstrong{{.*}} }
     27 
     28 // SSPREQ: attributes #{{.*}} = { nounwind sspreq{{.*}} }
     29