aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/Decl.cpp
diff options
context:
space:
mode:
authorSteve Naroff <snaroff@apple.com>2009-03-13 16:56:44 +0000
committerSteve Naroff <snaroff@apple.com>2009-03-13 16:56:44 +0000
commite78b809bbcd92928a63da81f2cd843faad3e4dfd (patch)
treea49947086849b15be6f821750d3c6464a125ad3f /lib/AST/Decl.cpp
parent6ae8a3600656c478d27f25639bed765f4fe71732 (diff)
Fix <rdar://problem/6675489> BlockDecl should not use llvm::smallvector.
Also changed BlockDecl API to be more consistent (wrt FunctionDecl). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66904 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/Decl.cpp')
-rw-r--r--lib/AST/Decl.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp
index 5786c56210..bd16331c1b 100644
--- a/lib/AST/Decl.cpp
+++ b/lib/AST/Decl.cpp
@@ -514,3 +514,20 @@ void BlockDecl::Destroy(ASTContext& C) {
Decl::Destroy(C);
}
+
+void BlockDecl::setParams(ASTContext& C, ParmVarDecl **NewParamInfo,
+ unsigned NParms) {
+ assert(ParamInfo == 0 && "Already has param info!");
+
+ // Zero params -> null pointer.
+ if (NParms) {
+ NumParams = NParms;
+ void *Mem = C.Allocate(sizeof(ParmVarDecl*)*NumParams);
+ ParamInfo = new (Mem) ParmVarDecl*[NumParams];
+ memcpy(ParamInfo, NewParamInfo, sizeof(ParmVarDecl*)*NumParams);
+ }
+}
+
+unsigned BlockDecl::getNumParams() const {
+ return NumParams;
+}