annotate-attribute.cpp 1.5 KB

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