[llvm] [bazel] Fix Clang layering check dependencies (PR #218233)
Corentin Kerisit via llvm-commits
llvm-commits at lists.llvm.org
Sun Aug 23 05:08:32 PDT 2026
https://github.com/cerisier created https://github.com/llvm/llvm-project/pull/218233
## Summary
- Add direct Clang Bazel dependencies required by includes introduced in 3ff8254afdb2 (#216946).
- Add the SSAF source-transformation dependencies required by 2f4a2d57cbea (#210457).
## Motivation
Bazel layering checks require each compilation target to depend directly on the target exporting every directly included header. These source changes left the Bazel overlay dependencies stale. Because the Bazel workflow is triggered by changes under utils/bazel, the culprit PRs did not exercise this lane.
## Changes
- Route Preprocessor and Lexer headers through //clang:lex.
- Route AnalyzerOptions.h through the narrow //clang:static_analyzer_core_options target.
- Route SSA source-transformation private analysis headers through //clang:scalable_static_analysis_analyses.
## Verification
- Reproduced the six layering violations reported by the Bazel Build/Test job on #218187.
- Built all seven affected targets with the hermetic remote toolchain after the fix.
- Inspected their generated compile actions for the expected module maps.
- Analyzed all 10,062 Bazel targets: no remaining layering diagnostics. The broad macOS cross-platform build had unrelated libc and MLIR failures.
- buildifier -mode=check on both modified BUILD files.
>From 5160befb26a257728ba309f529715eef23a94c6a Mon Sep 17 00:00:00 2001
From: Corentin Kerisit <corentin.kerisit at gmail.com>
Date: Sun, 23 Aug 2026 21:06:51 +0900
Subject: [PATCH] [bazel] Fix Clang layering check dependencies
---
utils/bazel/llvm-project-overlay/clang/BUILD.bazel | 6 ++++++
.../bazel/llvm-project-overlay/clang/unittests/BUILD.bazel | 2 ++
2 files changed, 8 insertions(+)
diff --git a/utils/bazel/llvm-project-overlay/clang/BUILD.bazel b/utils/bazel/llvm-project-overlay/clang/BUILD.bazel
index c0ba58b479830..a331f6bab2c4d 100644
--- a/utils/bazel/llvm-project-overlay/clang/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/clang/BUILD.bazel
@@ -1312,6 +1312,7 @@ cc_library(
deps = [
":basic",
":frontend",
+ ":lex",
"//llvm:MC",
"//llvm:Support",
"//third-party/unittest:gtest",
@@ -1511,6 +1512,7 @@ cc_library(
":driver",
":frontend",
":index",
+ ":static_analyzer_core_options",
":unified_symbol_resolution",
"//llvm:Option",
"//llvm:Support",
@@ -2137,6 +2139,7 @@ cc_library(
":ast",
":basic",
":frontend",
+ ":lex",
":support",
"//llvm:Core",
"//llvm:Demangle",
@@ -2199,6 +2202,7 @@ cc_library(
":scalable_static_analysis_core",
":scalable_static_analysis_frontend",
":scalable_static_analysis_source_transformation",
+ ":static_analyzer_core_options",
":static_analyzer_frontend",
"//llvm:Option",
"//llvm:Support",
@@ -2770,6 +2774,8 @@ cc_library(
deps = [
":ast",
":basic",
+ ":lex",
+ ":scalable_static_analysis_analyses",
":scalable_static_analysis_core",
":support",
":tooling_core",
diff --git a/utils/bazel/llvm-project-overlay/clang/unittests/BUILD.bazel b/utils/bazel/llvm-project-overlay/clang/unittests/BUILD.bazel
index 627c91e812a2a..590e42980aa28 100644
--- a/utils/bazel/llvm-project-overlay/clang/unittests/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/clang/unittests/BUILD.bazel
@@ -304,6 +304,7 @@ cc_test(
"//clang:lex",
"//clang:sema",
"//clang:serialization",
+ "//clang:static_analyzer_core_options",
"//clang:tooling",
"//llvm:Option",
"//llvm:Support",
@@ -600,6 +601,7 @@ cc_test(
"//clang:ast",
"//clang:crosstu",
"//clang:frontend",
+ "//clang:static_analyzer_core_options",
"//clang:tooling",
"//llvm:Support",
"//third-party/unittest:gtest",
More information about the llvm-commits
mailing list