[clang] [CLANG] Enable alignas after GNU attributes (PR #133107)

via cfe-commits cfe-commits at lists.llvm.org
Sat Apr 26 04:25:03 PDT 2025


================
@@ -24,7 +24,7 @@ int templateFunction(T value) __attribute__((annotate("works")));
 
 // CHECK: ClassDecl=Test:3:7 (Definition) Extent=[3:1 - 17:2]
 // CHECK-NEXT: CXXAccessSpecifier=:4:1 (Definition) Extent=[4:1 - 4:8]
-// CHECK-NEXT: CXXMethod=aMethod:5:51 Extent=[5:3 - 5:60]
+// CHECK-NEXT: CXXMethod=aMethod:5:51 Extent=[5:46 - 5:60]
----------------
DenisGZM wrote:

The main problem here is to determine 'right' :)
Now I set annotated declaration range at the begining of the first parsed attribute and it might be not only `DeclSpecAttr`.
Earlier we parsed only CXX attrs before `ParseDeclarationSpecifiers` and then annotated range could only contain DeclSpecAttrs in it.

Examples:
```
class Test {
public:
  __attribute__((annotate("spiffy_method"))) [[deprecated]] void aMethod();  // Error before, now: Extent=[5:3 - 5:75]
};

class Test {
public:
  [[deprecated]] __attribute__((annotate("spiffy_method")))  void aMethod(); // Before: Extent=[5:18 - 5:75], now: Extent=[5:3 - 5:75]
};
```
Is it what expected to be done?



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


More information about the cfe-commits mailing list