"""Portable compiler discovery for benchmark comparator lanes.""" from __future__ import annotations import shutil from pathlib import Path def find_clang(override: str | None = None) -> str | None: candidates = [ override, "/opt/homebrew/opt/llvm@22/bin/clang++", "/opt/homebrew/opt/llvm/bin/clang++", "/usr/local/opt/llvm/bin/clang++", "clang++", ] for candidate in candidates: if not candidate: continue resolved = shutil.which(candidate) if resolved: return resolved path = Path(candidate) if path.is_file(): return str(path.resolve()) return None