aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Format/UnwrappedLineParser.cpp10
-rw-r--r--unittests/Format/FormatTest.cpp7
2 files changed, 16 insertions, 1 deletions
diff --git a/lib/Format/UnwrappedLineParser.cpp b/lib/Format/UnwrappedLineParser.cpp
index 6c035b001c..78a1abdcf8 100644
--- a/lib/Format/UnwrappedLineParser.cpp
+++ b/lib/Format/UnwrappedLineParser.cpp
@@ -100,10 +100,19 @@ void UnwrappedLineParser::parseComments() {
void UnwrappedLineParser::parseStatement() {
parseComments();
+ int TokenNumber = 0;
switch (FormatTok.Tok.getKind()) {
case tok::kw_namespace:
parseNamespace();
return;
+ case tok::kw_inline:
+ nextToken();
+ TokenNumber++;
+ if (FormatTok.Tok.is(tok::kw_namespace)) {
+ parseNamespace();
+ return;
+ }
+ break;
case tok::kw_public:
case tok::kw_protected:
case tok::kw_private:
@@ -132,7 +141,6 @@ void UnwrappedLineParser::parseStatement() {
default:
break;
}
- int TokenNumber = 0;
do {
++TokenNumber;
switch (FormatTok.Tok.getKind()) {
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp
index 43003befb6..b719acfabc 100644
--- a/unittests/Format/FormatTest.cpp
+++ b/unittests/Format/FormatTest.cpp
@@ -349,6 +349,13 @@ TEST_F(FormatTest, FormatsNamespaces) {
" f();\n"
"}\n"
"}");
+ verifyFormat("inline namespace X {\n"
+ "class A {\n"
+ "};\n"
+ "void f() {\n"
+ " f();\n"
+ "}\n"
+ "}");
verifyFormat("using namespace some_namespace;\n"
"class A {\n"
"};\n"