[clang-tools-extra] [clangd] Add an early initialization hook to FeatureModule (PR #225198)

via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 21 14:04:56 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clangd

Author: Aleksandr Platonov (ArcsinX)

<details>
<summary>Changes</summary>

This is a follow-up to the FeatureModule extension in #<!-- -->221054.

Feature modules may need to configure diagnostics before frontend initialization. Both `beforePPCallbacks()` and `beforeExecute()` run after `BeginSourceFile()`, which can already emit diagnostics while initializing the preprocessor or loading precompiled modules.

This change adds `beforeBeginSourceFile()` for configuration that must precede `BeginSourceFile()` during main-file builds.

For example, clang-tidy applies warning options from `ExtraArgs` and `ExtraArgsBefore` before `BeginSourceFile()`. The new hook allows this configuration to move into a feature module without changing when those options take effect.

These changes prepare moving the clang-tidy implementation into a FeatureModule.
RFC: https://discourse.llvm.org/t/rfc-clangd-move-clang-tidy-integration-into-a-featuremodule/91707

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


3 Files Affected:

- (modified) clang-tools-extra/clangd/FeatureModule.h (+11) 
- (modified) clang-tools-extra/clangd/ParsedAST.cpp (+2) 
- (modified) clang-tools-extra/clangd/unittests/FeatureModulesTests.cpp (+63-1) 


``````````diff
The server is unavailable at this time. Please wait a few minutes before you try again.
``````````

</details>


https://github.com/llvm/llvm-project/pull/225198


More information about the cfe-commits mailing list