[clang] [clang] Improve `_Alignas` on a `struct` declaration diagnostic (PR #65638)

Jerin Philip via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 20 11:11:49 PDT 2023


================
@@ -94,7 +94,7 @@ class AttributeCommonInfo {
           IsRegularKeywordAttribute(IsRegularKeywordAttribute) {}
     constexpr Form(tok::TokenKind Tok)
         : SyntaxUsed(AS_Keyword), SpellingIndex(SpellingNotCalculated),
-          IsAlignas(Tok == tok::kw_alignas),
+          IsAlignas(Tok == tok::kw_alignas || Tok == tok::kw__Alignas),
----------------
jerinphilip wrote:

If not mixed into `IsAlignAs`, the following can recover `_Alignas`, which [D141177](https://reviews.llvm.org/D141177) is relying on for a lesser invasive change. 

```cpp
getParsedKind() == AT_Aligned && isKeywordAttribute() && !IsAlignas;
```

This feels complicated, and potentially not future proof as in C23, `_Aligned` is an alternate spelling for `aligned`. 

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


More information about the cfe-commits mailing list