From 3b37fe8026419b0e1e90439572412f7cc870e263 Mon Sep 17 00:00:00 2001 From: Krasimir Georgiev Date: Wed, 25 Apr 2018 14:56:19 +0000 Subject: [PATCH] [clang-format] Start formatting cpp code in raw strings in google style Summary: This adds some delimiters to detect cpp code in raw strings. Reviewers: klimek Reviewed By: klimek Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D46062 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@330832 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Format/Format.cpp | 43 +++++++++++++++++++++++++++++++------------ 1 file changed, 31 insertions(+), 12 deletions(-) diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp index e2d25657c7..2c23600430 100644 --- a/lib/Format/Format.cpp +++ b/lib/Format/Format.cpp @@ -718,20 +718,39 @@ FormatStyle getGoogleStyle(FormatStyle::LanguageKind Language) { GoogleStyle.ObjCSpaceAfterProperty = false; GoogleStyle.ObjCSpaceBeforeProtocolList = true; GoogleStyle.PointerAlignment = FormatStyle::PAS_Left; - GoogleStyle.RawStringFormats = {{ - FormatStyle::LK_TextProto, - /*Delimiters=*/ + GoogleStyle.RawStringFormats = { { - "pb", - "PB", - "proto", - "PROTO", + FormatStyle::LK_Cpp, + /*Delimiters=*/ + { + "cc", + "CC", + "cpp", + "Cpp", + "CPP", + "c++", + "C++", + }, + /*EnclosingFunctionNames=*/ + {}, + /*CanonicalDelimiter=*/"", + /*BasedOnStyle=*/"google", }, - /*EnclosingFunctionNames=*/ - {}, - /*CanonicalDelimiter=*/"", - /*BasedOnStyle=*/"google", - }}; + { + FormatStyle::LK_TextProto, + /*Delimiters=*/ + { + "pb", + "PB", + "proto", + "PROTO", + }, + /*EnclosingFunctionNames=*/ + {}, + /*CanonicalDelimiter=*/"", + /*BasedOnStyle=*/"google", + }, + }; GoogleStyle.SpacesBeforeTrailingComments = 2; GoogleStyle.Standard = FormatStyle::LS_Auto; -- 2.40.0