[PATCH] D25598: [clang-move] Matching static class member more correctly.
Haojian Wu via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 14 02:26:13 PDT 2016
hokein created this revision.
hokein added a reviewer: ioeric.
hokein added a subscriber: cfe-commits.
https://reviews.llvm.org/D25598
Files:
clang-move/ClangMove.cpp
test/clang-move/Inputs/test.cpp
test/clang-move/Inputs/test.h
test/clang-move/move-class.cpp
Index: test/clang-move/move-class.cpp
===================================================================
--- test/clang-move/move-class.cpp
+++ test/clang-move/move-class.cpp
@@ -25,13 +25,15 @@
// 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
//
// CHECK-NEW-TEST-CPP: #include "{{.*}}new_test.h"
// 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"
Index: test/clang-move/Inputs/test.h
===================================================================
--- test/clang-move/Inputs/test.h
+++ test/clang-move/Inputs/test.h
@@ -2,5 +2,6 @@
class Foo {
public:
int f();
+ int f2(int a, int b);
};
} // namespace a
Index: test/clang-move/Inputs/test.cpp
===================================================================
--- test/clang-move/Inputs/test.cpp
+++ test/clang-move/Inputs/test.cpp
@@ -5,4 +5,7 @@
int Foo::f() {
return 0;
}
+int Foo::f2(int a, int b) {
+ return a + b;
+}
} // namespace a
Index: clang-move/ClangMove.cpp
===================================================================
--- clang-move/ClangMove.cpp
+++ clang-move/ClangMove.cpp
@@ -24,6 +24,11 @@
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 @@
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);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25598.74633.patch
Type: text/x-patch
Size: 2186 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161014/7577096f/attachment.bin>
More information about the cfe-commits
mailing list