Add Destroy method to Types, making there destruction more harmonious with
the destruction of Decls and Stmts.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51385 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp
index 3165ad0..923aab2 100644
--- a/lib/AST/ASTContext.cpp
+++ b/lib/AST/ASTContext.cpp
@@ -29,13 +29,7 @@
ASTContext::~ASTContext() {
// Deallocate all the types.
while (!Types.empty()) {
- if (FunctionTypeProto *FT = dyn_cast<FunctionTypeProto>(Types.back())) {
- // Destroy the object, but don't call delete. These are malloc'd.
- FT->~FunctionTypeProto();
- free(FT);
- } else {
- delete Types.back();
- }
+ Types.back()->Destroy(*this);
Types.pop_back();
}
}