From fda4fede1bb84d4c371f63f77e6c3e5383952c55 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Mon, 6 Oct 2008 18:47:09 +0000 Subject: [PATCH] In RewriteFunctionBody, using DeclStmt::decl_iterator to rewrite the Decls in a DeclStmt instead of using getDecl() to fetch the first Decl. Steve: Please review this patch. 'make test' passes, and my cursory scan of the rewriter leads me to believe this doesn't break anything, but I'm not sure. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57195 91177308-0d34-0410-b5e6-96231b3b80d8 --- Driver/RewriteBlocks.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/Driver/RewriteBlocks.cpp b/Driver/RewriteBlocks.cpp index 83fcc03aee..83bc4280c8 100644 --- a/Driver/RewriteBlocks.cpp +++ b/Driver/RewriteBlocks.cpp @@ -1014,14 +1014,18 @@ Stmt *RewriteBlocks::RewriteFunctionBody(Stmt *S) { RewriteBlockCall(CE); } if (DeclStmt *DS = dyn_cast(S)) { - ScopedDecl *SD = DS->getDecl(); - if (ValueDecl *ND = dyn_cast(SD)) { - if (isBlockPointerType(ND->getType())) - RewriteBlockPointerDecl(ND); - } - if (TypedefDecl *TD = dyn_cast(SD)) { - if (isBlockPointerType(TD->getUnderlyingType())) - RewriteBlockPointerDecl(TD); + for (DeclStmt::decl_iterator DI = DS->decl_begin(), DE = DS->decl_end(); + DI != DE; ++DI) { + + ScopedDecl *SD = *DI; + if (ValueDecl *ND = dyn_cast(SD)) { + if (isBlockPointerType(ND->getType())) + RewriteBlockPointerDecl(ND); + } + if (TypedefDecl *TD = dyn_cast(SD)) { + if (isBlockPointerType(TD->getUnderlyingType())) + RewriteBlockPointerDecl(TD); + } } } // Handle specific things. -- 2.40.0