aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/AST/Decl.cpp5
-rw-r--r--lib/Sema/Sema.h2
-rw-r--r--lib/Sema/SemaExpr.cpp8
3 files changed, 8 insertions, 7 deletions
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp
index c900a734ae..fe2e95d157 100644
--- a/lib/AST/Decl.cpp
+++ b/lib/AST/Decl.cpp
@@ -77,10 +77,9 @@ FunctionDecl *FunctionDecl::Create(ASTContext &C, DeclContext *DC,
}
BlockDecl *BlockDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L,
- ParmVarDecl **args, unsigned numargs,
- CompoundStmt *body) {
+ ParmVarDecl **args, unsigned numargs) {
void *Mem = C.getAllocator().Allocate<BlockDecl>();
- return new (Mem) BlockDecl(DC, L, args, numargs, body);
+ return new (Mem) BlockDecl(DC, L, args, numargs);
}
FieldDecl *FieldDecl::Create(ASTContext &C, SourceLocation L,
diff --git a/lib/Sema/Sema.h b/lib/Sema/Sema.h
index 406d9f7e7e..0600ae1424 100644
--- a/lib/Sema/Sema.h
+++ b/lib/Sema/Sema.h
@@ -1070,6 +1070,8 @@ struct BlockSemaInfo {
bool hasPrototype;
bool isVariadic;
+ BlockDecl *TheDecl;
+
/// TheScope - This is the scope for the block itself, which contains
/// arguments etc.
Scope *TheScope;
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index b8b614db07..cdba6ec6ea 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -2889,6 +2889,8 @@ void Sema::ActOnBlockStart(SourceLocation CaretLoc, Scope *BlockScope,
BSI->Params.push_back((ParmVarDecl *)FTI.ArgInfo[i].Param);
BSI->isVariadic = FTI.isVariadic;
}
+ BSI->TheDecl = BlockDecl::Create(Context, CurContext, CaretLoc,
+ &BSI->Params[0], BSI->Params.size());
}
/// ActOnBlockError - If there is an error parsing a block, this callback
@@ -2932,10 +2934,8 @@ Sema::ExprResult Sema::ActOnBlockStmtExpr(SourceLocation CaretLoc, StmtTy *body,
BlockTy = Context.getBlockPointerType(BlockTy);
- BlockDecl *NewBD = BlockDecl::Create(Context, CurContext, CaretLoc,
- &BSI->Params[0], BSI->Params.size(),
- Body.take());
- return new BlockExpr(NewBD, BlockTy);
+ BSI->TheDecl->setBody(Body.take());
+ return new BlockExpr(BSI->TheDecl, BlockTy);
}
/// ExprsMatchFnType - return true if the Exprs in array Args have