r330832 - [clang-format] Start formatting cpp code in raw strings in google style

Krasimir Georgiev via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 25 07:56:19 PDT 2018


Author: krasimir
Date: Wed Apr 25 07:56:19 2018
New Revision: 330832

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

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=330832&r1=330831&r2=330832&view=diff
==============================================================================
--- cfe/trunk/lib/Format/Format.cpp (original)
+++ cfe/trunk/lib/Format/Format.cpp Wed Apr 25 07:56:19 2018
@@ -718,20 +718,39 @@ FormatStyle getGoogleStyle(FormatStyle::
   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;
 




More information about the cfe-commits mailing list