owenpan requested changes to this revision.
owenpan added a comment.
This revision now requires changes to proceed.

By the way, I didn't review the test cases.



================
Comment at: lib/Format/FormatToken.h:524-525
+    // Detect "(inline|export)? namespace" in the beginning of a line.
+    if (NamespaceTok &&
+        (NamespaceTok->is(tok::kw_inline) || NamespaceTok->is(tok::kw_export)))
       NamespaceTok = NamespaceTok->getNextNonComment();
----------------
```
    if (NamespaceTok && NamespaceTok->isOneOf(tok::kw_inline, tok::kw_export))
```


================
Comment at: lib/Format/NamespaceEndCommentsFixer.cpp:128-133
+  // Detect "(inline|export)? namespace" in the beginning of a line.
+  if (NamespaceTok->is(tok::kw_inline) || NamespaceTok->is(tok::kw_export))
     NamespaceTok = NamespaceTok->getNextNonComment();
   if (!NamespaceTok || NamespaceTok->isNot(tok::kw_namespace))
     return nullptr;
   return NamespaceTok;
----------------
These lines are functionally the same as lines 523-528 in FormatToken.h. 
Refactor them?


================
Comment at: lib/Format/NamespaceEndCommentsFixer.cpp:129-130
+  // Detect "(inline|export)? namespace" in the beginning of a line.
+  if (NamespaceTok->is(tok::kw_inline) || NamespaceTok->is(tok::kw_export))
     NamespaceTok = NamespaceTok->getNextNonComment();
   if (!NamespaceTok || NamespaceTok->isNot(tok::kw_namespace))
----------------
```
  if (NamespaceTok && NamespaceTok->isOneOf(tok::kw_inline, tok::kw_export))
```


================
Comment at: lib/Format/UnwrappedLineParser.cpp:992-998
   case tok::kw_inline:
     nextToken();
     if (FormatTok->Tok.is(tok::kw_namespace)) {
       parseNamespace();
       return;
     }
     break;
----------------
Move this case to after the case tok::kw_export below.


================
Comment at: lib/Format/UnwrappedLineParser.cpp:1066-1072
+    if (Style.isCpp()) {
+      nextToken();
+      if (FormatTok->Tok.is(tok::kw_namespace)) {
+        parseNamespace();
+        return;
+      }
+    }
----------------
```
    if (!Style.isCpp())
      break;
  case tok::kw_inline:
    nextToken();
    if (FormatTok->Tok.is(tok::kw_namespace)) {
      parseNamespace();
      return;
    }
```


Repository:
  rC Clang

https://reviews.llvm.org/D51036



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to