[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
Wed Aug 22 02:43:36 PDT 2018


owenpan added inline comments.


================
Comment at: lib/Format/UnwrappedLineParser.cpp:1066-1072
+    if (Style.isCpp()) {
+      nextToken();
+      if (FormatTok->Tok.is(tok::kw_namespace)) {
+        parseNamespace();
+        return;
+      }
+    }
----------------
owenpan wrote:
> ```
>     if (!Style.isCpp())
>       break;
>   case tok::kw_inline:
>     nextToken();
>     if (FormatTok->Tok.is(tok::kw_namespace)) {
>       parseNamespace();
>       return;
>     }
> ```
I forgot to include LLVM_FALLTHROUGH to suppress the warning:

```
    if (!Style.isCpp())
      break;
    LLVM_FALLTHROUGH;
  case tok::kw_inline:
    nextToken();
    if (FormatTok->Tok.is(tok::kw_namespace)) {
      parseNamespace();
      return;
    }
```


Repository:
  rC Clang

https://reviews.llvm.org/D51036





More information about the cfe-commits mailing list