forked from OSchip/llvm-project
Fix handling of macro definitions.
Now correctly formats: #define A (1) llvm-svn: 173264
This commit is contained in:
parent
d1bfdc32b2
commit
d053c5b43a
|
@ -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();
|
||||
|
|
|
@ -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}}"));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue