]> granicus.if.org Git - clang/commitdiff
[AST] Dump dependent scope member expression with its member name
authorAlex Lorenz <arphaman@gmail.com>
Wed, 9 Nov 2016 14:02:18 +0000 (14:02 +0000)
committerAlex Lorenz <arphaman@gmail.com>
Wed, 9 Nov 2016 14:02:18 +0000 (14:02 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@286365 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/ASTDumper.cpp
test/Misc/ast-dump-stmt.cpp

index 61a38af8dc156a5692e590d05336f5af0d4cb249..f97ac7e7a149976da028890ad17d50dc6e9da6d9 100644 (file)
@@ -545,6 +545,8 @@ namespace  {
       dumpDecl(Node->getLambdaClass());
     }
     void VisitSizeOfPackExpr(const SizeOfPackExpr *Node);
+    void
+    VisitCXXDependentScopeMemberExpr(const CXXDependentScopeMemberExpr *Node);
 
     // ObjC
     void VisitObjCAtCatchStmt(const ObjCAtCatchStmt *Node);
@@ -2194,6 +2196,11 @@ void ASTDumper::VisitSizeOfPackExpr(const SizeOfPackExpr *Node) {
       dumpTemplateArgument(A);
 }
 
+void ASTDumper::VisitCXXDependentScopeMemberExpr(
+    const CXXDependentScopeMemberExpr *Node) {
+  VisitExpr(Node);
+  OS << " " << (Node->isArrow() ? "->" : ".") << Node->getMember();
+}
 
 //===----------------------------------------------------------------------===//
 // Obj-C Expressions
index 96921ff7b6e1cd2fc624aa8872ccb4f27a7d1ce4..55b9b5fa953168e608e5eb797d35911c5faba736 100644 (file)
@@ -65,3 +65,19 @@ void TestDependentAllocationExpr() {
 // CHECK: FunctionTemplateDecl {{.*}} TestDependentAllocationExpr
 // CHECK: CXXNewExpr {{.*'T \*'$}}
 // CHECK: CXXDeleteExpr {{.*'void'$}}
+
+template <typename T>
+class DependentScopeMemberExprWrapper {
+  T member;
+};
+
+template <typename T>
+void TestDependentScopeMemberExpr() {
+  DependentScopeMemberExprWrapper<T> obj;
+  obj.member = T();
+  (&obj)->member = T();
+}
+
+// CHECK: FunctionTemplateDecl {{.*}} TestDependentScopeMemberExpr
+// CHECK: CXXDependentScopeMemberExpr {{.*}} lvalue .member
+// CHECK: CXXDependentScopeMemberExpr {{.*}} lvalue ->member