aboutsummaryrefslogtreecommitdiff
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
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
-rw-r--r--include/clang/AST/DeclObjC.h15
-rw-r--r--lib/AST/DeclObjC.cpp20
2 files changed, 22 insertions, 13 deletions
diff --git a/include/clang/AST/DeclObjC.h b/include/clang/AST/DeclObjC.h
index b03936e7f4..8b05693710 100644
--- a/include/clang/AST/DeclObjC.h
+++ b/include/clang/AST/DeclObjC.h
@@ -43,24 +43,13 @@ public:
assert(List == 0 && "Destroy should have been called before dtor");
}
- void Destroy() {
- delete[] List;
- NumElts = 0;
- List = 0;
- }
+ void Destroy();
unsigned size() const { return NumElts; }
bool empty() const { return NumElts == 0; }
protected:
- void 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);
- }
+ void set(void *const* InList, unsigned Elts);
};
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
//===----------------------------------------------------------------------===//