[cfe-commits] r65156 - in /cfe/trunk: include/clang/AST/DeclObjC.h lib/AST/DeclObjC.cpp
Chris Lattner
sabre at nondot.org
Fri Feb 20 13:02:11 PST 2009
Author: lattner
Date: Fri Feb 20 15:02:11 2009
New Revision: 65156
URL: http://llvm.org/viewvc/llvm-project?rev=65156&view=rev
Log:
rename ObjCList::clear() -> ObjCList::Destroy(). Require that destroy is called
before the dtor.
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=65156&r1=65155&r2=65156&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclObjC.h (original)
+++ cfe/trunk/include/clang/AST/DeclObjC.h Fri Feb 20 15:02:11 2009
@@ -48,12 +48,13 @@
public:
ObjCList() : List(0), NumElts(0) {}
~ObjCList() {
- delete[] List;
+ assert(List == 0 && "Destroy should have been called before dtor");
}
- void clear() {
+ void Destroy() {
delete[] List;
NumElts = 0;
+ List = 0;
}
void set(T* 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=65156&r1=65155&r2=65156&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclObjC.cpp (original)
+++ cfe/trunk/lib/AST/DeclObjC.cpp Fri Feb 20 15:02:11 2009
@@ -193,7 +193,7 @@
for (param_iterator I=param_begin(), E=param_end(); I!=E; ++I)
if (*I) (*I)->Destroy(C);
- ParamInfo.clear();
+ ParamInfo.Destroy();
Decl::Destroy(C);
}
@@ -280,7 +280,7 @@
for (ivar_iterator I=ivar_begin(), E=ivar_end(); I!=E; ++I)
if (*I) (*I)->Destroy(C);
- IVars.clear();
+ IVars.Destroy();
// FIXME: CategoryList?
// FIXME: Because there is no clear ownership
@@ -357,7 +357,7 @@
}
void ObjCProtocolDecl::Destroy(ASTContext &C) {
- ReferencedProtocols.clear();
+ ReferencedProtocols.Destroy();
ObjCContainerDecl::Destroy(C);
}
@@ -410,7 +410,7 @@
// obviating this problem. Because of this situation, referenced
// ObjCInterfaceDecls are destroyed in ~TranslationUnit.
- ForwardDecls.clear();
+ ForwardDecls.Destroy();
Decl::Destroy(C);
}
@@ -434,7 +434,7 @@
}
void ObjCForwardProtocolDecl::Destroy(ASTContext &C) {
- ReferencedProtocols.clear();
+ ReferencedProtocols.Destroy();
Decl::Destroy(C);
}
@@ -524,7 +524,7 @@
/// Destroy - Call destructors and release memory.
void ObjCImplementationDecl::Destroy(ASTContext& C) {
- IVars.clear();
+ IVars.Destroy();
Decl::Destroy(C);
}
More information about the cfe-commits
mailing list