llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clangd Author: Mythreya (MythreyaK) <details> <summary>Changes</summary> In PR #<!-- -->128503, CLI option overwrites only if it was set to `never`. This commit ensures that CLI options always overwrite any config option. Thanks to the fix from @<!-- -->HighCommander4 [here](https://github.com/llvm/llvm-project/pull/128503#issuecomment-2823259618)! --- Full diff: https://github.com/llvm/llvm-project/pull/146235.diff 1 Files Affected: - (modified) clang-tools-extra/clangd/tool/ClangdMain.cpp (+2-8) ``````````diff diff --git a/clang-tools-extra/clangd/tool/ClangdMain.cpp b/clang-tools-extra/clangd/tool/ClangdMain.cpp index b11d194da04db..f287439f10cab 100644 --- a/clang-tools-extra/clangd/tool/ClangdMain.cpp +++ b/clang-tools-extra/clangd/tool/ClangdMain.cpp @@ -668,7 +668,6 @@ class FlagsConfigProvider : public config::Provider { std::optional<Config::ExternalIndexSpec> IndexSpec; std::optional<Config::BackgroundPolicy> BGPolicy; std::optional<Config::ArgumentListsPolicy> ArgumentLists; - std::optional<Config::HeaderInsertionPolicy> HeaderInsertionPolicy; // If --compile-commands-dir arg was invoked, check value and override // default path. @@ -713,11 +712,6 @@ class FlagsConfigProvider : public config::Provider { BGPolicy = Config::BackgroundPolicy::Skip; } - // If CLI has set never, use that regardless of what the config files have - if (HeaderInsertion == Config::HeaderInsertionPolicy::NeverInsert) { - HeaderInsertionPolicy = Config::HeaderInsertionPolicy::NeverInsert; - } - if (std::optional<bool> Enable = shouldEnableFunctionArgSnippets()) { ArgumentLists = *Enable ? Config::ArgumentListsPolicy::FullPlaceholders : Config::ArgumentListsPolicy::Delimiters; @@ -732,8 +726,8 @@ class FlagsConfigProvider : public config::Provider { C.Index.Background = *BGPolicy; if (ArgumentLists) C.Completion.ArgumentLists = *ArgumentLists; - if (HeaderInsertionPolicy) - C.Completion.HeaderInsertion = *HeaderInsertionPolicy; + if (HeaderInsertion.getNumOccurrences()) + C.Completion.HeaderInsertion = HeaderInsertion; if (AllScopesCompletion.getNumOccurrences()) C.Completion.AllScopes = AllScopesCompletion; `````````` </details> https://github.com/llvm/llvm-project/pull/146235 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits