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

Jan Svoboda via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 20 15:34:02 PDT 2023


jansvoboda11 wrote:

> Clang part looks fine. For a clang-tidy part, is there a way to test this part ? What changes because we use now a absolute build directory. I'm missing some tests for that part.

So the clang-tidy part is necessary to keep the `clang-tidy/infrastructure/clang-tidy-run-with-database.cpp` test passing. It uses compilation database that has entries like this:

```json
{
  "directory": "<absolute-dir>/b",
  "command": "clang++ -o test.o ../b/c.cpp",
  "file": "<absolute-dir>/b/c.cpp"
}
```

I think this already provides good enough code coverage for this PR. What do you think?

What I'd like to get clarified in this PR is which directory to use as the CWD.
Is using `ClangTidyContext::getCurrentBuildDirectory()` okay, or do we need to look somewhere else?

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


More information about the cfe-commits mailing list