You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Traditionally stored in DEVELOPER_DIR environment variable, but not provided by Bazel. See https://github.com/bazelbuild/bazel/issues/12852
684
684
685
685
686
-
@functools.lru_cache(maxsize=None)
687
-
def_get_apple_active_clang():
688
-
"""Get path to xcode-select'd clang version."""
689
-
returnsubprocess.check_output(
690
-
('xcrun', '--find', 'clang'),
691
-
encoding=locale.getpreferredencoding()
692
-
).rstrip()
693
-
# 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'.
# 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.)
737
718
# 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.
738
719
# Bazel wrapps the swiftc as `external/build_bazel_rules_swift/tools/worker/worker swiftc ` and worker has been removed in apple_swift_patch
739
-
ifcompile_args[0].endswith('swiftc'):
740
-
compile_args[0] =_get_apple_active_swiftc()
741
-
else:
742
-
compile_args[0] =_get_apple_active_clang()
720
+
ifnotcompile_args[0].endswith('swiftc'):
721
+
compile_args[0] ='clang'
743
722
744
723
# We have to manually substitute out Bazel's macros so clang can parse the command
745
724
# Code this mirrors is in https://github.com/bazelbuild/bazel/blob/master/tools/osx/crosstool/wrapped_clang.cc
0 commit comments