aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Format/UnwrappedLineParser.cpp6
-rw-r--r--unittests/Format/FormatTest.cpp1
2 files changed, 5 insertions, 2 deletions
diff --git a/lib/Format/UnwrappedLineParser.cpp b/lib/Format/UnwrappedLineParser.cpp
index 19bca8d860..f79cc712f4 100644
--- a/lib/Format/UnwrappedLineParser.cpp
+++ b/lib/Format/UnwrappedLineParser.cpp
@@ -650,9 +650,11 @@ void UnwrappedLineParser::parseRecord() {
if (FormatTok.Tok.is(tok::l_paren)) {
parseParens();
}
- // The actual identifier can be a nested name specifier.
+ // The actual identifier can be a nested name specifier, and in macros
+ // it is often token-pasted.
while (FormatTok.Tok.is(tok::identifier) ||
- FormatTok.Tok.is(tok::coloncolon))
+ FormatTok.Tok.is(tok::coloncolon) ||
+ FormatTok.Tok.is(tok::hashhash))
nextToken();
// Note that parsing away template declarations here leads to incorrectly
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp
index cd3bf17df2..fc95acca52 100644
--- a/unittests/Format/FormatTest.cpp
+++ b/unittests/Format/FormatTest.cpp
@@ -1859,6 +1859,7 @@ TEST_F(FormatTest, UnderstandContextOfRecordTypeKeywords) {
verifyFormat("class MACRO(X) Z {\n} n;");
verifyFormat("class __attribute__(X) Z {\n} n;");
verifyFormat("class __declspec(X) Z {\n} n;");
+ verifyFormat("class A##B##C {\n} n;");
// Redefinition from nested context:
verifyFormat("class A::B::C {\n} n;");