[llvm-branch-commits] [clang] 85d4a4b - Revert "Fix memory leak complicated non-type template arguments."
Arthur Eubanks via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Dec 22 10:27:37 PST 2020
Author: Arthur Eubanks
Date: 2020-12-22T10:18:07-08:00
New Revision: 85d4a4bcc717a31ff40c4bd979dd6d78beb84b43
URL: https://github.com/llvm/llvm-project/commit/85d4a4bcc717a31ff40c4bd979dd6d78beb84b43
DIFF: https://github.com/llvm/llvm-project/commit/85d4a4bcc717a31ff40c4bd979dd6d78beb84b43.diff
LOG: Revert "Fix memory leak complicated non-type template arguments."
This reverts commit ed13d8c66781b50ff007cb089c5905f9bb9e8af2.
This is part of 5 commits being reverted due to https://crbug.com/1161059. See bug for repro.
Added:
Modified:
clang/include/clang/AST/ASTContext.h
clang/lib/AST/TemplateBase.cpp
Removed:
################################################################################
diff --git a/clang/include/clang/AST/ASTContext.h b/clang/include/clang/AST/ASTContext.h
index a9bfdb4d5fa5..0c5d82b3e9aa 100644
--- a/clang/include/clang/AST/ASTContext.h
+++ b/clang/include/clang/AST/ASTContext.h
@@ -2818,8 +2818,8 @@ class ASTContext : public RefCountedBase<ASTContext> {
/// 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);
}
}
diff --git a/clang/lib/AST/TemplateBase.cpp b/clang/lib/AST/TemplateBase.cpp
index a746db315d85..0029c90a0ab6 100644
--- a/clang/lib/AST/TemplateBase.cpp
+++ b/clang/lib/AST/TemplateBase.cpp
@@ -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();
}
}
More information about the llvm-branch-commits
mailing list