Commit 6133920b authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh

Preprocessor: Adjust lines also for multiline C++ comments

Change-Id: I87d6e76be3030e617603209c3a1b8b3c476cf1f6
Reviewed-by: default avatarNikolai Kosjar <nikolai.kosjar@digia.com>
parent 466eb0b0
......@@ -1300,7 +1300,7 @@ void Preprocessor::trackExpansionCycles(PPToken *tk)
static void adjustForCommentOrStringNewlines(unsigned *currentLine, const PPToken &tk)
{
if (tk.is(T_COMMENT) || tk.is(T_DOXY_COMMENT) || tk.isStringLiteral())
if (tk.isComment() || tk.isStringLiteral())
(*currentLine) += tk.asByteArrayRef().count('\n');
}
......
......@@ -1368,6 +1368,22 @@ void tst_Preprocessor::comments_within_data()
" ) {}\n"
"}\n"
);
QTest::newRow("joined") << _(
"// comment \\\n"
"\n"
"int foo = 4;"
) << _(
"# 1 \"<stdin>\"\n"
"\n"
"\n"
"int foo = 4;"
) << _(
"# 1 \"<stdin>\"\n"
"// comment \\\n"
"\n"
"int foo = 4;"
);
}
void tst_Preprocessor::comments_before_args()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment