| 144 | |
| 145 | |
| 146 | def find_llvm_tool(name: str, cc: str) -> str: |
| 147 | cc_path = shutil.which(cc) |
| 148 | if cc_path: |
| 149 | cand = os.path.join(os.path.dirname(os.path.realpath(cc_path)), name) |
| 150 | if os.access(cand, os.X_OK): |
| 151 | return cand |
| 152 | p = shutil.which(name) |
| 153 | if p: |
| 154 | return p |
| 155 | if shutil.which("xcrun"): |
| 156 | res = subprocess.run(["xcrun", "--find", name], capture_output=True, text=True, check=False) |
| 157 | if res.returncode == 0: |
| 158 | return res.stdout.strip() |
| 159 | sys.exit(f"sanitizer-coverage-map: {name} not found next to {cc} or on PATH") |
| 160 | |
| 161 | |
| 162 | def cmd_run(args) -> int: |