[clang] [Format] Fix detection of languages when reading from stdin (PR #79051)

Ben Hamilton via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 22 12:43:36 PST 2024


================
@@ -0,0 +1,5 @@
+// RUN: clang-format -dump-config - < %s | FileCheck %s
----------------
bhamiltoncx wrote:

In this case, we do want two tests (at least, we do need the integration test in `clang/test/Format/dump-config-objc-stdin.m` to reproduce the issue).

The reason is, the bug was introduced into `ClangFormat.cpp`, which is only linked into the `clang-format` binary executed by the integration test. The code which regressed is not actually part of the `Format` library which is executed via the unit tests.

The unit tests do not execute the `clang-format` binary; they directly execute the formatting / config dumping logic via the `Format` library. But they're much faster to build and run, and it's possible this might regress in the `Format` library in the future (I was just surprised there were no tests there).

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


More information about the cfe-commits mailing list