[clang-tools-extra] [clang-tidy] Fix modernize-loop-convert by introducing space (PR #202015)
via cfe-commits
cfe-commits at lists.llvm.org
Sat Jun 6 00:30:53 PDT 2026
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 cpp,h -- clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp clang-tools-extra/test/clang-tidy/checkers/modernize/Inputs/loop-convert/structures.h clang-tools-extra/test/clang-tidy/checkers/modernize/loop-convert-basic.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/modernize/LoopConvertCheck.cpp b/clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp
index 2f342490d..875654b81 100644
--- a/clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp
@@ -722,8 +722,8 @@ void LoopConvertCheck::doConversion(
// If this is an access to a member through the arrow operator, after
// the replacement it must be accessed through the '.' operator.
ReplaceText += Usage.Kind == Usage::UK_MemberThroughArrow
- ? VarNameOrStructuredBinding + "."
- : VarNameOrStructuredBinding;
+ ? VarNameOrStructuredBinding + "."
+ : VarNameOrStructuredBinding;
const DynTypedNodeList Parents = Context->getParents(*Usage.Expression);
if (Parents.size() == 1) {
if (const auto *Paren = Parents[0].get<ParenExpr>()) {
``````````
</details>
https://github.com/llvm/llvm-project/pull/202015
More information about the cfe-commits
mailing list