From: Chris Lattner Date: Fri, 20 Feb 2009 21:16:26 +0000 (+0000) Subject: newly factored, we can now move the set and destroy methods out of line. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=11e1e1af2641affb378080a4f3d1a30da1cad082;p=clang 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 --- 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 @@ -16,6 +16,26 @@ #include "clang/AST/Stmt.h" 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 //===----------------------------------------------------------------------===//