Find clang-query binary.
()
| 21 | |
| 22 | |
| 23 | def _find_clang_query() -> Path: |
| 24 | """Find clang-query binary.""" |
| 25 | # System LLVM install (Windows) |
| 26 | system_path = Path("C:/Program Files/LLVM/bin/clang-query.exe") |
| 27 | if system_path.exists(): |
| 28 | return system_path |
| 29 | # Project cache |
| 30 | cache_path = ( |
| 31 | PROJECT_ROOT / ".cache" / "clang-tools" / "clang" / "bin" / "clang-query.exe" |
| 32 | ) |
| 33 | if cache_path.exists(): |
| 34 | return cache_path |
| 35 | # Fallback |
| 36 | import shutil |
| 37 | |
| 38 | found = shutil.which("clang-query") |
| 39 | if found: |
| 40 | return Path(found) |
| 41 | return cache_path # will fail with clear error message |
| 42 | |
| 43 | |
| 44 | CLANG_QUERY = _find_clang_query() |