forked from OSchip/llvm-project
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:
parent
612ddc3117
commit
85d4a4bcc7
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue