aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-02-20 21:16:26 +0000
committerChris Lattner <sabre@nondot.org>2009-02-20 21:16:26 +0000
commit11e1e1af2641affb378080a4f3d1a30da1cad082 (patch)
tree118361a87b0168b7d50f15994865776840180385 /lib
parent793ccfd646d0388e06c587e962a18fa723b72f02 (diff)
newly factored, we can now move the set and destroy methods out of line.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65166 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/AST/DeclObjC.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/AST/DeclObjC.cpp b/lib/AST/DeclObjC.cpp
index ec67f5cf40..5a3c730a76 100644
--- a/lib/AST/DeclObjC.cpp
+++ b/lib/AST/DeclObjC.cpp
@@ -17,6 +17,26 @@
using namespace clang;
//===----------------------------------------------------------------------===//
+// ObjCListBase
+//===----------------------------------------------------------------------===//
+
+void ObjCListBase::Destroy() {
+ delete[] List;
+ NumElts = 0;
+ List = 0;
+}
+
+void ObjCListBase::set(void *const* InList, unsigned Elts) {
+ assert(List == 0 && "Elements already set!");
+ if (Elts == 0) return; // Setting to an empty list is a noop.
+
+ List = new void*[Elts];
+ NumElts = Elts;
+ memcpy(List, InList, sizeof(void*)*Elts);
+}
+
+
+//===----------------------------------------------------------------------===//
// ObjCInterfaceDecl
//===----------------------------------------------------------------------===//