psigillito updated this revision to Diff 402733.
psigillito marked 6 inline comments as done.
psigillito added a comment.

Review Changes


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117416

Files:
  .arclint
  clang/lib/Format/UnwrappedLineFormatter.cpp
  clang/lib/Format/UnwrappedLineParser.cpp

Index: clang/lib/Format/UnwrappedLineParser.cpp
===================================================================
--- clang/lib/Format/UnwrappedLineParser.cpp
+++ clang/lib/Format/UnwrappedLineParser.cpp
@@ -2494,7 +2494,7 @@
 }
 
 void UnwrappedLineParser::parseAccessSpecifier() {
-  auto *accessSpecifierCandidate = FormatTok;
+  auto *AccessSpecifierCandidate = FormatTok;
   nextToken();
   // Understand Qt's slots.
   if (FormatTok->isOneOf(Keywords.kw_slots, Keywords.kw_qslots))
@@ -2504,15 +2504,12 @@
     nextToken();
     addUnwrappedLine();
     // is not a variable name or namespacename
-  } else if (C_OperatorsFollowingVar.find(FormatTok->Tok.getKind()) ==
-                 C_OperatorsFollowingVar.end() &&
-             !FormatTok->Tok.is(tok::coloncolon)) {
+  } else if (!C_OperatorsFollowingVar.count(FormatTok->Tok.getKind()) &&
+             !FormatTok->Tok.is(tok::coloncolon))
     addUnwrappedLine();
-  }
   // consider the accessSpecifier to be a C identifier
-  else if (accessSpecifierCandidate) {
-    accessSpecifierCandidate->Tok.setKind(tok::identifier);
-  }
+  else if (AccessSpecifierCandidate)
+    AccessSpecifierCandidate->Tok.setKind(tok::identifier);
 }
 
 void UnwrappedLineParser::parseConcept() {
Index: clang/lib/Format/UnwrappedLineFormatter.cpp
===================================================================
--- clang/lib/Format/UnwrappedLineFormatter.cpp
+++ clang/lib/Format/UnwrappedLineFormatter.cpp
@@ -101,30 +101,26 @@
         Style.isCSharp())
       return 0;
 
-    auto isAccessModifier = [this, &RootToken]() {
-      bool returnValue{false};
-      if (RootToken.isAccessSpecifier(Style.isCpp())) {
-        returnValue = true;
-      } else if (RootToken.isObjCAccessSpecifier()) {
-        returnValue = true;
-      }
+    auto IsAccessModifier = [this, &RootToken]() {
+      if (RootToken.isAccessSpecifier(Style.isCpp()))
+        return true;
+      else if (RootToken.isObjCAccessSpecifier())
+        return true;
       // Handle Qt signals
       else if ((RootToken.isOneOf(Keywords.kw_signals, Keywords.kw_qsignals) &&
-                RootToken.Next && RootToken.Next->is(tok::colon))) {
-        returnValue = true;
-      }
+                RootToken.Next && RootToken.Next->is(tok::colon)))
+        return true;
       // Handle malformed access specifier i.e. 'private' without trailing ':'
       else if ((RootToken.isAccessSpecifier(false) &&
                 (!RootToken.Next ||
-                 (C_OperatorsFollowingVar.find(RootToken.Next->Tok.getKind()) ==
-                      clang::format::C_OperatorsFollowingVar.end() &&
-                  !RootToken.Next->Tok.is(tok::coloncolon))))) {
-        returnValue = true;
-      }
-      return returnValue;
+                 (!C_OperatorsFollowingVar.count(
+                      RootToken.Next->Tok.getKind()) &&
+                  !RootToken.Next->Tok.is(tok::coloncolon)))))
+        return true;
+      return false;
     };
 
-    if (isAccessModifier()) {
+    if (IsAccessModifier()) {
       // The AccessModifierOffset may be overridden by IndentAccessModifiers,
       // in which case we take a negative value of the IndentWidth to simulate
       // the upper indent level.
Index: .arclint
===================================================================
--- .arclint
+++ /dev/null
@@ -1,15 +0,0 @@
-{
-  "linters": {
-    "clang-format": {
-      "type": "script-and-regex",
-      "script-and-regex.script": "bash utils/arcanist/clang-format.sh",
-      "script-and-regex.regex": "/^(?P<severity>[[:alpha:]]+)\n(?P<message>[^\n]+)\n(====|(?P<line>\\d),(?P<char>\\d)\n(?P<original>.*)>>>>\n(?P<replacement>.*)<<<<\n)$/s",
-      "include": [
-        "(\\.(cc|cpp|h)$)"
-      ],
-      "exclude": [
-        "(^clang/test/)"
-      ]
-    }
-  }
-}
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to