From f4b48042724d2253d0426cadcb93e24eeb47e264 Mon Sep 17 00:00:00 2001 From: Edwin Vane Date: Thu, 7 Mar 2013 15:44:40 +0000 Subject: Adding lvalue and rvalue reference type matchers Updated docs and tests. Reviewers: klimek, gribozavr git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176630 91177308-0d34-0410-b5e6-96231b3b80d8 --- docs/LibASTMatchersReference.html | 92 +++++++++++++++++++++++++++++++++++---- 1 file changed, 84 insertions(+), 8 deletions(-) (limited to 'docs') diff --git a/docs/LibASTMatchersReference.html b/docs/LibASTMatchersReference.html index a32f1a4afb..5bee8ccea4 100644 --- a/docs/LibASTMatchersReference.html +++ b/docs/LibASTMatchersReference.html @@ -973,6 +973,23 @@ incompleteArrayType() +Matcher<TypeLoc>lvalueReferenceTypeLocMatcher<LValueReferenceTypeLoc>... +
Matches lvalue reference types.
+
+Given:
+  int *a;
+  int &b = *a;
+  int &&c = 1;
+  auto &d = b;
+  auto &&e = c;
+  auto &&f = 2;
+  int g = 5;
+
+lvalueReferenceType() matches the types of b, d, and e. e is
+matched since the type is deduced as int& by reference collapsing rules.
+
+ + Matcher<TypeLoc>memberPointerTypeLocMatcher<MemberPointerTypeLoc>...
Matches member pointer types.
 Given
@@ -1011,14 +1028,35 @@ and s.
 
 
 Matcher<TypeLoc>referenceTypeLocMatcher<ReferenceTypeLoc>...
-
Matches reference types.
+
Matches both lvalue and rvalue reference types.
 
 Given
   int *a;
   int &b = *a;
-  int c = 5;
-pointerType()
-  matches "int &b"
+  int &&c = 1;
+  auto &d = b;
+  auto &&e = c;
+  auto &&f = 2;
+  int g = 5;
+
+referenceType() matches the types of b, c, d, e, and f.
+
+ + +Matcher<TypeLoc>rvalueReferenceTypeLocMatcher<RValueReferenceTypeLoc>... +
Matches rvalue reference types.
+
+Given:
+  int *a;
+  int &b = *a;
+  int &&c = 1;
+  auto &d = b;
+  auto &&e = c;
+  auto &&f = 2;
+  int g = 5;
+
+lvalueReferenceType() matches the types of c and f. e is not
+matched as it is deduced to int& by reference collapsing rules.
 
@@ -1202,6 +1240,23 @@ incompleteArrayType()
+Matcher<Type>lvalueReferenceTypeMatcher<LValueReferenceType>... +
Matches lvalue reference types.
+
+Given:
+  int *a;
+  int &b = *a;
+  int &&c = 1;
+  auto &d = b;
+  auto &&e = c;
+  auto &&f = 2;
+  int g = 5;
+
+lvalueReferenceType() matches the types of b, d, and e. e is
+matched since the type is deduced as int& by reference collapsing rules.
+
+ + Matcher<Type>memberPointerTypeMatcher<MemberPointerType>...
Matches member pointer types.
 Given
@@ -1240,14 +1295,35 @@ and s.
 
 
 Matcher<Type>referenceTypeMatcher<ReferenceType>...
-
Matches reference types.
+
Matches both lvalue and rvalue reference types.
 
 Given
   int *a;
   int &b = *a;
-  int c = 5;
-pointerType()
-  matches "int &b"
+  int &&c = 1;
+  auto &d = b;
+  auto &&e = c;
+  auto &&f = 2;
+  int g = 5;
+
+referenceType() matches the types of b, c, d, e, and f.
+
+ + +Matcher<Type>rvalueReferenceTypeMatcher<RValueReferenceType>... +
Matches rvalue reference types.
+
+Given:
+  int *a;
+  int &b = *a;
+  int &&c = 1;
+  auto &d = b;
+  auto &&e = c;
+  auto &&f = 2;
+  int g = 5;
+
+lvalueReferenceType() matches the types of c and f. e is not
+matched as it is deduced to int& by reference collapsing rules.
 
-- cgit v1.2.3-18-g5258