https://github.com/efriedma-quic commented:
Now that I understand the structure here better, I'm unhappy with how classNeedsVectorDeletingDestructor works. There are basically two conditions under which we want to emit the vector deleting dtor, for a class with a virtual destructor: - The class/destructor is dllexport - CodeGen emits a `new[]` expression for the class. The first case is pretty conventional: we see a dllexport, we do the necessary analysis in Sema, we emit it when we see it in CodeGen. The second case is sort of weird: we do semantic analysis when we see the new[] expression, and then we do delayed emission based on whether we actually codegen it. Given that, I don't think classNeedsVectorDeletingDestructor is structured correctly. For the dllexport case, we should directly check for dllexport. For the `new[]` case, we should do semantic analysis when we see the `new[]`, and possibly record that we saw the `new[]` so we don't re-analyze it. But we should not use that from codegen: we should derive, from scratch, whether the `new[]` is actually used. Getting this wrong leads to inconsistencies where a new[] can triggers codegen even if it's not actually emitted. https://github.com/llvm/llvm-project/pull/185653 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
