- Notifications
You must be signed in to change notification settings - Fork 15.2k
Description
46f3ade intends to fix the printing of attributes attached to variable declarations. The implementation choice is to print the attributes on the left hand side. However, that forces that change drifts away the produced output from the output as written in the code. This is also evident from the tests the commit had to change.
Consider,
void f() __attribute__((always_inline)) {}
clang-17 -Xclang -ast-print
produces void f() __attribute__((always_inline)) {}
which matches very closely the original code. However, clang-18 -Xclang -ast-print
produces __attribute__((always_inline)) void f() {}
Both compile but I think the second one violates a principle which I believe we have been following where we try to produce output close as much as possible to the user code.
@giulianobelinassi, @erichkeane do you think we can bring the old behavior back before freezing 18 by limiting that feature to variable declarations only? This was the original intent of the patch IIUC.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status