[clang-tools-extra] [clangd] Fix use-after-free issues in TidyProvider.cpp (PR #114808)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 4 07:08:46 PST 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 0653698d8637b8d565cbf59de591e2d8c61c20cc 38c41b134b7092d880ba349bcca1a7bb6887d1dc --extensions cpp -- clang-tools-extra/clangd/TidyProvider.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang-tools-extra/clangd/TidyProvider.cpp b/clang-tools-extra/clangd/TidyProvider.cpp
index f35cf9f0ab..f94e095492 100644
--- a/clang-tools-extra/clangd/TidyProvider.cpp
+++ b/clang-tools-extra/clangd/TidyProvider.cpp
@@ -160,7 +160,8 @@ TidyProviderRef provideEnvironment() {
}();
if (User) {
- static const auto Provider = [](tidy::ClangTidyOptions &Opts, llvm::StringRef) { Opts.User = User; };
+ static const auto Provider = [](tidy::ClangTidyOptions &Opts,
+ llvm::StringRef) { Opts.User = User; };
return Provider;
}
// FIXME: Once function_ref and unique_function operator= operators handle
@@ -181,7 +182,7 @@ TidyProviderRef provideDefaultChecks() {
"bugprone-suspicious-missing-comma", "bugprone-unused-raii",
"bugprone-unused-return-value", "misc-unused-using-decls",
"misc-unused-alias-decls", "misc-definitions-in-headers");
- static auto Provider = [](tidy::ClangTidyOptions &Opts, llvm::StringRef) {
+ static auto Provider = [](tidy::ClangTidyOptions &Opts, llvm::StringRef) {
if (!Opts.Checks || Opts.Checks->empty())
Opts.Checks = DefaultChecks;
};
@@ -256,7 +257,8 @@ TidyProvider disableUnusableChecks(llvm::ArrayRef<std::string> ExtraBadChecks) {
}
TidyProviderRef provideClangdConfig() {
- static const auto Provider = [](tidy::ClangTidyOptions &Opts, llvm::StringRef) {
+ static const auto Provider = [](tidy::ClangTidyOptions &Opts,
+ llvm::StringRef) {
const auto &CurTidyConfig = Config::current().Diagnostics.ClangTidy;
if (!CurTidyConfig.Checks.empty())
mergeCheckList(Opts.Checks, CurTidyConfig.Checks);
``````````
</details>
https://github.com/llvm/llvm-project/pull/114808
More information about the cfe-commits
mailing list