https://github.com/steakhal commented:

I didn't follow this PR closely enough and the same is true for the issue as 
well.
I think I'd disagree with the current direction because:
- I believe that the dynamic type trait should describe the accurate possible 
call targets - including placement-newed vtables. If that is not how it works 
today, then that's a bug that should be fixed.
- I think the `cplusplus.DestroyedAsWrongType` isn't the best fit, because from 
what I can tell, there are more problems with these placements news than what 
is checked here. I also think those are more common than what this PR targets. 
For example, the target storage must have an appropriate alignment, and the 
lifetime of the object must have ended before (aka. its dtor must have been 
invoked), then the pointer you pass as storage must not be used anywhere after 
the placement new, because the resulting pointer from the placement new should 
be used. Sometimes even std::launder needs to be involved but I'd need to 
refresh my knowledge about when.
So I feel like this is a broader set of problems than what 
`cplusplus.DestroyedAsWrongType` could describe. I also feel like that 
forgetting the alignment requirement and the destruction of the storage before 
placing a new object into it are by far the two most common problems in this 
category, so I think our reviewer time is better spent  on new checks targeting 
those than what is presented.

I think in reflection, you have probably seen the scarcity of reviews, and 
generally new checkers are higher investment from the reviewers - especially 
from new contributors.
I think it's better for all parties to start small and build familiarity with 
the code base prior to a 1k+ PR. - I'll admit, that when I saw the size and 
that I had some concerns about the dynamic type situation, I intentionally 
steered to smaller PRs, to spend my limited review capacity - essentially 
neglecting this one.

https://github.com/llvm/llvm-project/pull/237801
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to