summaryrefslogtreecommitdiffstats
path: root/clang/test/Index
diff options
context:
space:
mode:
authorJonathan Coe <jbcoe@me.com>2017-10-16 23:43:02 +0000
committerJonathan Coe <jbcoe@me.com>2017-10-16 23:43:02 +0000
commit578ac7a2ec4a772f97d9cb566c95764ff3d41625 (patch)
treec431daa18e6558c1044c44141ecedb71ede65bc2 /clang/test/Index
parent4e3d6160db325ce5ba18be99eda2c3555e58609a (diff)
downloadbcm5719-llvm-578ac7a2ec4a772f97d9cb566c95764ff3d41625.tar.gz
bcm5719-llvm-578ac7a2ec4a772f97d9cb566c95764ff3d41625.zip
[libclang] Visit attributes for function and class templates
Summary: Previously, `VisitAttributes` was not called for function and class templates and thus their attributes were not accessible using libclang. Reviewers: bkramer, arphaman, rsmith, jbcoe Reviewed By: jbcoe Subscribers: cfe-commits Tags: #clang Patch by jklaehn (Johann Klähn) Differential Revision: https://reviews.llvm.org/D36955 llvm-svn: 315958
Diffstat (limited to 'clang/test/Index')
-rw-r--r--clang/test/Index/annotate-attribute.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/test/Index/annotate-attribute.cpp b/clang/test/Index/annotate-attribute.cpp
index d822210e493..bf415fc8fe6 100644
--- a/clang/test/Index/annotate-attribute.cpp
+++ b/clang/test/Index/annotate-attribute.cpp
@@ -16,6 +16,12 @@ protected:
void methodWithoutAttribute();
};
+template <typename T>
+class __attribute__((annotate("works"))) TemplateTest {};
+
+template <typename T>
+int templateFunction(T value) __attribute__((annotate("works")));
+
// CHECK: ClassDecl=Test:3:7 (Definition) Extent=[3:1 - 17:2]
// CHECK-NEXT: CXXAccessSpecifier=:4:1 (Definition) Extent=[4:1 - 4:8]
// CHECK-NEXT: CXXMethod=aMethod:5:51 Extent=[5:3 - 5:60]
@@ -31,3 +37,9 @@ protected:
// CHECK-NEXT: CompoundStmt= Extent=[12:23 - 12:25]
// CHECK-NEXT: CXXAccessSpecifier=:14:1 (Definition) Extent=[14:1 - 14:11]
// CHECK-NEXT: CXXMethod=methodWithoutAttribute:16:8 Extent=[16:3 - 16:32]
+// CHECK: ClassTemplate=TemplateTest:20:42 (Definition) Extent=[19:1 - 20:57]
+// CHECK-NEXT: TemplateTypeParameter=T:19:20 (Definition) Extent=[19:11 - 19:21] [access=public]
+// CHECK-NEXT: attribute(annotate)=works Extent=[20:22 - 20:39]
+// CHECK: FunctionTemplate=templateFunction:23:5 Extent=[22:1 - 23:65]
+// CHECK-NEXT: TemplateTypeParameter=T:22:20 (Definition) Extent=[22:11 - 22:21] [access=public]
+// CHECK-NEXT: attribute(annotate)=works Extent=[23:46 - 23:63]
OpenPOWER on IntegriCloud