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=SSPREQ %s
      6 // SSPREQ: define void @test1(i8* %msg) #0 {
      7 
      8 typedef __SIZE_TYPE__ size_t;
      9 
     10 int printf(const char * _Format, ...);
     11 size_t strlen(const char *s);
     12 char *strcpy(char *s1, const char *s2);
     13 
     14 void test1(const char *msg) {
     15   char a[strlen(msg) + 1];
     16   strcpy(a, msg);
     17   printf("%s\n", a);
     18 }
     19 
     20 // NOSSP: attributes #{{.*}} = { nounwind{{.*}} }
     21 
     22 // WITHSSP: attributes #{{.*}} = { nounwind ssp{{.*}} }
     23 
     24 // SSPREQ: attributes #{{.*}} = { nounwind sspreq{{.*}} }
     25