Skip to content

Commit d2d531e

Browse files
authored
[clang][Serialization] Stop including Frontend headers from Serialization (NFC) (#123140)
The Frontend library depends on Serialization. This is an explicit dependency encoded in the CMake target. However, Serialization currently has an implicit dependency on Frontend, as it includes one of its headers. This is not reflected in the CMake build rules, but Bazel is stricter so, in order to avoid a dependency cycle, it hackily declares the Frontend headers as source files for Serialization. Fortunately, the only Frontend header used by Serialization is clang/Frontend/FrontendDiagnostic.h, which is a legacy header that just includes clang/Basic/DiagnosticFrontend since d076608, back in 2018. This commit changes Serialization to use the underlying header from Basic instead. Both Serialization and Frontend depend on Basic, so this breaks the dependency cycle.
1 parent a0406ce commit d2d531e

File tree

2 files changed

+1
-6
lines changed

2 files changed

+1
-6
lines changed

clang/lib/Serialization/GeneratePCH.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
//===----------------------------------------------------------------------===//
1313

1414
#include "clang/AST/ASTContext.h"
15-
#include "clang/Frontend/FrontendDiagnostic.h"
15+
#include "clang/Basic/DiagnosticFrontend.h"
1616
#include "clang/Lex/HeaderSearch.h"
1717
#include "clang/Lex/HeaderSearchOptions.h"
1818
#include "clang/Lex/Preprocessor.h"

utils/bazel/llvm-project-overlay/clang/BUILD.bazel

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2148,7 +2148,6 @@ cc_library(
21482148
"include/clang/Serialization/AttrPCHRead.inc",
21492149
"include/clang/Serialization/AttrPCHWrite.inc",
21502150
] + glob([
2151-
"include/clang/Frontend/*.h",
21522151
"lib/Serialization/*.cpp",
21532152
"lib/Serialization/*.h",
21542153
]),
@@ -2160,15 +2159,11 @@ cc_library(
21602159
"include/clang/Serialization/*.def",
21612160
]),
21622161
deps = [
2163-
":apinotes",
21642162
":ast",
21652163
":basic",
2166-
":driver",
21672164
":lex",
21682165
":sema",
21692166
":serialization_attr_gen",
2170-
":static_analyzer_core_options",
2171-
":support",
21722167
":type_nodes_gen",
21732168
"//llvm:BitReader",
21742169
"//llvm:BitWriter",

0 commit comments

Comments
 (0)