summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-move/ClangMove.cpp
diff options
context:
space:
mode:
authorHaojian Wu <hokein@google.com>2017-05-02 12:15:11 +0000
committerHaojian Wu <hokein@google.com>2017-05-02 12:15:11 +0000
commit03c8963c3222012edad578d5d114f8051ff15990 (patch)
tree46df92cfe3ec42a33fdc2f5ccfe57188aa755e83 /clang-tools-extra/clang-move/ClangMove.cpp
parenta43a8f5c5ed0757caad574ec0567a211b9e67f78 (diff)
downloadbcm5719-llvm-03c8963c3222012edad578d5d114f8051ff15990.tar.gz
bcm5719-llvm-03c8963c3222012edad578d5d114f8051ff15990.zip
[clang-move] Find template class forward declarations more precisely.
Reviewers: ioeric Reviewed By: ioeric Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D32741 llvm-svn: 301914
Diffstat (limited to 'clang-tools-extra/clang-move/ClangMove.cpp')
-rw-r--r--clang-tools-extra/clang-move/ClangMove.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/clang-tools-extra/clang-move/ClangMove.cpp b/clang-tools-extra/clang-move/ClangMove.cpp
index 8dbeaead097..3a44aa3e9da 100644
--- a/clang-tools-extra/clang-move/ClangMove.cpp
+++ b/clang-tools-extra/clang-move/ClangMove.cpp
@@ -504,8 +504,11 @@ void ClangMoveTool::registerMatchers(ast_matchers::MatchFinder *Finder) {
isExpansionInFile(makeAbsolutePath(Context->Spec.OldHeader));
auto InOldCC = isExpansionInFile(makeAbsolutePath(Context->Spec.OldCC));
auto InOldFiles = anyOf(InOldHeader, InOldCC);
- auto ForwardDecls =
- cxxRecordDecl(unless(anyOf(isImplicit(), isDefinition())));
+ auto classTemplateForwardDecls =
+ classTemplateDecl(unless(has(cxxRecordDecl(isDefinition()))));
+ auto ForwardClassDecls = namedDecl(
+ anyOf(cxxRecordDecl(unless(anyOf(isImplicit(), isDefinition()))),
+ classTemplateForwardDecls));
auto TopLevelDecl =
hasDeclContext(anyOf(namespaceDecl(), translationUnitDecl()));
@@ -518,9 +521,8 @@ void ClangMoveTool::registerMatchers(ast_matchers::MatchFinder *Finder) {
// We consider declarations inside a class belongs to the class. So these
// declarations will be ignored.
auto AllDeclsInHeader = namedDecl(
- unless(ForwardDecls), unless(namespaceDecl()),
- unless(usingDirectiveDecl()), // using namespace decl.
- unless(classTemplateDecl(has(ForwardDecls))), // template forward decl.
+ unless(ForwardClassDecls), unless(namespaceDecl()),
+ unless(usingDirectiveDecl()), // using namespace decl.
InOldHeader,
hasParent(decl(anyOf(namespaceDecl(), translationUnitDecl()))),
hasDeclContext(decl(anyOf(namespaceDecl(), translationUnitDecl()))));
@@ -531,7 +533,7 @@ void ClangMoveTool::registerMatchers(ast_matchers::MatchFinder *Finder) {
return;
// Match forward declarations in old header.
- Finder->addMatcher(namedDecl(ForwardDecls, InOldHeader).bind("fwd_decl"),
+ Finder->addMatcher(namedDecl(ForwardClassDecls, InOldHeader).bind("fwd_decl"),
this);
//============================================================================
OpenPOWER on IntegriCloud