summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/Decl.cpp
diff options
context:
space:
mode:
authorGeorge Burgess IV <george.burgess.iv@gmail.com>2017-02-14 05:37:36 +0000
committerGeorge Burgess IV <george.burgess.iv@gmail.com>2017-02-14 05:37:36 +0000
commitb61bfbd93aae792229a672e027198390299ed5e7 (patch)
tree8fc90f80d14fe62f6adc9e1df6df99fd2ca86004 /clang/lib/AST/Decl.cpp
parente4f731b81308274ab2da8f0fed88420905760d42 (diff)
downloadbcm5719-llvm-b61bfbd93aae792229a672e027198390299ed5e7.tar.gz
bcm5719-llvm-b61bfbd93aae792229a672e027198390299ed5e7.zip
Add a destruct-on-exit function to ASTContext.
It looks like the only use of AddDeallocation is to indirectly call the destructors of objects. In one case I found (TypeAliasTemplateDecl::Common), the destructor is a nop, so registering it to run later seems pointless. All of the other *::Common types have non-trivial dtors, so deleting the useless AddDeallocation felt somewhat fragile. Happy to kill it + turn the is_trivial_dtor check into a static_assert if people think that'd be better. llvm-svn: 295029
Diffstat (limited to 'clang/lib/AST/Decl.cpp')
-rw-r--r--clang/lib/AST/Decl.cpp9
1 files changed, 1 insertions, 8 deletions
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index 81f08787d51..29271995063 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -2143,13 +2143,6 @@ APValue *VarDecl::evaluateValue() const {
return evaluateValue(Notes);
}
-namespace {
-// Destroy an APValue that was allocated in an ASTContext.
-void DestroyAPValue(void* UntypedValue) {
- static_cast<APValue*>(UntypedValue)->~APValue();
-}
-} // namespace
-
APValue *VarDecl::evaluateValue(
SmallVectorImpl<PartialDiagnosticAt> &Notes) const {
EvaluatedStmt *Eval = ensureEvaluatedStmt();
@@ -2181,7 +2174,7 @@ APValue *VarDecl::evaluateValue(
if (!Result)
Eval->Evaluated = APValue();
else if (Eval->Evaluated.needsCleanup())
- getASTContext().AddDeallocation(DestroyAPValue, &Eval->Evaluated);
+ getASTContext().addDestruction(&Eval->Evaluated);
Eval->IsEvaluating = false;
Eval->WasEvaluated = true;
OpenPOWER on IntegriCloud