diff options
author | Alexander Kornienko <alexfh@google.com> | 2013-04-08 22:16:06 +0000 |
---|---|---|
committer | Alexander Kornienko <alexfh@google.com> | 2013-04-08 22:16:06 +0000 |
commit | 3d713a72a01bf1d270d00040a3fb195121012c61 (patch) | |
tree | 336a172557e6566b6de48ac326899f0a0550fff6 /unittests | |
parent | 0db9d2066318f3721a45954e23b26ac8ef0723bb (diff) |
Recognize function-like macro usages without semicolon in declaration context.
Summary:
Preserve line breaks after function-like macro usages without
semicolon, e.g.:
QQQ(xxx)
class X {
};
Reviewers: djasper, klimek
Reviewed By: djasper
CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D638
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179064 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r-- | unittests/Format/FormatTest.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp index d5995b2fd9..3d350208f2 100644 --- a/unittests/Format/FormatTest.cpp +++ b/unittests/Format/FormatTest.cpp @@ -1339,6 +1339,22 @@ TEST_F(FormatTest, MacroDefinitionsWithIncompleteCode) { "f(STR(this_is_a_string_literal{));"); } +TEST_F(FormatTest, MacroCallsWithoutTrailingSemicolon) { + EXPECT_EQ("INITIALIZE_PASS_BEGIN(ScopDetection, \"polly-detect\")\n" + "INITIALIZE_AG_DEPENDENCY(AliasAnalysis)\n" + "INITIALIZE_PASS_DEPENDENCY(DominatorTree)\n" + "class X {\n" + "};\n" + "INITIALIZE_PASS_END(ScopDetection, \"polly-detect\")\n" + "int *createScopDetectionPass() { return 0; }", + format(" INITIALIZE_PASS_BEGIN(ScopDetection, \"polly-detect\")\n" + " INITIALIZE_AG_DEPENDENCY(AliasAnalysis)\n" + " INITIALIZE_PASS_DEPENDENCY(DominatorTree)\n" + " class X {};\n" + " INITIALIZE_PASS_END(ScopDetection, \"polly-detect\")\n" + " int *createScopDetectionPass() { return 0; }")); +} + TEST_F(FormatTest, IndentPreprocessorDirectivesAtZero) { EXPECT_EQ("{\n {\n#define A\n }\n}", format("{{\n#define A\n}}")); } |