[clang] clang-format: Add -disable-format option (PR #137617)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 28 04:13:50 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/clang-format/ClangFormat.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/tools/clang-format/ClangFormat.cpp b/clang/tools/clang-format/ClangFormat.cpp
index da3d7edf2..d7cc37e79 100644
--- a/clang/tools/clang-format/ClangFormat.cpp
+++ b/clang/tools/clang-format/ClangFormat.cpp
@@ -513,8 +513,10 @@ static bool format(StringRef FileName, bool ErrorOnIncompleteFormat = false) {
Ranges = tooling::calculateRangesAfterReplacements(Replaces, Ranges);
FormattingAttemptStatus Status;
Replacements FormatChanges;
- if (DisableFormat.getNumOccurrences() == 0 || !DisableFormat)
- FormatChanges = reformat(*FormatStyle, *ChangedCode, Ranges, AssumedFileName, &Status);
+ if (DisableFormat.getNumOccurrences() == 0 || !DisableFormat) {
+ FormatChanges =
+ reformat(*FormatStyle, *ChangedCode, Ranges, AssumedFileName, &Status);
+ }
Replaces = Replaces.merge(FormatChanges);
if (DryRun) {
return Replaces.size() > (IsJson ? 1u : 0u) &&
``````````
</details>
https://github.com/llvm/llvm-project/pull/137617
More information about the cfe-commits
mailing list