[PATCH] D51036: clang-format: Fix formatting C++ namespaces with preceding 'inline' or 'export' specifier

Owen Pan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 21 19:23:38 PDT 2018


owenpan added inline comments.


================
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;
----------------
owenpan wrote:
> These lines are functionally the same as lines 523-528 in FormatToken.h. Refactor them?
I think this is better:

```
  return NamespaceTok->getNamespaceToken();
```


Repository:
  rC Clang

https://reviews.llvm.org/D51036





More information about the cfe-commits mailing list