[clang] [clang-tools-extra] [clang][tidy] Ensure rewriter has the correct CWD (PR #67839)

Piotr Zegar via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 4 11:44:47 PST 2023


================
@@ -227,6 +227,14 @@ class ErrorReporter {
           llvm::errs() << "Can't apply replacements for file " << File << "\n";
         }
       }
+
+      auto BuildDir = Context.getCurrentBuildDirectory();
----------------
PiotrZSL wrote:

I think you may need to do what is done in handleErrors method.
Simply remember old value, change new value to build directory, and after call to overwriteChangedFiles restore it.
By default getCurrentWorkingDirectory should return actually current working directory.

https://github.com/llvm/llvm-project/pull/67839


More information about the cfe-commits mailing list