[clang-move] Matching static class member more correctly.
Reviewers: ioeric Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D25598 llvm-svn: 284221
This commit is contained in:
		
							parent
							
								
									86e72d98dd
								
							
						
					
					
						commit
						7bd492c53a
					
				| 
						 | 
				
			
			@ -24,6 +24,11 @@ namespace clang {
 | 
			
		|||
namespace move {
 | 
			
		||||
namespace {
 | 
			
		||||
 | 
			
		||||
// FIXME: Move to ASTMatchers.
 | 
			
		||||
AST_MATCHER(VarDecl, isStaticDataMember) {
 | 
			
		||||
  return Node.isStaticDataMember();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
AST_MATCHER_P(Decl, hasOutermostEnclosingClass,
 | 
			
		||||
              ast_matchers::internal::Matcher<Decl>, InnerMatcher) {
 | 
			
		||||
  const auto* Context = Node.getDeclContext();
 | 
			
		||||
| 
						 | 
				
			
			@ -365,7 +370,8 @@ void ClangMoveTool::registerMatchers(ast_matchers::MatchFinder *Finder) {
 | 
			
		|||
      this);
 | 
			
		||||
 | 
			
		||||
  // Match static member variable definition of the moved class.
 | 
			
		||||
  Finder->addMatcher(varDecl(InMovedClass, InOldCC, isDefinition())
 | 
			
		||||
  Finder->addMatcher(varDecl(InMovedClass, InOldCC, isDefinition(),
 | 
			
		||||
                             isStaticDataMember())
 | 
			
		||||
                         .bind("class_static_var_decl"),
 | 
			
		||||
                     this);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,4 +5,7 @@ namespace a {
 | 
			
		|||
int Foo::f() {
 | 
			
		||||
  return 0;
 | 
			
		||||
}
 | 
			
		||||
int Foo::f2(int a, int b) {
 | 
			
		||||
  return a + b;
 | 
			
		||||
}
 | 
			
		||||
} // namespace a
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,5 +2,6 @@ namespace a {
 | 
			
		|||
class Foo {
 | 
			
		||||
public:
 | 
			
		||||
  int f();
 | 
			
		||||
  int f2(int a, int b);
 | 
			
		||||
};
 | 
			
		||||
} // namespace a
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -25,6 +25,7 @@
 | 
			
		|||
// CHECK-NEW-TEST-H: class Foo {
 | 
			
		||||
// CHECK-NEW-TEST-H: public:
 | 
			
		||||
// CHECK-NEW-TEST-H:   int f();
 | 
			
		||||
// CHECK-NEW-TEST-H:   int f2(int a, int b);
 | 
			
		||||
// CHECK-NEW-TEST-H: };
 | 
			
		||||
// CHECK-NEW-TEST-H: } // namespace a
 | 
			
		||||
//
 | 
			
		||||
| 
						 | 
				
			
			@ -32,6 +33,7 @@
 | 
			
		|||
// CHECK-NEW-TEST-CPP: #include "test2.h"
 | 
			
		||||
// CHECK-NEW-TEST-CPP: namespace a {
 | 
			
		||||
// CHECK-NEW-TEST-CPP: int Foo::f() { return 0; }
 | 
			
		||||
// CHECK-NEW-TEST-CPP: int Foo::f2(int a, int b) { return a + b; }
 | 
			
		||||
// CHECK-NEW-TEST-CPP: } // namespace a
 | 
			
		||||
//
 | 
			
		||||
// CHECK-OLD-TEST-CPP: #include "test.h"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue