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