Find the actual include-what-you-use binary.
()
| 22 | |
| 23 | |
| 24 | def find_iwyu_binary() -> str | None: |
| 25 | """Find the actual include-what-you-use binary.""" |
| 26 | # Try system IWYU first (preferred) |
| 27 | iwyu = shutil.which("include-what-you-use") |
| 28 | if iwyu: |
| 29 | return iwyu |
| 30 | |
| 31 | # Try clang-tool-chain cache directory |
| 32 | home = Path.home() |
| 33 | cache_dir = home / ".clang-tool-chain" / "iwyu" |
| 34 | |
| 35 | # Search for include-what-you-use.exe in cache |
| 36 | if cache_dir.exists(): |
| 37 | for path in cache_dir.rglob("include-what-you-use.exe"): |
| 38 | if path.is_file(): |
| 39 | return str(path) |
| 40 | for path in cache_dir.rglob("include-what-you-use"): |
| 41 | if path.is_file(): |
| 42 | return str(path) |
| 43 | |
| 44 | return None |
| 45 | |
| 46 | |
| 47 | def _resolve_fast_native_cxx(compiler_path: str) -> str: |