[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 06:52:56 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; }
----------------
AaronBallman wrote:

This function was intended to tell you whether the attribute is a C++ attribute, and now it's changed to whether it's a C++ attribute spelled with `[[]]`. https://eel.is/c++draft/dcl.attr - note that `alignas` is an `attribute-specifier`. In C, `alignas` is *not* an attribute specifier (but it might become one someday) but is a kind of `declaration-specifier` instead.

I think it'd be better to keep this distinction, but I'll defer to @erichkeane if he has other opinions.

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


More information about the cfe-commits mailing list