Home | History | Annotate | Download | only in CodeGen
      1 // RUN: %clang_cc1 -S -emit-llvm -o - -fsanitize=address,use-after-scope %s \
      2 // RUN:     | FileCheck %s -check-prefix=USE-AFTER-SCOPE
      3 // RUN: %clang_cc1 -S -emit-llvm -o - -fsanitize=address %s \
      4 // RUN:     | FileCheck %s -check-prefix=ADDRESS-ONLY
      5 
      6 extern int bar(char *A, int n);
      7 
      8 // ADDRESS-ONLY-NOT: @llvm.lifetime.start
      9 int foo (int n) {
     10   if (n) {
     11     // USE-AFTER-SCOPE: @llvm.lifetime.start(i64 10, i8* {{.*}})
     12     char A[10];
     13     return bar(A, 1);
     14     // USE-AFTER-SCOPE: @llvm.lifetime.end(i64 10, i8* {{.*}})
     15   } else {
     16     // USE-AFTER-SCOPE: @llvm.lifetime.start(i64 20, i8* {{.*}})
     17     char A[20];
     18     return bar(A, 2);
     19     // USE-AFTER-SCOPE: @llvm.lifetime.end(i64 20, i8* {{.*}})
     20   }
     21 }
     22 
     23