[clang-tools-extra] [clang-include-cleaner] Fix incorrect directory issue for writing files (PR #111375)
kadir çetinkaya via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 8 07:36:23 PDT 2024
https://github.com/kadircet requested changes to this pull request.
thanks a lot for the patch, and sorry for regressing this.
I think this is also going to regress behavior in some cases (e.g. working directory in compile commands might be virtual for some build systems like bazel).
When include-cleaner is invoked as `clang-include-cleaner foo.cc` the user is definitely trying to run this on a file relative to directory in which we invoked include-cleaner, hence we should make sure it's adressed through that path going forward.
Can we instead update logic near the following in `main`:
```cpp
clang::tooling::ClangTool Tool(OptionsParser->getCompilations(),
OptionsParser->getSourcePathList());
```
instead of passing `OptionsParser->getSourcePathList())`, we can turn all of these source paths into absolue paths, using the current-working-dir of the process, and then we don't need to worry about how they make their way into our ast-consumer.
https://github.com/llvm/llvm-project/pull/111375
More information about the cfe-commits
mailing list