[PATCH] D80239: [libTooling] In Transformer, allow atomic changes to span multiple files.

Dmitri Gribenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat May 23 12:43:20 PDT 2020


gribozavr2 accepted this revision.
gribozavr2 added inline comments.
This revision is now accepted and ready to land.


================
Comment at: clang/lib/Tooling/Transformer/Transformer.cpp:65
 
-  for (const auto &I : Case.AddedIncludes) {
-    auto &Header = I.first;
-    switch (I.second) {
-    case transformer::IncludeFormat::Quoted:
-      AC.addHeader(Header);
-      break;
-    case transformer::IncludeFormat::Angled:
-      AC.addHeader((llvm::Twine("<") + Header + ">").str());
-      break;
+  for (auto &IDChangePair : ChangesByFileID) {
+    auto &AC = IDChangePair.second;
----------------
The test shows an example transformer that removes code, so the header insertion logic is not triggered there. However, for a change that would be adding code, is it correct to insert the header into every file being edited? I think not necessarily. Or do you prefer to deal with this issue when we have a sample use case?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80239





More information about the cfe-commits mailing list