summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/Format.cpp
diff options
context:
space:
mode:
authorKrasimir Georgiev <krasimir@google.com>2017-11-17 15:10:49 +0000
committerKrasimir Georgiev <krasimir@google.com>2017-11-17 15:10:49 +0000
commit6649665d5a1670a74f93b1efdc3bac6a21b6644a (patch)
tree002e3c47131b4643e31b8b9b8b36ac2f57adc47a /clang/lib/Format/Format.cpp
parentcac52140bc1dae17418bcc8753cf3863a8d865cf (diff)
downloadbcm5719-llvm-6649665d5a1670a74f93b1efdc3bac6a21b6644a.tar.gz
bcm5719-llvm-6649665d5a1670a74f93b1efdc3bac6a21b6644a.zip
[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 llvm-svn: 318525
Diffstat (limited to 'clang/lib/Format/Format.cpp')
-rw-r--r--clang/lib/Format/Format.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index dfeb5d9d079..200f2b27cd4 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/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;
OpenPOWER on IntegriCloud