hokein added inline comments.

================
Comment at: clang/include/clang/AST/TemplateBase.h:429
+      auto *T = getTemplate();
+      T->Ctx->Deallocate(T);
+    }
----------------
sammccall wrote:
> sammccall wrote:
> > this is a no-op, and thus not worth stashing a pointer to Ctx for!
> > 
> > It also doesn't delete T, and it's probably best to do that even if it's 
> > (currently) a no-op
> If you're going to destroy T in the destructor, then you can't have trivial 
> copies, as the second one is pointing at deallocated memory.
> (Well, apart from the fact that deallocation does nothing).
> 
> So I think we probably either want:
>  - allocation on ASTContext, trivial copies, no deallocation
>  - allocation on heap, copies reallocate
>  - allocation on heap using shared_ptr
>  - copies disallowed (but I think we rely on them being available)
chose the first one. 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87080/new/

https://reviews.llvm.org/D87080

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to