Revert "Fix memory leak complicated non-type template arguments."

This reverts commit ed13d8c667.

This is part of 5 commits being reverted due to https://crbug.com/1161059. See bug for repro.
This commit is contained in:
Arthur Eubanks 2020-12-22 10:11:31 -08:00
parent 612ddc3117
commit 85d4a4bcc7
2 changed files with 2 additions and 3 deletions

View File

@ -2818,8 +2818,8 @@ public:
/// for destruction.
template <typename T> void addDestruction(T *Ptr) const {
if (!std::is_trivially_destructible<T>::value) {
auto DestroyPtr = [](void *V) { ((T*)V)->~T(); };
AddDeallocation(DestroyPtr, (void*)Ptr);
auto DestroyPtr = [](void *V) { static_cast<T *>(V)->~T(); };
AddDeallocation(DestroyPtr, Ptr);
}
}

View File

@ -137,7 +137,6 @@ TemplateArgument::TemplateArgument(const ASTContext &Ctx, QualType Type,
else {
Value.Kind = UncommonValue;
Value.Value = new (Ctx) APValue(V);
Ctx.addDestruction(Value.Value);
Value.Type = Type.getAsOpaquePtr();
}
}