aboutsummaryrefslogtreecommitdiff
path: root/lib/AST
diff options
context:
space:
mode:
authorSam Bishop <sam@bishop.dhs.org>2008-04-11 18:04:39 +0000
committerSam Bishop <sam@bishop.dhs.org>2008-04-11 18:04:39 +0000
commit1bb19638f2ec0d63ed131b51ca8d9542d1a9afee (patch)
treeb4f0cb9425641903c28c01290051bd5e3e54a51a /lib/AST
parent45bc03f9202d5649fd41f35b98d34bb34823d0f3 (diff)
Invoke destructors in Decl::Destroy().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49547 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST')
-rw-r--r--lib/AST/Decl.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp
index 43da07cc24..c0ec3085e5 100644
--- a/lib/AST/Decl.cpp
+++ b/lib/AST/Decl.cpp
@@ -329,10 +329,43 @@ const Attr *Decl::getAttrs() const {
return (*DeclAttrs)[this];
}
+#define CASE(KIND) case KIND: cast<KIND##Decl>(this)->~KIND##Decl(); break
+
void Decl::Destroy(ASTContext& C) const {
+ switch (getKind()) {
+ CASE(Field);
+ CASE(ObjCIvar);
+ CASE(ObjCCategory);
+ CASE(ObjCCategoryImpl);
+ CASE(ObjCImplementation);
+ CASE(ObjCProtocol);
+ CASE(ObjCProperty);
+ CASE(Typedef);
+ CASE(Enum);
+ CASE(EnumConstant);
+ CASE(Function);
+ CASE(BlockVar);
+ CASE(FileVar);
+ CASE(ParmVar);
+ CASE(ObjCInterface);
+ CASE(ObjCCompatibleAlias);
+ CASE(ObjCMethod);
+ CASE(ObjCClass);
+ CASE(ObjCForwardProtocol);
+ CASE(LinkageSpec);
+
+ case Struct: case Union: case Class:
+ cast<RecordDecl>(this)->~RecordDecl();
+ break;
+
+ default: assert(0 && "Unknown decl kind!");
+ }
+
C.getAllocator().Deallocate((void *)this);
}
+#undef CASE
+
//===----------------------------------------------------------------------===//
// DeclContext Implementation
//===----------------------------------------------------------------------===//