aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/Decl.cpp
diff options
context:
space:
mode:
authorSteve Naroff <snaroff@apple.com>2008-10-08 17:01:13 +0000
committerSteve Naroff <snaroff@apple.com>2008-10-08 17:01:13 +0000
commit56ee6896f2efebffb4a2cce5a7610cdf1eddbbbe (patch)
tree27e5894e15c4faaea557fd1f88702f626aea2fed /lib/AST/Decl.cpp
parent178927517fa09ddbb04dc8ef725b5716c18aae21 (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/Decl.cpp')
-rw-r--r--lib/AST/Decl.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp
index 3ddf81974b..c900a734ae 100644
--- a/lib/AST/Decl.cpp
+++ b/lib/AST/Decl.cpp
@@ -76,6 +76,13 @@ FunctionDecl *FunctionDecl::Create(ASTContext &C, DeclContext *DC,
TypeSpecStartLoc);
}
+BlockDecl *BlockDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L,
+ ParmVarDecl **args, unsigned numargs,
+ CompoundStmt *body) {
+ void *Mem = C.getAllocator().Allocate<BlockDecl>();
+ return new (Mem) BlockDecl(DC, L, args, numargs, body);
+}
+
FieldDecl *FieldDecl::Create(ASTContext &C, SourceLocation L,
IdentifierInfo *Id, QualType T, Expr *BW) {
void *Mem = C.getAllocator().Allocate<FieldDecl>();
@@ -285,3 +292,20 @@ FieldDecl *RecordDecl::getMember(IdentifierInfo *II) {
return Members[i];
return 0;
}
+
+//===----------------------------------------------------------------------===//
+// BlockDecl Implementation
+//===----------------------------------------------------------------------===//
+
+BlockDecl::~BlockDecl() {
+}
+
+void BlockDecl::Destroy(ASTContext& C) {
+ if (Body)
+ Body->Destroy(C);
+
+ for (param_iterator I=param_begin(), E=param_end(); I!=E; ++I)
+ (*I)->Destroy(C);
+
+ Decl::Destroy(C);
+}