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

via cfe-commits cfe-commits at lists.llvm.org
Sat Apr 11 15:43:26 PDT 2026


owenca 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`.

Good point. Anyway, it seems that this patch wouldn't interfere with the command-line option I suggested.

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


More information about the cfe-commits mailing list