Correct handling for C++17 inline namespaces. We would previously fail to
identify the inline namespaces as a namespace name since multiple ones may be
concatenated now with C++17.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@251690
91177308-0d34-0410-b5e6-
96231b3b80d8
const FormatToken &InitialToken = *FormatTok;
nextToken();
- if (FormatTok->Tok.is(tok::identifier))
+ while (FormatTok->isOneOf(tok::identifier, tok::coloncolon))
nextToken();
if (FormatTok->Tok.is(tok::l_brace)) {
if (ShouldBreakBeforeBrace(Style, InitialToken))
"} // my_namespace\n"
"#endif // HEADER_GUARD"));
+ EXPECT_EQ("namespace A::B {\n"
+ "class C {};\n"
+ "}",
+ format("namespace A::B {\n"
+ "class C {};\n"
+ "}"));
+
FormatStyle Style = getLLVMStyle();
Style.NamespaceIndentation = FormatStyle::NI_All;
EXPECT_EQ("namespace out {\n"