bool spaceRequiredBetween(const AnnotatedToken &Left,
const AnnotatedToken &Right) {
+ if (Right.is(tok::hashhash))
+ return Left.is(tok::hash);
+ if (Left.is(tok::hashhash) || Left.is(tok::hash))
+ return Right.is(tok::hash);
if (Right.is(tok::r_paren) || Right.is(tok::semi) || Right.is(tok::comma))
return false;
if (Left.is(tok::kw_template) && Right.is(tok::less))
return true;
if (Left.is(tok::l_paren))
return false;
- if (Left.is(tok::hash))
- return false;
if (Right.is(tok::l_paren)) {
return Left.is(tok::kw_if) || Left.is(tok::kw_for) ||
Left.is(tok::kw_while) || Left.is(tok::kw_switch) ||
" { \\\n"
" f(#c);\\\n"
" }", getLLVMStyleWithColumns(11));
+
+ verifyFormat("#define A(X) \\\n"
+ " void function##X()", getLLVMStyleWithColumns(22));
+
+ verifyFormat("#define A(a, b, c) \\\n"
+ " void a##b##c()", getLLVMStyleWithColumns(22));
+
+ verifyFormat("#define A \\\n"
+ " void # ## #", getLLVMStyleWithColumns(22));
}
TEST_F(FormatTest, IndentPreprocessorDirectivesAtZero) {