From 1ca258e6a89203d8b74db740f98b32b5925b6bbb Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Wed, 5 Aug 2015 12:11:30 +0000 Subject: Add AST matchers for narrowing constructors that are default, copy, or move constructors, as well as functionality to determine whether a ctor initializer is a base initializer. llvm-svn: 244036 --- clang/docs/LibASTMatchersReference.html | 52 +++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) (limited to 'clang/docs/LibASTMatchersReference.html') diff --git a/clang/docs/LibASTMatchersReference.html b/clang/docs/LibASTMatchersReference.html index c977872f383..4d383817b33 100644 --- a/clang/docs/LibASTMatchersReference.html +++ b/clang/docs/LibASTMatchersReference.html @@ -1460,6 +1460,58 @@ Example matches f(0, 0) (matcher = callExpr(argumentCountIs(2))) +Matcher<CXXConstructorDecl>isCopyConstructor +
Matches constructor declarations that are copy constructors.
+
+Example matches #2, but not #1 or #3 (matcher = constructorDecl(isCopyConstructor())
+  struct S {
+    S(); // #1
+    S(const S &); // #2
+    S(S &&); // #3
+  };
+
+ +Matcher<CXXConstructorDecl>isDefaultConstructor +
Matches constructor declarations that are default constructors.
+
+Example matches #1, but not #2 or #3 (matcher = constructorDecl(isDefaultConstructor())
+  struct S {
+    S(); // #1
+    S(const S &); // #2
+    S(S &&); // #3
+  };
+
+ + +Matcher<CXXConstructorDecl>isMoveConstructor +
Matches constructor declarations that are move constructors.
+
+Example matches #3, but not #1 or #2 (matcher = constructorDecl(isMoveConstructor())
+  struct S {
+    S(); // #1
+    S(const S &); // #2
+    S(S &&); // #3
+  };
+
+ + +Matcher<CXXCtorInitializer>isBaseInitializer +
Matches a constructor initializer if it is initializing a base, as opposed to a member.
+
+Given
+  struct B {};
+  struct D : B {
+    int I;
+    D(int i) : I(i) {}
+  };
+  struct E : B {
+    E() : B() {}
+  };
+constructorDecl(hasAnyConstructorInitializer(isBaseInitializer()))
+  will match E(), but not match D(int).
+
+ + Matcher<CXXCtorInitializer>isWritten
Matches a constructor initializer if it is explicitly written in
 code (as opposed to implicitly added by the compiler).
-- 
cgit v1.2.3