aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-10-06 18:47:09 +0000
committerTed Kremenek <kremenek@apple.com>2008-10-06 18:47:09 +0000
commitfda4fede1bb84d4c371f63f77e6c3e5383952c55 (patch)
treea3147fcbc1a99d0d3d62805f48afb432344969ea
parent8369a8bdd6fe999de05be7c42af49aaa73da7855 (diff)
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
-rw-r--r--Driver/RewriteBlocks.cpp20
1 files 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<DeclStmt>(S)) {
- ScopedDecl *SD = DS->getDecl();
- if (ValueDecl *ND = dyn_cast<ValueDecl>(SD)) {
- if (isBlockPointerType(ND->getType()))
- RewriteBlockPointerDecl(ND);
- }
- if (TypedefDecl *TD = dyn_cast<TypedefDecl>(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<ValueDecl>(SD)) {
+ if (isBlockPointerType(ND->getType()))
+ RewriteBlockPointerDecl(ND);
+ }
+ if (TypedefDecl *TD = dyn_cast<TypedefDecl>(SD)) {
+ if (isBlockPointerType(TD->getUnderlyingType()))
+ RewriteBlockPointerDecl(TD);
+ }
}
}
// Handle specific things.