]> granicus.if.org Git - clang/commitdiff
In RewriteFunctionBody, using DeclStmt::decl_iterator to rewrite the Decls in a DeclS...
authorTed Kremenek <kremenek@apple.com>
Mon, 6 Oct 2008 18:47:09 +0000 (18:47 +0000)
committerTed Kremenek <kremenek@apple.com>
Mon, 6 Oct 2008 18:47:09 +0000 (18:47 +0000)
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

index 83fcc03aee4193ce38bc351b0795053dafd07fd4..83bc4280c89ecb85f8e017aa8de1dc847e12ce59 100644 (file)
@@ -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.