[clang] [clang-tools-extra] [clang][NFC] Refactor `CXXNewExpr::InitializationStyle` (re-land) (PR #71417)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 18 05:23:00 PST 2024
AaronBallman wrote:
> > The enum we had in the past described the syntax of the new expression.
>
> Even if it was the case at some point, I'm not sure it held when I created the PR, which eliminated this kind of nasty mapping, encoding how this enum was actually used:
>
> ```c++
> CXXNewExprBits.StoredInitializationStyle =
> Initializer ? InitializationStyle + 1 : 0;
> ```
>
> ```c++
> InitializationStyle getInitializationStyle() const {
> if (CXXNewExprBits.StoredInitializationStyle == 0)
> return NoInit;
> return static_cast<InitializationStyle>(
> CXXNewExprBits.StoredInitializationStyle - 1);
> ```
Yeah, perhaps calling this NFC was a stretch because it does have a minor functional change in what it expresses; sorry for that confusion! I think the current form is a more clean way to express the code. Are you finding it's causing issues beyond just the change to test behavior?
https://github.com/llvm/llvm-project/pull/71417
More information about the cfe-commits
mailing list