Typz added a comment.
I stumbled on the issue when working on the CompactNamespaces
<https://reviews.llvm.org/D32480> option, where the extra semicolon prevents
merging the closing braces.
There was an easy fix, which guaranteed that the closing braces would be
properly merged, so I went for it, just adding an option to keep things generic.
So there wasn't really a "long term" plan (though since I made the fix, I have
though that it would be nice to remove other cases of extra semicolon, e.g.
after function body).
I did not know of this 'Cleaner' class (I did not actually try to find it
either, thruth be told), but it would seem more appropriate indeed. The only
thing is I could not find where this is called, and esp. confirm if it happens
before the NamespaceEndCommentsFixer.
Back to the point, I can see a few options here:
- Merge this patch into the CompactNamespaces patch, but remove the option and
drop the semicolon only when CompactNamespaces mode is enabled
- Rework CompactNamespaces to merge namespace closing brace with extra
semicolon (not a big fan, it would look very strange: `};}`)
- Implement this in a more generic fashion, in the Cleaner, with no style
option (e.g. always on). Possibly the better option, but may be a more
significant significant undertaking
cfe-commits mailing list