diff options
author | Steve Naroff <snaroff@apple.com> | 2008-10-08 17:01:13 +0000 |
---|---|---|
committer | Steve Naroff <snaroff@apple.com> | 2008-10-08 17:01:13 +0000 |
commit | 56ee6896f2efebffb4a2cce5a7610cdf1eddbbbe (patch) | |
tree | 27e5894e15c4faaea557fd1f88702f626aea2fed /Driver/RewriteBlocks.cpp | |
parent | 178927517fa09ddbb04dc8ef725b5716c18aae21 (diff) |
- Add BlockDecl AST node.
- Modify BlockExpr to reference the BlockDecl.
This is "cleanup" necessary to improve our lookup semantics for blocks (to fix <rdar://problem/6272905> clang block rewriter: parameter to function not imported into block?).
Still some follow-up work to finish this (forthcoming).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57298 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Driver/RewriteBlocks.cpp')
-rw-r--r-- | Driver/RewriteBlocks.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/Driver/RewriteBlocks.cpp b/Driver/RewriteBlocks.cpp index 83bc4280c8..45c0715410 100644 --- a/Driver/RewriteBlocks.cpp +++ b/Driver/RewriteBlocks.cpp @@ -364,9 +364,11 @@ std::string RewriteBlocks::SynthesizeBlockFunc(BlockExpr *CE, int i, std::string S = "static " + RT.getAsString() + " __" + funcName + "_" + "block_func_" + utostr(i); + BlockDecl *BD = CE->getBlockDecl(); + if (isa<FunctionTypeNoProto>(AFT)) { S += "()"; - } else if (CE->arg_empty()) { + } else if (BD->param_empty()) { S += "(" + StructRef + " *__cself)"; } else { const FunctionTypeProto *FT = cast<FunctionTypeProto>(AFT); @@ -375,15 +377,15 @@ std::string RewriteBlocks::SynthesizeBlockFunc(BlockExpr *CE, int i, // first add the implicit argument. S += StructRef + " *__cself, "; std::string ParamStr; - for (BlockExpr::arg_iterator AI = CE->arg_begin(), - E = CE->arg_end(); AI != E; ++AI) { - if (AI != CE->arg_begin()) S += ", "; + for (BlockDecl::param_iterator AI = BD->param_begin(), + E = BD->param_end(); AI != E; ++AI) { + if (AI != BD->param_begin()) S += ", "; ParamStr = (*AI)->getName(); (*AI)->getType().getAsStringInternal(ParamStr); S += ParamStr; } if (FT->isVariadic()) { - if (!CE->arg_empty()) S += ", "; + if (!BD->param_empty()) S += ", "; S += "..."; } S += ')'; |