extend/ENV/super: set CC/CXX to real names for llvm_clang#22920
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adjusts Superenv’s llvm_clang compiler setup so that CC/CXX/OBJC/OBJCXX are set to the “real” compiler names (clang/clang++) while keeping HOMEBREW_CC=llvm_clang so Homebrew’s superenv shims still route builds through the LLVM toolchain when desired.
Changes:
- Override
Superenv#llvm_clangto setCC/CXX(and ObjC variants) toclang/clang++after the standard superenv compiler selection. - Update the superenv
ccshim to consistently choose LLVM’sclang++whenHOMEBREW_CC=llvm_clang, even if invoked under other*++names. - Add a unit spec verifying the
llvm_clangenvironment variable behavior in Superenv.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| Library/Homebrew/extend/ENV/super.rb | Overrides llvm_clang to rewrite CC/CXX/OBJC/OBJCXX to clang/clang++ while preserving HOMEBREW_CC. |
| Library/Homebrew/shims/super/cc | Removes the special-case llvm_(clang...) tool selection and instead routes *++ invocations to LLVM clang++ when HOMEBREW_CC=llvm_clang. |
| Library/Homebrew/test/ENV_spec.rb | Adds coverage for Superenv’s llvm_clang environment variable values. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
carlocab
approved these changes
Jul 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
brewcommands to reproduce the bug?brew lgtm(style, typechecking and tests) locally?CC=llvm_clang/CXX=llvm_clang++can cause issues in formulae if the value of CC/CXX is saved into binaries/scripts to be used at runtime. This PR follows similar pattern in my versioned GCC PR (#22889) so that the build scripts will see the actual name of the command, i.e.CC=clang/CXX=clang++.This is also similar to how we handle
swiftshim:brew/Library/Homebrew/shims/super/swift
Lines 5 to 10 in 8d94d5c
To make this work, need to adjust
ccshim too so that it handles LLVM Clang the same as all other compilers. Previously, it would only apply LLVM's clang++ when namedllvm_clang++. Now, even if compiler is invoked as clang++, g++, etc., brew should use HOMEBREW_CC=llvm_clang forward to LLVM's clang++.This should avoid workarounds like
I tried removing above and running
brew install --cc llvm_clang ecl. Snippets of output:And underlying 02.make.cc.log: