[clang] Sort attributes according to source position before printing (PR #162556)

Giuliano Belinassi via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 9 08:24:52 PDT 2025


giulianobelinassi wrote:

So it seems that here seems to be the code piece that GCC uses to parse ASM and the ATTRs:

https://github.com/gcc-mirror/gcc/blob/ea05497d4a329f183ffb5428befc957c5522ef86/gcc/c/c-parser.cc#L2788-L2803

so it will peek for `RID_ASM` (which is the asm keyword), parse it, then go to the next attributes.  If `RID_ASM` is not provided, it will fall into the attributes parsing and there is no code to parse the `RID_ASM` case.  Therefore, I think we will be fine if the ASM attributes are print before anything else on the right side of a Decl. 

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


More information about the cfe-commits mailing list