[clang-tidy] Fix `TransformerClangTidyCheck`'s handling of include insertions.
authorYitzhak Mandelbaum <yitzhakm@google.com>
Thu, 11 Feb 2021 20:51:08 +0000 (20:51 +0000)
committerYitzhak Mandelbaum <yitzhakm@google.com>
Fri, 12 Feb 2021 16:23:53 +0000 (16:23 +0000)
commit33f35a4b793bb53b830f8893110af57672e1dc79
treec5522de73d4dad4d95fda277179fc7fc5dd0bcae
parent142c09fefb2ae2b71f8d2c41e13b1ba23f655fa2
[clang-tidy] Fix `TransformerClangTidyCheck`'s handling of include insertions.

Currently, all include insertions are directed to the main file. However,
Transformer rules can specify alternative destinations for include
insertions. This patch fixes the code to associate the include with the correct
file.

This patch was tested manually. The clang tidy unit test framework does not
support testing changes to header files. Given that this is a bug fix for a live
bug, the patch relies on manual testing rather than blocking on upgrading the
unit test framework.

Differential Revision: https://reviews.llvm.org/D96542
clang-tools-extra/clang-tidy/utils/TransformerClangTidyCheck.cpp