From 32a800c6e8020bfdfe834db089fb06ed955dda42 Mon Sep 17 00:00:00 2001 From: Krasimir Georgiev Date: Fri, 17 Nov 2017 15:10:49 +0000 Subject: [PATCH] [clang-format] Add text proto filename detection Summary: Adds text proto filename detection. Reviewers: klimek Reviewed By: klimek Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D40120 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@318525 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Format/Format.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp index dfeb5d9d07..200f2b27cd 100644 --- a/lib/Format/Format.cpp +++ b/lib/Format/Format.cpp @@ -2084,6 +2084,11 @@ static FormatStyle::LanguageKind getLanguageByFileName(StringRef FileName) { if (FileName.endswith_lower(".proto") || FileName.endswith_lower(".protodevel")) return FormatStyle::LK_Proto; + if (FileName.endswith_lower(".textpb") || + FileName.endswith_lower(".pb.txt") || + FileName.endswith_lower(".textproto") || + FileName.endswith_lower(".asciipb")) + return FormatStyle::LK_TextProto; if (FileName.endswith_lower(".td")) return FormatStyle::LK_TableGen; return FormatStyle::LK_Cpp; -- 2.50.1