Skip to content

Commit

Permalink
[clang-format] Add text proto filename detection
Browse files Browse the repository at this point in the history
Summary: Adds text proto filename detection.

Reviewers: klimek

Reviewed By: klimek

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D40120

llvm-svn: 318525
  • Loading branch information
krasimirgg committed Nov 17, 2017
1 parent cac5214 commit 6649665
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions clang/lib/Format/Format.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 6649665

Please sign in to comment.