diff options
author | Jonathan Coe <jbcoe@me.com> | 2017-10-16 23:43:02 +0000 |
---|---|---|
committer | Jonathan Coe <jbcoe@me.com> | 2017-10-16 23:43:02 +0000 |
commit | 11e6fda273d7519bacf13475a98ecba6c41968b1 (patch) | |
tree | 8f1a2e87ee8240814c130acf831aeea60c7725c5 /tools | |
parent | 551dc900ed276189569f3d814a3a5c540bab2fc6 (diff) |
[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
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@315958 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r-- | tools/libclang/CIndex.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp index 3921c055b8..fa3b970855 100644 --- a/tools/libclang/CIndex.cpp +++ b/tools/libclang/CIndex.cpp @@ -907,7 +907,8 @@ bool CursorVisitor::VisitFunctionTemplateDecl(FunctionTemplateDecl *D) { if (VisitTemplateParameters(D->getTemplateParameters())) return true; - return VisitFunctionDecl(D->getTemplatedDecl()); + auto* FD = D->getTemplatedDecl(); + return VisitAttributes(FD) || VisitFunctionDecl(FD); } bool CursorVisitor::VisitClassTemplateDecl(ClassTemplateDecl *D) { @@ -916,7 +917,8 @@ bool CursorVisitor::VisitClassTemplateDecl(ClassTemplateDecl *D) { if (VisitTemplateParameters(D->getTemplateParameters())) return true; - return VisitCXXRecordDecl(D->getTemplatedDecl()); + auto* CD = D->getTemplatedDecl(); + return VisitAttributes(CD) || VisitCXXRecordDecl(CD); } bool CursorVisitor::VisitTemplateTemplateParmDecl(TemplateTemplateParmDecl *D) { |