[clang-tools-extra] [clang-tidy][NFC] Enable `bugprone-unchecked-optional-access` in `clang-tidy` config and fix warnings (PR #170004)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 3 08:31:18 PST 2025
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 origin/main HEAD --extensions h,cpp -- clang-tools-extra/clang-tidy/ClangTidy.cpp clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp clang-tools-extra/clang-tidy/ClangTidyProfiling.cpp clang-tools-extra/clang-tidy/ClangTidyProfiling.h clang-tools-extra/clang-tidy/abseil/TimeSubtractionCheck.cpp clang-tools-extra/clang-tidy/bugprone/EasilySwappableParametersCheck.cpp clang-tools-extra/clang-tidy/bugprone/RedundantBranchConditionCheck.cpp clang-tools-extra/clang-tidy/readability/FunctionSizeCheck.cpp clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp clang-tools-extra/clang-tidy/utils/ExceptionAnalyzer.cpp clang-tools-extra/clang-tidy/utils/FormatStringConverter.cpp clang-tools-extra/clang-tidy/utils/UseRangesCheck.cpp --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang-tools-extra/clang-tidy/bugprone/EasilySwappableParametersCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/EasilySwappableParametersCheck.cpp
index cfefaeb76..4acbdf16c 100644
--- a/clang-tools-extra/clang-tidy/bugprone/EasilySwappableParametersCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/EasilySwappableParametersCheck.cpp
@@ -1175,7 +1175,8 @@ public:
}
if (HowManyGoodConversions == 1) {
- assert(BestConversion && "BestConversion must be set if HowManyGoodConversions is 1");
+ assert(BestConversion &&
+ "BestConversion must be set if HowManyGoodConversions is 1");
LLVM_DEBUG(llvm::dbgs()
<< "--- selectUserDefinedConv. Unique result. Flags: "
<< formatMixFlags(BestConversion->Flags) << '\n');
``````````
</details>
https://github.com/llvm/llvm-project/pull/170004
More information about the cfe-commits
mailing list