[cfe-commits] r107304 - /cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
Zhanyong Wan
wan at google.com
Wed Jun 30 11:34:52 PDT 2010
Author: wan
Date: Wed Jun 30 13:34:52 2010
New Revision: 107304
URL: http://llvm.org/viewvc/llvm-project?rev=107304&view=rev
Log:
Fix RecursiveASTVisitor to traverse the ctor initializer list before
traversing the ctor body when traversing a CXXConstructorDecl.
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=107304&r1=107303&r2=107304&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/RecursiveASTVisitor.h (original)
+++ cfe/trunk/include/clang/AST/RecursiveASTVisitor.h Wed Jun 30 13:34:52 2010
@@ -992,6 +992,16 @@
TRY_TO(TraverseType(D->getResultType()));
TRY_TO(TraverseDeclContextHelper(D)); // Parameters.
+
+ if (CXXConstructorDecl *Ctor = dyn_cast<CXXConstructorDecl>(D)) {
+ // Constructor initializers.
+ for (CXXConstructorDecl::init_iterator I = Ctor->init_begin(),
+ E = Ctor->init_end();
+ I != E; ++I) {
+ TRY_TO(TraverseConstructorInitializer(*I));
+ }
+ }
+
if (D->isThisDeclarationADefinition()) {
TRY_TO(TraverseStmt(D->getBody())); // Function body.
}
@@ -1011,18 +1021,9 @@
})
DEF_TRAVERSE_DECL(CXXConstructorDecl, {
- TRY_TO(TraverseFunctionHelper(D));
- // FIXME: traverse the initializers before traversing the
- // constructor body.
- for (CXXConstructorDecl::init_iterator I = D->init_begin(),
- E = D->init_end();
- I != E; ++I) {
- TRY_TO(TraverseConstructorInitializer(*I));
- }
-
// We skip decls_begin/decls_end, which are already covered by
// TraverseFunctionHelper().
- return true;
+ return TraverseFunctionHelper(D);
})
// CXXConversionDecl is the declaration of a type conversion operator.
More information about the cfe-commits
mailing list