[clang] [clang-format] Fix working -assume-filename with .clang-format-ignore (PR #113100)

via cfe-commits cfe-commits at lists.llvm.org
Sun Oct 20 13:48:08 PDT 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 d1401822e2d2753bed3ac597a42cc0b261de40a4 74e9d297f6090d77e52dd93fa356f37cf1afc2f7 --extensions cpp -- clang/test/Format/clang-format-ignore.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 84eaf32cc4..4f4a1b2c6b 100644
--- a/clang/tools/clang-format/ClangFormat.cpp
+++ b/clang/tools/clang-format/ClangFormat.cpp
@@ -708,9 +708,8 @@ int main(int argc, const char **argv) {
   }
 
   if (FileNames.empty()) {
-    if (!AssumeFileName.empty() && isIgnored(AssumeFileName)) {
+    if (!AssumeFileName.empty() && isIgnored(AssumeFileName))
       return 0;
-    }
     return clang::format::format("-", FailOnIncompleteFormat);
   }
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/113100


More information about the cfe-commits mailing list