HighCommander4 wrote: > > To get the command line flag to interact with the config option better, we > > need to handle it in > > [`FlagsConfigProvider`](https://searchfox.org/llvm/rev/107aa6a3d3ab96b7eec55e1ec5c3eabfa6ab2f9f/clang-tools-extra/clangd/tool/ClangdMain.cpp#655), > > which gives the command-line flag the ability to influence the value of > > `Config::current().HeaderInsertion.Policy`. > > We have a few options regarding the precedence, but I think the simplest to > > implement is to handle it similar to --background-index > > [here](https://searchfox.org/llvm/rev/107aa6a3d3ab96b7eec55e1ec5c3eabfa6ab2f9f/clang-tools-extra/clangd/tool/ClangdMain.cpp#711-713): > > if the flag's value is NeverInsert, then write that into the config > > object, otherwise leave it alone. > > Clarification, so if the user has `IWYU` in CLI, but `never` in the config, > `never` is what will be used?
Yes. I realize that's asymmetric; 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). In practice, I think this is fine because explicitly passing `--header-insertion=iwyu` is likely to be uncommon, since it's the default anyways. https://github.com/llvm/llvm-project/pull/128503 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits