Allocate Types using ASTContext's 'Allocator' object.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62530 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/Type.cpp b/lib/AST/Type.cpp
index d7c821f..9496892 100644
--- a/lib/AST/Type.cpp
+++ b/lib/AST/Type.cpp
@@ -30,22 +30,21 @@
return false;
}
-void Type::Destroy(ASTContext& C) { delete this; }
-
-void FunctionTypeProto::Destroy(ASTContext& C) {
- // Destroy the object, but don't call delete. These are malloc'd.
- this->~FunctionTypeProto();
- free(this);
+void Type::Destroy(ASTContext& C) {
+ this->~Type();
+ C.getAllocator().Deallocate(this);
}
void VariableArrayType::Destroy(ASTContext& C) {
SizeExpr->Destroy(C);
- delete this;
+ this->~VariableArrayType();
+ C.getAllocator().Deallocate(this);
}
void DependentSizedArrayType::Destroy(ASTContext& C) {
SizeExpr->Destroy(C);
- delete this;
+ this->~DependentSizedArrayType();
+ C.getAllocator().Deallocate(this);
}
/// getArrayElementTypeNoTypeQual - If this is an array type, return the