[cfe-commits] r65166 - in /cfe/trunk: include/clang/AST/DeclObjC.h lib/AST/DeclObjC.cpp
Chris Lattner
sabre at nondot.org
Fri Feb 20 13:16:27 PST 2009
Author: lattner
Date: Fri Feb 20 15:16:26 2009
New Revision: 65166
URL: http://llvm.org/viewvc/llvm-project?rev=65166&view=rev
Log:
newly factored, we can now move the set and destroy methods out of line.
Modified:
cfe/trunk/include/clang/AST/DeclObjC.h
cfe/trunk/lib/AST/DeclObjC.cpp
Modified: cfe/trunk/include/clang/AST/DeclObjC.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclObjC.h?rev=65166&r1=65165&r2=65166&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclObjC.h (original)
+++ cfe/trunk/include/clang/AST/DeclObjC.h Fri Feb 20 15:16:26 2009
@@ -43,24 +43,13 @@
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);
};
Modified: cfe/trunk/lib/AST/DeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclObjC.cpp?rev=65166&r1=65165&r2=65166&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclObjC.cpp (original)
+++ cfe/trunk/lib/AST/DeclObjC.cpp Fri Feb 20 15:16:26 2009
@@ -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
//===----------------------------------------------------------------------===//
More information about the cfe-commits
mailing list