From ec7346077c1fb423c9279771675c098bc2dffc92 Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Fri, 8 Apr 2011 23:35:25 +0000 Subject: [PATCH] Properly traverse a ObjCMethodDecl in RecursiveASTVisitor. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129169 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/AST/RecursiveASTVisitor.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/include/clang/AST/RecursiveASTVisitor.h b/include/clang/AST/RecursiveASTVisitor.h index 5aecd35795..ccc327b5b6 100644 --- a/include/clang/AST/RecursiveASTVisitor.h +++ b/include/clang/AST/RecursiveASTVisitor.h @@ -1172,9 +1172,17 @@ DEF_TRAVERSE_DECL(ObjCProtocolDecl, { }) DEF_TRAVERSE_DECL(ObjCMethodDecl, { - // We don't traverse nodes in param_begin()/param_end(), as they - // appear in decls_begin()/decls_end() and thus are handled. - TRY_TO(TraverseStmt(D->getBody())); + if (D->getResultTypeSourceInfo()) { + TRY_TO(TraverseTypeLoc(D->getResultTypeSourceInfo()->getTypeLoc())); + } + for (ObjCMethodDecl::param_iterator + I = D->param_begin(), E = D->param_end(); I != E; ++I) { + TRY_TO(TraverseDecl(*I)); + } + if (D->isThisDeclarationADefinition()) { + TRY_TO(TraverseStmt(D->getBody())); + } + return true; }) DEF_TRAVERSE_DECL(ObjCPropertyDecl, { -- 2.40.0