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

Jerin Philip via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 11 09:11:45 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; }
----------------
jerinphilip wrote:

I realize there are backwards compatibility issues now (which I did not see before). Happy to defer to experts the decision.  I mostly went for a symptomatic treatment after I got failures since `kw_Alignas` was not added. Would it make sense to decompose `IsAlignAs` to `IsCXXAlignas || isCAlignAs` then? It'll bloat the code a bit but will allow retaining past behaviour by retaining the fine-grained information.

This is within an instance of an `AttributeCommonInfo` class and therefore an attribute, so I reasoned this is already an attribute - now these methods are intended to distinguish CXX or C is based on syntax.

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


More information about the cfe-commits mailing list