diff options
| -rw-r--r-- | clang/lib/Format/UnwrappedLineParser.cpp | 1 | ||||
| -rw-r--r-- | clang/unittests/Format/FormatTest.cpp | 8 |
2 files changed, 9 insertions, 0 deletions
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp index 316d324f7a4..3b72bef6012 100644 --- a/clang/lib/Format/UnwrappedLineParser.cpp +++ b/clang/lib/Format/UnwrappedLineParser.cpp @@ -601,6 +601,7 @@ void UnwrappedLineParser::parseStructuralElement() { Text == Text.upper()) { // Recognize free-standing macros like Q_OBJECT. addUnwrappedLine(); + return; } } break; diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index eacd189840f..18a1a008582 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -1702,6 +1702,14 @@ TEST_F(FormatTest, MacrosWithoutTrailingSemicolon) { "\n" " A() {\n}\n" "} ;")); + EXPECT_EQ("SOME_MACRO\n" + "namespace {\n" + "void f();\n" + "}", + format("SOME_MACRO\n" + " namespace {\n" + "void f( );\n" + "}")); // Only if the identifier contains at least 5 characters. EXPECT_EQ("HTTP f();", format("HTTP\nf();")); |

