[clang] [clang-format] Detect language for file templates (PR #191502)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Apr 12 16:18:03 PDT 2026
================
@@ -4427,7 +4427,13 @@ const char *StyleOptionHelpDescription =
"4. \"{key: value, ...}\" to set specific parameters, e.g.:\n"
" --style=\"{BasedOnStyle: llvm, IndentWidth: 8}\"";
-static FormatStyle::LanguageKind getLanguageByFileName(StringRef FileName) {
+static FormatStyle::LanguageKind getLanguageByFileName(StringRef &FileName) {
+ constexpr std::array TemplateSuffixes{StringRef{".in"},
+ StringRef{".template"}};
----------------
owenca wrote:
Not dropping, but replacing with `llvm::StringLiteral` to be consistent with line 3321:
```c++
static constexpr llvm::StringLiteral FoundationIdentifiers[] = {
```
https://github.com/llvm/llvm-project/pull/191502
More information about the cfe-commits
mailing list