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 /lib/AST/StmtPrinter.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 'lib/AST/StmtPrinter.cpp')
-rw-r--r-- | lib/AST/StmtPrinter.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/AST/StmtPrinter.cpp b/lib/AST/StmtPrinter.cpp index 844a3e8560..ba67a97deb 100644 --- a/lib/AST/StmtPrinter.cpp +++ b/lib/AST/StmtPrinter.cpp @@ -895,26 +895,27 @@ void StmtPrinter::VisitObjCMessageExpr(ObjCMessageExpr *Mess) { } void StmtPrinter::VisitBlockExpr(BlockExpr *Node) { + BlockDecl *BD = Node->getBlockDecl(); OS << "^"; const FunctionType *AFT = Node->getFunctionType(); if (isa<FunctionTypeNoProto>(AFT)) { OS << "()"; - } else if (!Node->arg_empty() || cast<FunctionTypeProto>(AFT)->isVariadic()) { - const FunctionTypeProto *FT = cast<FunctionTypeProto>(AFT); + } else if (!BD->param_empty() || cast<FunctionTypeProto>(AFT)->isVariadic()) { OS << '('; std::string ParamStr; - for (BlockExpr::arg_iterator AI = Node->arg_begin(), - E = Node->arg_end(); AI != E; ++AI) { - if (AI != Node->arg_begin()) OS << ", "; + for (BlockDecl::param_iterator AI = BD->param_begin(), + E = BD->param_end(); AI != E; ++AI) { + if (AI != BD->param_begin()) OS << ", "; ParamStr = (*AI)->getName(); (*AI)->getType().getAsStringInternal(ParamStr); OS << ParamStr; } + const FunctionTypeProto *FT = cast<FunctionTypeProto>(AFT); if (FT->isVariadic()) { - if (!Node->arg_empty()) OS << ", "; + if (!BD->param_empty()) OS << ", "; OS << "..."; } OS << ')'; |