Skip to content

Conversation

@naveen-seth
Copy link
Contributor

@naveen-seth naveen-seth commented Oct 27, 2025

This removes the dependency on clangDriver from clangFrontend and flangFrontend

This refactoring is part of a broader effort to support driver-managed builds for compilations using C++ named modules and/or Clang modules.
It is required for linking the dependency scanning tooling against the driver without introducing cyclic dependencies, which would otherwise cause build failures when dynamic linking is enabled.
In particular, clangFrontend must no longer depend on clangDriver for this to be possible.

This change is motivated by the following review comment: #152770 (comment)

@naveen-seth naveen-seth requested a review from Bigcheese October 27, 2025 16:38
@llvmbot llvmbot added clang Clang issues not falling into any other category clang-tools-extra lldb backend:ARM backend:AArch64 backend:AMDGPU backend:Hexagon backend:MIPS backend:RISC-V backend:PowerPC backend:Sparc backend:SystemZ backend:X86 clangd clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' clang:frontend Language frontend issues, e.g. anything involving "Sema" clang:modules C++20 modules and Clang Header Modules clang:as-a-library libclang and C++ API llvm:mc Machine (object) code flang:driver flang Flang issues not falling into any other category backend:CSKY backend:SPIR-V backend:loongarch labels Oct 27, 2025
@naveen-seth naveen-seth force-pushed the removeDriverDepFromFrontend branch from 65b3857 to 49db4fc Compare October 27, 2025 16:43
@naveen-seth
Copy link
Contributor Author

Hi, this requires #163659 to be merged first. Currently, the first commit here duplicates the changes from #163659. I will force-push to remove it once that PR is merged.

@naveen-seth naveen-seth force-pushed the removeDriverDepFromFrontend branch from 49db4fc to 6380c54 Compare October 27, 2025 19:35
@naveen-seth
Copy link
Contributor Author

Note: Linux AArch64 CI is currently having trouble (failing everywhere), which is why this isn't passing all checks.

@naveen-seth naveen-seth force-pushed the removeDriverDepFromFrontend branch 3 times, most recently from 7dd2dd8 to cc10a13 Compare October 31, 2025 16:01
@naveen-seth naveen-seth changed the title [clang] Remove clangDriver dependency from clangFrontend (NFC) [clang] Refactor to remove clangDriver dependency from clangFrontend Oct 31, 2025
@naveen-seth
Copy link
Contributor Author

I've tested this with BUILD_SHARED_LIBS=On for clang, clang-tools-extra, lldb and flang, including the CMake targets check-clang-unit, check-flang-unit, and check-lldb-unit.


CLANG_LIBS
clangBasic
clangDriver
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reading the title of the patch I was hoping that you could remove the clangDriver dependency from flangFrontend as well. Any reason you could not remove?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, and thanks for pointing that out!

…ns library

This change moves option-related code from clangDriver into a new
clangOptions library.

This refactoring is part of a broader effort to support driver-managed
builds for compilations using C++ named modules and/or Clang modules.
It is required for linking the dependency scanning tooling against the
driver without introducing cyclic dependencies, which would otherwise
cause build failures when dynamic linking is enabled.
In particular, clangFrontend must no longer depend on clangDriver for
this to be possible.

This PR is motivated by the following review comment:
llvm#152770 (comment)
This PR removes the clangDriver dependency from clangFrontend.
The goal of this change is to remove dependencies on the Driver.

This refactoring is part of a broader effort to support driver-managed
builds for compilations using C++ named modules and/or Clang modules.
It is required for linking the dependency scanning tooling against the
driver without introducing cyclic dependencies, which would otherwise
cause build failures when dynamic linking is enabled.
In particular, clangFrontend must no longer depend on clangDriver for
this to be possible.

This change is motivated by the following review comment:
llvm#152770 (comment)
@naveen-seth naveen-seth force-pushed the removeDriverDepFromFrontend branch from e978ccd to 080ace2 Compare November 1, 2025 21:13
@naveen-seth naveen-seth changed the title [clang] Refactor to remove clangDriver dependency from clangFrontend [clang] Refactor to remove clangDriver dependency from clangFrontend and flangFrontentd Nov 1, 2025
Copy link
Contributor

@tarunprabhu tarunprabhu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making the changes in flang as well. Those LGTM.

Since the majority of the changes are in clang, I'll defer to someone from there to approve.

@tarunprabhu
Copy link
Contributor

tarunprabhu commented Nov 4, 2025

[EDIT]

Just noticed the typo in the title: flangFrontentd should be flangFrontend

  • My original message was: "Just noticed the type in the title: ...". Ah the irony!

@naveen-seth naveen-seth changed the title [clang] Refactor to remove clangDriver dependency from clangFrontend and flangFrontentd [clang] Refactor to remove clangDriver dependency from clangFrontend and flangFrontend Nov 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend:AArch64 backend:AMDGPU backend:ARM backend:CSKY backend:Hexagon backend:loongarch backend:MIPS backend:PowerPC backend:RISC-V backend:Sparc backend:SPIR-V backend:SystemZ backend:X86 bazel "Peripheral" support tier build system: utils/bazel clang:as-a-library libclang and C++ API clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' clang:frontend Language frontend issues, e.g. anything involving "Sema" clang:modules C++20 modules and Clang Header Modules clang:openmp OpenMP related changes to Clang clang Clang issues not falling into any other category clang-tools-extra clangd flang:driver flang Flang issues not falling into any other category lldb llvm:mc Machine (object) code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants