[cfe-commits] r107911 - /cfe/trunk/include/clang/AST/RecursiveASTVisitor.h

Zhanyong Wan wan at google.com
Thu Jul 8 14:01:29 PDT 2010


Author: wan
Date: Thu Jul  8 16:01:29 2010
New Revision: 107911

URL: http://llvm.org/viewvc/llvm-project?rev=107911&view=rev
Log:
Makes RecursiveASTVisitor traverse the type of a temporary object
created via T() where T is a class type.  Reviewed by chandlerc and
csilvers.


Modified:
    cfe/trunk/include/clang/AST/RecursiveASTVisitor.h

Modified: cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/RecursiveASTVisitor.h?rev=107911&r1=107910&r2=107911&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/RecursiveASTVisitor.h (original)
+++ cfe/trunk/include/clang/AST/RecursiveASTVisitor.h Thu Jul  8 16:01:29 2010
@@ -1546,9 +1546,8 @@
 }
 
 DEF_TRAVERSE_STMT(CXXScalarValueInitExpr, {
-    // This is called for code like 'return MyClass()' where MyClass
-    // has no user-defined constructor.  It's also called for 'return
-    // int()'.  We recurse on type MyClass/int.
+    // This is called for code like 'return T()' where T is a built-in
+    // (i.e. non-class) type.
     if (!S->isImplicit())
       TRY_TO(TraverseType(S->getType()));
   })
@@ -1603,7 +1602,12 @@
 DEF_TRAVERSE_STMT(UnresolvedMemberExpr, { })
 DEF_TRAVERSE_STMT(VAArgExpr, { })
 DEF_TRAVERSE_STMT(CXXConstructExpr, { })
-DEF_TRAVERSE_STMT(CXXTemporaryObjectExpr, { })
+
+DEF_TRAVERSE_STMT(CXXTemporaryObjectExpr, {
+    // This is called for code like 'return T()' where T is a class type.
+    TRY_TO(TraverseType(S->getType()));
+  })
+
 DEF_TRAVERSE_STMT(CallExpr, { })
 DEF_TRAVERSE_STMT(CXXMemberCallExpr, { })
 DEF_TRAVERSE_STMT(CXXOperatorCallExpr, { })





More information about the cfe-commits mailing list