[PATCH] D96542: [clang-tidy] Fix `TransformerClangTidyCheck`'s handling of include insertions.

Alexander Kornienko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Feb 13 16:58:28 PST 2021


alexfh added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/utils/TransformerClangTidyCheck.cpp:108
+      Diag << Inserter.createIncludeInsertion(
+          Result.SourceManager->getFileID(T.Range.getBegin()), T.Replacement);
       break;
----------------
Can this be a macro file id? I'd suggest to add tests (probably for checks using this functionality) with a few nested includes and fixes in normal code, code in macros declared and expanded in different files, locations in macro bodies, macro arguments, and some tricky cases like fix pointing to a pasted token.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D96542



More information about the cfe-commits mailing list