forked from qt-creator/qt-creator
C++: Fix preprocessing of uncontinued line-escaping
The following snippet demonstrates the problem:
--- snip ---
// comment \
#include <something.h>
...
class Foo
{
...
};
--- snap ---
If there are >=9 empty/preprocessor lines, the preprocessed source
becomes
// comment \
# 12 "file.cpp"
...
The lexer considers the line marker as a continued C++ comment, and
highlighting is broken
Change-Id: I30a2fc7d19b279316e9273697179c90d81099573
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
dabdb60299
commit
67caa75c56
@@ -1453,6 +1453,31 @@ void tst_Preprocessor::comments_within_data()
|
||||
"\n"
|
||||
"int foo = 4;"
|
||||
);
|
||||
|
||||
QTest::newRow("joined_unterminated") << _(
|
||||
"// comment \\\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"int foo = 4;"
|
||||
) << _(
|
||||
"# 1 \"<stdin>\"\n"
|
||||
"# 12 \"<stdin>\"\n"
|
||||
"int foo = 4;"
|
||||
) << _(
|
||||
"# 1 \"<stdin>\"\n"
|
||||
"// comment \\\n"
|
||||
"\n"
|
||||
"# 12 \"<stdin>\"\n"
|
||||
"int foo = 4;"
|
||||
);
|
||||
}
|
||||
|
||||
void tst_Preprocessor::comments_before_args()
|
||||
|
||||
Reference in New Issue
Block a user