[clang] [clang-format] Make ignored files unformatted instead of empty. (PR #170416)

via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 4 23:18:38 PST 2025


================
@@ -701,9 +711,8 @@ int main(int argc, const char **argv) {
   }
 
   if (FileNames.empty()) {
-    if (isIgnored(AssumeFileName))
-      return 0;
-    return clang::format::format("-", FailOnIncompleteFormat);
+    return clang::format::format("-", FailOnIncompleteFormat,
+                                 isIgnored(AssumeFileName));
----------------
owenca wrote:

```suggestion
    if (isIgnored(AssumeFileName)) {
      outs() << MemoryBuffer::getSTDIN()->get()->getBuffer();
      return 0;
    }
    return clang::format::format("-", FailOnIncompleteFormat);
```
And leave the rest of the function alone.

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


More information about the cfe-commits mailing list