[cfe-commits] r57195 - /cfe/trunk/Driver/RewriteBlocks.cpp
Ted Kremenek
kremenek at apple.com
Mon Oct 6 11:47:10 PDT 2008
Author: kremenek
Date: Mon Oct 6 13:47:09 2008
New Revision: 57195
URL: http://llvm.org/viewvc/llvm-project?rev=57195&view=rev
Log:
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.
Modified:
cfe/trunk/Driver/RewriteBlocks.cpp
Modified: cfe/trunk/Driver/RewriteBlocks.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/RewriteBlocks.cpp?rev=57195&r1=57194&r2=57195&view=diff
==============================================================================
--- cfe/trunk/Driver/RewriteBlocks.cpp (original)
+++ cfe/trunk/Driver/RewriteBlocks.cpp Mon Oct 6 13:47:09 2008
@@ -1014,14 +1014,18 @@
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.
More information about the cfe-commits
mailing list