r318525 - [clang-format] Add text proto filename detection

Krasimir Georgiev via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 17 07:10:49 PST 2017


Author: krasimir
Date: Fri Nov 17 07:10:49 2017
New Revision: 318525

URL: http://llvm.org/viewvc/llvm-project?rev=318525&view=rev
Log:
[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

Modified:
    cfe/trunk/lib/Format/Format.cpp

Modified: cfe/trunk/lib/Format/Format.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=318525&r1=318524&r2=318525&view=diff
==============================================================================
--- cfe/trunk/lib/Format/Format.cpp (original)
+++ cfe/trunk/lib/Format/Format.cpp Fri Nov 17 07:10:49 2017
@@ -2084,6 +2084,11 @@ static FormatStyle::LanguageKind getLang
   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;




More information about the cfe-commits mailing list