aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhanyong Wan <wan@google.com>2010-07-08 21:01:29 +0000
committerZhanyong Wan <wan@google.com>2010-07-08 21:01:29 +0000
commit80db8cbff5afc047a23dbfe11f7ef787d891feec (patch)
tree54e8aac976f02d3aa59680a4d95786c0dd4d015e
parent590c7d5e79d350162d485f039018cbeb47f3b547 (diff)
Makes RecursiveASTVisitor traverse the type of a temporary object
created via T() where T is a class type. Reviewed by chandlerc and csilvers. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107911 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/AST/RecursiveASTVisitor.h12
1 files changed, 8 insertions, 4 deletions
diff --git a/include/clang/AST/RecursiveASTVisitor.h b/include/clang/AST/RecursiveASTVisitor.h
index f734c9af52..bc4ad2a065 100644
--- a/include/clang/AST/RecursiveASTVisitor.h
+++ b/include/clang/AST/RecursiveASTVisitor.h
@@ -1546,9 +1546,8 @@ bool RecursiveASTVisitor<Derived>::TraverseInitListExpr(InitListExpr *S) {
}
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(UnresolvedLookupExpr, { })
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, { })