[PATCH] D91872: [libTooling] Update Transformer's `node` combinator to include the trailing semicolon for decls.

Yitzhak Mandelbaum via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 20 08:55:45 PST 2020


ymandel added a comment.

In D91872#2408278 <https://reviews.llvm.org/D91872#2408278>, @aaron.ballman wrote:

> 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!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91872/new/

https://reviews.llvm.org/D91872



More information about the cfe-commits mailing list