[clang-tools-extra] [clangd] Add `HeaderInsertion` yaml config option (PR #128503)
Nathan Ridge via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 22 23:56:35 PDT 2025
HighCommander4 wrote:
> unfortunately, LLVM's command-line argument framework doesn't allow us to distinguish between "the option's value is `IWYU` because the flag `--header-insertion=iwyu` appeared in the command line" and "the option's value is `IWYU` because no `--header-insertion` flag appeared in the command line and `IWYU` is the default"
It looks like I was mistaken about this: there is an [`Option::getNumOccurrences()`](https://searchfox.org/llvm/rev/3d91a71223801bb73ab3e4ff8ab3f883639ed79f/llvm/include/llvm/Support/CommandLine.h#399) method that allows us to distinguish between these two cases.
So, if you'd like, we could revisit this and make the behaviour more consistent (e.g. so that `--header-insertion` always overrides `HeaderInsertion` if it was actually passed, or vice versa).
https://github.com/llvm/llvm-project/pull/128503
More information about the cfe-commits
mailing list