- 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
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index fa18ce3..b8b614d 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -2931,8 +2931,11 @@
                                       BSI->isVariadic);
   
   BlockTy = Context.getBlockPointerType(BlockTy);
-  return new BlockExpr(CaretLoc, BlockTy, &BSI->Params[0], BSI->Params.size(), 
-                       Body.take());
+  
+  BlockDecl *NewBD = BlockDecl::Create(Context, CurContext, CaretLoc,
+                                       &BSI->Params[0], BSI->Params.size(),
+                                       Body.take());
+  return new BlockExpr(NewBD, BlockTy);
 }
 
 /// ExprsMatchFnType - return true if the Exprs in array Args have