From 58d64e2bb1b47ee6fd20c0493a2a9712f11cf1ae Mon Sep 17 00:00:00 2001 From: Dmitri Gribenko Date: Sun, 30 Dec 2012 21:27:25 +0000 Subject: Formatter: parse and format inline namespaces like regular namespaces This changes formatting from: inline namespace X { class A { }; } to: inline namespace X { class A { }; } llvm-svn: 171266 --- clang/lib/Format/UnwrappedLineParser.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'clang/lib/Format/UnwrappedLineParser.cpp') diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp index 6c035b001c7..78a1abdcf8d 100644 --- a/clang/lib/Format/UnwrappedLineParser.cpp +++ b/clang/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()) { -- cgit v1.2.3