[clang] [clang-format] Detect language for file templates (PR #191502)

Björn Schäpers via cfe-commits cfe-commits at lists.llvm.org
Sat Apr 11 12:27:27 PDT 2026


HazardyKnusperkeks wrote:

> I think it should be opt in. See [#191295 (comment)](https://github.com/llvm/llvm-project/issues/191295#issuecomment-4228702589).

I disagree, that should work out of the box and there isn't any harm here. The extensions are currently mapped to C++. I don't think there are e.g. `foo.java.in` files which are currently formatted as C++ and afterwards they would be formatted as Java.

Files like `config.h.in` or similar are quite common, and it should "just work", when they need to be parsed as C instead of C++.

A command line option is cumbersome, especially if you just want to use e.g. `git clang-format`.

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


More information about the cfe-commits mailing list