]> granicus.if.org Git - clang/commitdiff
Properly traverse a ObjCMethodDecl in RecursiveASTVisitor.
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Fri, 8 Apr 2011 23:35:25 +0000 (23:35 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Fri, 8 Apr 2011 23:35:25 +0000 (23:35 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129169 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/RecursiveASTVisitor.h

index 5aecd357956ec54605d4a216820312c858df4bed..ccc327b5b676af69ab5e3347b8e06f2820965825 100644 (file)
@@ -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, {