[PATCH] D80079: [clang-format] [NFC] isCpp() is inconsistently used to mean both C++ and Objective C, add language specific isXXX() functions

MyDeveloperDay via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 18 02:05:59 PDT 2020


MyDeveloperDay marked 2 inline comments as done.
MyDeveloperDay added inline comments.


================
Comment at: clang/lib/Format/TokenAnnotator.cpp:3443
-             Style.Language == FormatStyle::LK_TextProto) {
+  } else if (Style.isCpp() || Style.isProtoBuf() || Style.isTableGen() ||
+             Style.isTextProtoBuf()) {
     if (Left.isStringLiteral() && Right.isStringLiteral())
       return true;
----------------
Here is an example of where the language is checked to be both LK_cpp and LK_ObjC when just one isCpp() would have done.


================
Comment at: clang/lib/Format/TokenAnnotator.cpp:3645
-      Left.is(tok::l_paren) && Left.BlockParameterCount > 0 &&
+  if ((Style.isCpp()) && Left.is(tok::l_paren) &&
+      Left.BlockParameterCount > 0 &&
       !Right.isOneOf(tok::l_paren, TT_LambdaLSquare)) {
     // Multiple lambdas in the same function call force line breaks.
----------------
Again here, why not isCpp() here?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80079/new/

https://reviews.llvm.org/D80079





More information about the cfe-commits mailing list