Skip to content

Commit a797a78

Browse files
committed
Remove xcrun-based clang finding
Not needed, since clangd will just discover the system default one way or another.
1 parent 1f154d0 commit a797a78

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

refresh.template.py

+1-12
Original file line numberDiff line numberDiff line change
@@ -685,17 +685,6 @@ def _get_apple_DEVELOPER_DIR():
685685
# Traditionally stored in DEVELOPER_DIR environment variable, but not provided by Bazel. See https://github.com/bazelbuild/bazel/issues/12852
686686

687687

688-
@functools.lru_cache(maxsize=None)
689-
def _get_apple_active_clang():
690-
"""Get path to xcode-select'd clang version."""
691-
return subprocess.check_output(
692-
('xcrun', '--find', 'clang'),
693-
stderr=subprocess.DEVNULL, # Suppress superfluous error messages like "Requested but did not find extension point with identifier..."
694-
encoding=locale.getpreferredencoding()
695-
).rstrip()
696-
# Unless xcode-select has been invoked (like for a beta) we'd expect, e.g., '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang' or '/Library/Developer/CommandLineTools/usr/bin/clang'.
697-
698-
699688
def _apple_platform_patch(compile_args: typing.List[str]):
700689
"""De-Bazel the command into something clangd can parse.
701690
@@ -707,7 +696,7 @@ def _apple_platform_patch(compile_args: typing.List[str]):
707696
# Undo Bazel's Apple platform compiler wrapping.
708697
# Bazel wraps the compiler as `external/local_config_cc/wrapped_clang` and exports that wrapped compiler in the proto. However, we need a clang call that clangd can introspect. (See notes in "how clangd uses compile_commands.json" in ImplementationReadme.md for more.)
709698
# Removing the wrapper is also important because Bazel's Xcode (but not CommandLineTools) wrapper crashes if you don't specify particular environment variables (replaced below). We'd need the wrapper to be invokable by clangd's --query-driver if we didn't remove the wrapper.
710-
compile_args[0] = _get_apple_active_clang()
699+
compile_args[0] = 'clang'
711700

712701
# We have to manually substitute out Bazel's macros so clang can parse the command
713702
# Code this mirrors is in https://github.com/bazelbuild/bazel/blob/master/tools/osx/crosstool/wrapped_clang.cc

0 commit comments

Comments
 (0)