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

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 11 07:04:42 PDT 2023


================
@@ -186,14 +186,14 @@ class AttributeCommonInfo {
   bool isGNUScope() const;
   bool isClangScope() const;
 
-  bool isCXX11Attribute() const { return SyntaxUsed == AS_CXX11 || IsAlignas; }
-
+  bool isAlignas() const { return IsAlignas; }
+  bool isCXX11Attribute() const { return SyntaxUsed == AS_CXX11; }
   bool isC23Attribute() const { return SyntaxUsed == AS_C23; }
 
   /// The attribute is spelled [[]] in either C or C++ mode, including standard
   /// attributes spelled with a keyword, like alignas.
   bool isStandardAttributeSyntax() const {
-    return isCXX11Attribute() || isC23Attribute();
+    return isCXX11Attribute() || isC23Attribute() || IsAlignas;
----------------
AaronBallman wrote:

I think `isCXX11Attribute()` was being used properly there, at least per the comment. But you're right, this one now changed behavior in C23 because it will treat `_Alignas` as a standard attribute.

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


More information about the cfe-commits mailing list