Skip to content

[clang] Prefer clang_setup over use_clang #147437

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

boomanaiden154
Copy link
Contributor

This patch switches over uses of use_clang to clang_setup to fix a
potential race condition that has been impacting CI.

This is split from the refactoring to ensure I'm not missing anything
major here on the clang-tools-extra side.

This should fix #145703.

boomanaiden154 added a commit to boomanaiden154/llvm-project that referenced this pull request Jul 8, 2025
This patch switches over uses of use_clang to clang_setup to fix a
potential race condition that has been impacting CI.

This is split from the refactoring to ensure I'm not missing anything
major here on the clang-tools-extra side.

This should fix llvm#145703.

Pull Request: llvm#147437
@llvmbot
Copy link
Member

llvmbot commented Jul 8, 2025

@llvm/pr-subscribers-clangd

Author: Aiden Grossman (boomanaiden154)

Changes

This patch switches over uses of use_clang to clang_setup to fix a
potential race condition that has been impacting CI.

This is split from the refactoring to ensure I'm not missing anything
major here on the clang-tools-extra side.

This should fix #145703.


Full diff: https://github.com/llvm/llvm-project/pull/147437.diff

2 Files Affected:

  • (modified) clang-tools-extra/clangd/test/lit.cfg.py (+1-1)
  • (modified) clang-tools-extra/test/lit.cfg.py (+1-1)
diff --git a/clang-tools-extra/clangd/test/lit.cfg.py b/clang-tools-extra/clangd/test/lit.cfg.py
index 489726bc9429b..8ab4309e337d1 100644
--- a/clang-tools-extra/clangd/test/lit.cfg.py
+++ b/clang-tools-extra/clangd/test/lit.cfg.py
@@ -1,7 +1,7 @@
 import lit.llvm
 
 lit.llvm.initialize(lit_config, config)
-lit.llvm.llvm_config.use_clang([], [], required=False)
+lit.llvm.llvm_config.clang_setup()
 lit.llvm.llvm_config.use_default_substitutions()
 
 config.name = "Clangd"
diff --git a/clang-tools-extra/test/lit.cfg.py b/clang-tools-extra/test/lit.cfg.py
index 9f64fd3d2ffa2..bc82a14a0aed1 100644
--- a/clang-tools-extra/test/lit.cfg.py
+++ b/clang-tools-extra/test/lit.cfg.py
@@ -42,7 +42,7 @@
 config.test_exec_root = os.path.join(config.clang_tools_binary_dir, "test")
 
 # Tools need the same environment setup as clang (we don't need clang itself).
-llvm_config.use_clang(required=False)
+llvm_config.clang_setup()
 
 if config.clang_tidy_staticanalyzer:
     config.available_features.add("static-analyzer")

@llvmbot
Copy link
Member

llvmbot commented Jul 8, 2025

@llvm/pr-subscribers-clang-tools-extra

Author: Aiden Grossman (boomanaiden154)

Changes

This patch switches over uses of use_clang to clang_setup to fix a
potential race condition that has been impacting CI.

This is split from the refactoring to ensure I'm not missing anything
major here on the clang-tools-extra side.

This should fix #145703.


Full diff: https://github.com/llvm/llvm-project/pull/147437.diff

2 Files Affected:

  • (modified) clang-tools-extra/clangd/test/lit.cfg.py (+1-1)
  • (modified) clang-tools-extra/test/lit.cfg.py (+1-1)
diff --git a/clang-tools-extra/clangd/test/lit.cfg.py b/clang-tools-extra/clangd/test/lit.cfg.py
index 489726bc9429b..8ab4309e337d1 100644
--- a/clang-tools-extra/clangd/test/lit.cfg.py
+++ b/clang-tools-extra/clangd/test/lit.cfg.py
@@ -1,7 +1,7 @@
 import lit.llvm
 
 lit.llvm.initialize(lit_config, config)
-lit.llvm.llvm_config.use_clang([], [], required=False)
+lit.llvm.llvm_config.clang_setup()
 lit.llvm.llvm_config.use_default_substitutions()
 
 config.name = "Clangd"
diff --git a/clang-tools-extra/test/lit.cfg.py b/clang-tools-extra/test/lit.cfg.py
index 9f64fd3d2ffa2..bc82a14a0aed1 100644
--- a/clang-tools-extra/test/lit.cfg.py
+++ b/clang-tools-extra/test/lit.cfg.py
@@ -42,7 +42,7 @@
 config.test_exec_root = os.path.join(config.clang_tools_binary_dir, "test")
 
 # Tools need the same environment setup as clang (we don't need clang itself).
-llvm_config.use_clang(required=False)
+llvm_config.clang_setup()
 
 if config.clang_tidy_staticanalyzer:
     config.available_features.add("static-analyzer")

@AaronBallman
Copy link
Collaborator

Thank you for working on this! FWIW, I don't feel confident I can give a meaningful review given how little I know about this. @petrhosek would you be comfortable reviewing this, or know someone who would be?

@boomanaiden154
Copy link
Contributor Author

Forgot to mention but this depends on #147436. We're essentially running the same setup code, just without the part that actually depends on clang being present.

Created using spr 1.3.4

[skip ci]
Created using spr 1.3.4
@boomanaiden154 boomanaiden154 changed the base branch from users/boomanaiden154/main.clang-prefer-clang_setup-over-use_clang to main July 9, 2025 00:54
boomanaiden154 added a commit to boomanaiden154/llvm-project that referenced this pull request Jul 9, 2025
This patch switches over uses of use_clang to clang_setup to fix a
potential race condition that has been impacting CI.

This is split from the refactoring to ensure I'm not missing anything
major here on the clang-tools-extra side.

This should fix llvm#145703.

Pull Request: llvm#147437
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants