John Brawn | 8e62db3 | 2016-04-04 14:22:58 +0000 | [diff] [blame] | 1 | // RUN: %clang -fplugin=%llvmshlibdir/AnnotateFunctions%pluginext -emit-llvm -DPRAGMA_ON -S %s -o - | FileCheck %s --check-prefix=PRAGMA |
| 2 | // RUN: %clang -fplugin=%llvmshlibdir/AnnotateFunctions%pluginext -emit-llvm -S %s -o - | FileCheck %s --check-prefix=NOPRAGMA |
| 3 | // RUN: not %clang -fplugin=%llvmshlibdir/AnnotateFunctions%pluginext -emit-llvm -DBAD_PRAGMA -S %s -o - 2>&1 | FileCheck %s --check-prefix=BADPRAGMA |
John Brawn | 6c78974 | 2016-03-15 12:51:40 +0000 | [diff] [blame] | 4 | // REQUIRES: plugins, examples |
| 5 | |
John Brawn | 8e62db3 | 2016-04-04 14:22:58 +0000 | [diff] [blame] | 6 | #ifdef PRAGMA_ON |
| 7 | #pragma enable_annotate |
| 8 | #endif |
| 9 | |
| 10 | // BADPRAGMA: warning: extra tokens at end of #pragma directive |
| 11 | #ifdef BAD_PRAGMA |
| 12 | #pragma enable_annotate something |
| 13 | #endif |
| 14 | |
| 15 | // PRAGMA: [[STR_VAR:@.+]] = private unnamed_addr constant [19 x i8] c"example_annotation\00" |
| 16 | // PRAGMA: @llvm.global.annotations = {{.*}}@fn1{{.*}}[[STR_VAR]]{{.*}}@fn2{{.*}}[[STR_VAR]] |
| 17 | // NOPRAGMA-NOT: [[STR_VAR:@.+]] = private unnamed_addr constant [19 x i8] c"example_annotation\00" |
| 18 | // NOPRAGMA-NOT: @llvm.global.annotations = {{.*}}@fn1{{.*}}[[STR_VAR]]{{.*}}@fn2{{.*}}[[STR_VAR]] |
John Brawn | 6c78974 | 2016-03-15 12:51:40 +0000 | [diff] [blame] | 19 | void fn1() { } |
| 20 | void fn2() { } |
John Brawn | 8e62db3 | 2016-04-04 14:22:58 +0000 | [diff] [blame] | 21 | |
| 22 | // BADPRAGMA: error: #pragma enable_annotate not allowed after declarations |
| 23 | #ifdef BAD_PRAGMA |
| 24 | #pragma enable_annotate |
| 25 | #endif |