Open ilan-schemoul opened 5 months ago
@llvm/issue-subscribers-clang-tidy
Author: Ilan Schemoul (ilan-schemoul)
Clang-format is not supposed to modify code.
Oh okay I thought as typedef was to define an alias clang-format was okay with that but I understand that you don't want a formatter to modify code. Should this issue be closed or is there any other tool that could take care of this (clang warning flag + clangd code action) or this should be closed ? Do you have any idea how I could implement this if it's stricly out of scope for this repo ?
struct abc{}; typedef struct abc a; typedef struct abc x; int main() { struct abc b; } abc, a, x have different semantics. How to do they replace each other?
You can specify the preference order and for example choose that if there's multiples one you always pick the first.
"always pick the first" leads to a semantic error.
Why ? Should I close this issue ?
In my opinion, the issue can be closed. Different meanings may be assigned to struct abs via a and x in projects. And the definitions of a and x can evolve over time too.
Different meanings may be assigned to struct abs via a and x in projects.
Well then it's not a problem anymore ? If one of a or x definition is not struct abc then we don't pick it when we format ? I am missing the point ?
You're talking about a very specific edge case "what if someone would give two typedef to the same struct and then modify a single one of them" and even then I don't see your point still. Well if someone modify one typedef they known what they're doing I don't see the problem.
Hey, It would be awesome to have an option (the name could be
UseTypedefInsteafOfFullStructName
) so when we have thisstruct abc b;
gets replaced bya b;