xref: /minix3/external/bsd/llvm/dist/clang/test/Index/annotate-attribute.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: c-index-test -test-load-source all %s | FileCheck %s
2*f4a2713aSLionel Sambuc 
3*f4a2713aSLionel Sambuc class Test {
4*f4a2713aSLionel Sambuc public:
5*f4a2713aSLionel Sambuc   __attribute__((annotate("spiffy_method"))) void aMethod();
6*f4a2713aSLionel Sambuc 
7*f4a2713aSLionel Sambuc public __attribute__((annotate("works"))):
8*f4a2713aSLionel Sambuc   void anotherMethod(); // annotation attribute should be propagated.
9*f4a2713aSLionel Sambuc 
10*f4a2713aSLionel Sambuc private __attribute__((annotate("investigations"))):
11*f4a2713aSLionel Sambuc   //propagated annotation should have changed from "works" to "investigations"
inlineMethod()12*f4a2713aSLionel Sambuc   void inlineMethod() {}
13*f4a2713aSLionel Sambuc 
14*f4a2713aSLionel Sambuc protected:
15*f4a2713aSLionel Sambuc   // attribute propagation should have stopped here
16*f4a2713aSLionel Sambuc   void methodWithoutAttribute();
17*f4a2713aSLionel Sambuc };
18*f4a2713aSLionel Sambuc 
19*f4a2713aSLionel Sambuc // CHECK: ClassDecl=Test:3:7 (Definition) Extent=[3:1 - 17:2]
20*f4a2713aSLionel Sambuc // CHECK-NEXT: CXXAccessSpecifier=:4:1 (Definition) Extent=[4:1 - 4:8]
21*f4a2713aSLionel Sambuc // CHECK-NEXT: CXXMethod=aMethod:5:51 Extent=[5:3 - 5:60]
22*f4a2713aSLionel Sambuc // CHECK-NEXT: attribute(annotate)=spiffy_method Extent=[5:18 - 5:43]
23*f4a2713aSLionel Sambuc // CHECK-NEXT: CXXAccessSpecifier=:7:1 (Definition) Extent=[7:1 - 7:43]
24*f4a2713aSLionel Sambuc // CHECK-NEXT: attribute(annotate)=works Extent=[7:23 - 7:40]
25*f4a2713aSLionel Sambuc // CHECK-NEXT: CXXMethod=anotherMethod:8:8 Extent=[8:3 - 8:23]
26*f4a2713aSLionel Sambuc // CHECK-NEXT: attribute(annotate)=works Extent=[7:23 - 7:40]
27*f4a2713aSLionel Sambuc // CHECK-NEXT: CXXAccessSpecifier=:10:1 (Definition) Extent=[10:1 - 10:53]
28*f4a2713aSLionel Sambuc // CHECK-NEXT: attribute(annotate)=investigations Extent=[10:24 - 10:50]
29*f4a2713aSLionel Sambuc // CHECK-NEXT: CXXMethod=inlineMethod:12:8 (Definition) Extent=[12:3 - 12:25]
30*f4a2713aSLionel Sambuc // CHECK-NEXT: attribute(annotate)=investigations Extent=[10:24 - 10:50]
31*f4a2713aSLionel Sambuc // CHECK-NEXT: CompoundStmt= Extent=[12:23 - 12:25]
32*f4a2713aSLionel Sambuc // CHECK-NEXT: CXXAccessSpecifier=:14:1 (Definition) Extent=[14:1 - 14:11]
33*f4a2713aSLionel Sambuc // CHECK-NEXT: CXXMethod=methodWithoutAttribute:16:8 Extent=[16:3 - 16:32]
34