Currently, node only includes the semicolon for (some) statements. However, declarations have the same issue of (potentially) trailing semicolons, so node should behave the same for them.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Drive-by question from the peanut gallery, sorry if this is an ignorant one -- not all declarations have a trailing semicolon; is that handled properly? e.g., int x; has a trailing semicolon but int x, y; only has a trailing semicolon for one of the two declarations. Relatedly, in int f(int x);, the declaration of f has a trailing semicolon, but the declaration of x does not.
No, it's a good question -- the comments and the patch description should have been clearer. I've updated both. Also, I found a test that needed to be fixed (and also, hopefully, illustrates why the new behavior is preferred. The old behavior left the semicolon out of the replacement (which looks weird) because it was working around the fact that the source being removed didn't include the trailing semicolon, while the new version can just specify the replacement correctly).
Thanks!