[clang-tools-extra] [clang-reorder-fields] Prevent rewriting unsupported cases (PR #142149)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 16 07:20:02 PDT 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 HEAD~1 HEAD --extensions cpp -- clang-tools-extra/test/clang-reorder-fields/MacroExpandsToMultipleFields.cpp clang-tools-extra/test/clang-reorder-fields/MultipleFieldDeclsInStatement.cpp clang-tools-extra/test/clang-reorder-fields/PreprocessorDirectiveAroundDefinition.cpp clang-tools-extra/test/clang-reorder-fields/PreprocessorDirectiveAroundFields.cpp clang-tools-extra/test/clang-reorder-fields/PreprocessorDirectiveInDefinition.cpp clang-tools-extra/clang-reorder-fields/ReorderFieldsAction.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang-tools-extra/clang-reorder-fields/ReorderFieldsAction.cpp b/clang-tools-extra/clang-reorder-fields/ReorderFieldsAction.cpp
index 20cb0f7e7..90eb2d33f 100644
--- a/clang-tools-extra/clang-reorder-fields/ReorderFieldsAction.cpp
+++ b/clang-tools-extra/clang-reorder-fields/ReorderFieldsAction.cpp
@@ -83,7 +83,7 @@ static bool isSafeToRewrite(const RecordDecl *Decl, const ASTContext &Context) {
// start of the first field and the end of last field.
const SourceManager &SM = Context.getSourceManager();
std::pair<FileID, unsigned> FileAndOffset =
- SM.getDecomposedLoc(Decl->field_begin()->getBeginLoc());
+ SM.getDecomposedLoc(Decl->field_begin()->getBeginLoc());
auto LastField = Decl->field_begin();
while (std::next(LastField) != Decl->field_end())
++LastField;
``````````
</details>
https://github.com/llvm/llvm-project/pull/142149
More information about the cfe-commits
mailing list