diff options
-rw-r--r-- | lib/Format/UnwrappedLineParser.cpp | 3 | ||||
-rw-r--r-- | unittests/Format/FormatTest.cpp | 4 |
2 files changed, 6 insertions, 1 deletions
diff --git a/lib/Format/UnwrappedLineParser.cpp b/lib/Format/UnwrappedLineParser.cpp index 1b39442610..ad641a29b1 100644 --- a/lib/Format/UnwrappedLineParser.cpp +++ b/lib/Format/UnwrappedLineParser.cpp @@ -240,7 +240,8 @@ void UnwrappedLineParser::parsePPDefine() { return; } nextToken(); - if (FormatTok.Tok.getKind() == tok::l_paren) { + if (FormatTok.Tok.getKind() == tok::l_paren && + FormatTok.WhiteSpaceLength == 0) { parseParens(); } addUnwrappedLine(); diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp index 806a7eb9c0..708b7d8086 100644 --- a/unittests/Format/FormatTest.cpp +++ b/unittests/Format/FormatTest.cpp @@ -742,6 +742,10 @@ TEST_F(FormatTest, HashInMacroDefinition) { verifyFormat("#define A void # ## #", getLLVMStyleWithColumns(22)); } +TEST_F(FormatTest, RespectWhitespaceInMacroDefinitions) { + verifyFormat("#define A (1)"); +} + TEST_F(FormatTest, IndentPreprocessorDirectivesAtZero) { EXPECT_EQ("{\n {\n#define A\n }\n}", format("{{\n#define A\n}}")); } |