18e62db32SJohn Brawn // RUN: %clang -fplugin=%llvmshlibdir/AnnotateFunctions%pluginext -emit-llvm -DPRAGMA_ON -S %s -o - | FileCheck %s --check-prefix=PRAGMA
28e62db32SJohn Brawn // RUN: %clang -fplugin=%llvmshlibdir/AnnotateFunctions%pluginext -emit-llvm -S %s -o - | FileCheck %s --check-prefix=NOPRAGMA
38e62db32SJohn Brawn // RUN: not %clang -fplugin=%llvmshlibdir/AnnotateFunctions%pluginext -emit-llvm -DBAD_PRAGMA -S %s -o - 2>&1 | FileCheck %s --check-prefix=BADPRAGMA
46c78974bSJohn Brawn // REQUIRES: plugins, examples
56c78974bSJohn Brawn 
68e62db32SJohn Brawn #ifdef PRAGMA_ON
78e62db32SJohn Brawn #pragma enable_annotate
88e62db32SJohn Brawn #endif
98e62db32SJohn Brawn 
108e62db32SJohn Brawn // BADPRAGMA: warning: extra tokens at end of #pragma directive
118e62db32SJohn Brawn #ifdef BAD_PRAGMA
128e62db32SJohn Brawn #pragma enable_annotate something
138e62db32SJohn Brawn #endif
148e62db32SJohn Brawn 
158e62db32SJohn Brawn // PRAGMA: [[STR_VAR:@.+]] = private unnamed_addr constant [19 x i8] c"example_annotation\00"
168e62db32SJohn Brawn // PRAGMA: @llvm.global.annotations = {{.*}}@fn1{{.*}}[[STR_VAR]]{{.*}}@fn2{{.*}}[[STR_VAR]]
17*5f02c308SJohn Brawn // NOPRAGMA-NOT: {{@.+}} = private unnamed_addr constant [19 x i8] c"example_annotation\00"
18*5f02c308SJohn Brawn // NOPRAGMA-NOT: @llvm.global.annotations = {{.*}}
fn1()196c78974bSJohn Brawn void fn1() { }
fn2()206c78974bSJohn Brawn void fn2() { }
218e62db32SJohn Brawn 
228e62db32SJohn Brawn // BADPRAGMA: error: #pragma enable_annotate not allowed after declarations
238e62db32SJohn Brawn #ifdef BAD_PRAGMA
248e62db32SJohn Brawn #pragma enable_annotate
258e62db32SJohn Brawn #endif
26