[cfe-dev] clang-tidy: where does the comma get removed when removing an arg?

Yitzhak Mandelbaum via cfe-dev cfe-dev at lists.llvm.org
Mon Jul 29 07:58:44 PDT 2019

thanks, that's quite helpful. For those curious, the code responsible is
in clang/lib/Format/Format.cpp, in Cleaner::analyze().

On Mon, Jul 29, 2019 at 9:34 AM Haojian Wu <hokein at google.com> wrote:

> I think the cleanup is done by cleanupAroundReplacements (clang-tidy
> formats the replacements before applying them).
> On Mon, Jul 29, 2019 at 3:14 PM Yitzhak Mandelbaum via cfe-dev <
> cfe-dev at lists.llvm.org> wrote:
>> If I create a removal FixItHint in clang-tidy to remove a function
>> argument (that is, the `CharSourceRange` in the cal to
>> FixItHint::CreateRemoval() spans a function-call argument), the associated
>> comma for that argument (if any) is removed as well.
>> For example, when removing the second argument of `foo(3, 4)`, clang-tidy
>> (correctly) removes the comma to produce `foo(3)`.
>> I'd like to understand *where* that happens in the code.   I've looked
>> through much of the code involved and searched the codebase for
>> `tok::comma`, but was completely unable to discover the source of this
>> modification.
>> thanks,
>> yitzhak
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at lists.llvm.org
>> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20190729/a1d19cbf/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4847 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20190729/a1d19cbf/attachment.bin>

More information about the cfe-dev mailing list