[clang] [clang-tools-extra] [clang][NFC] Refactor `CXXNewExpr::InitializationStyle` (re-land) (PR #71417)

Vlad Serebrennikov via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 18 03:17:57 PST 2024


Endilll 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:
```cpp
 CXXNewExprBits.StoredInitializationStyle =
      Initializer ? InitializationStyle + 1 : 0;
```
```cpp
  InitializationStyle getInitializationStyle() const {
    if (CXXNewExprBits.StoredInitializationStyle == 0)
      return NoInit;
    return static_cast<InitializationStyle>(
        CXXNewExprBits.StoredInitializationStyle - 1);
```

https://github.com/llvm/llvm-project/pull/71417


More information about the cfe-commits mailing list