[clang-tools-extra] [clang-tidy] support parameters file in command line (PR #120547)

Congcong Cai via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 20 00:53:39 PST 2024


HerrCai0907 wrote:

> I had the realization now that as a user I would like this to be supported:
> 
> ```
> clang-tidy @params
> ```
> 
> Where `params` can contain:
> 
> ```
> <clang-tidy-flags> foo.cpp -- <compiler flags>
> ```
> 
> This would make it also consistent with clang, where you can do `clang @params`.
> 
> Would this be feasible?

Full supporting is hard. But we can do like this:

in `build/sources`
```
build/a.cpp
build/init.cpp
```

in `build/options`
```
-std=c++23
-isysroot
/Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk
```

Then you can run clang and clang-tidy with

```bash
 build/release/bin/clang at build/sources @build/options
```
```bash
 build/release/bin/clang-tidy @build/sources -- @build/options
```

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


More information about the cfe-commits mailing list