diff options
-rw-r--r-- | src/libs/cplusplus/pp-engine.cpp | 2 | ||||
-rw-r--r-- | tests/auto/cplusplus/preprocessor/tst_preprocessor.cpp | 16 |
2 files changed, 17 insertions, 1 deletions
diff --git a/src/libs/cplusplus/pp-engine.cpp b/src/libs/cplusplus/pp-engine.cpp index 8197b7ef5a..c17d36555d 100644 --- a/src/libs/cplusplus/pp-engine.cpp +++ b/src/libs/cplusplus/pp-engine.cpp @@ -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'); } diff --git a/tests/auto/cplusplus/preprocessor/tst_preprocessor.cpp b/tests/auto/cplusplus/preprocessor/tst_preprocessor.cpp index 13d85d8a5b..380de2e861 100644 --- a/tests/auto/cplusplus/preprocessor/tst_preprocessor.cpp +++ b/tests/auto/cplusplus/preprocessor/tst_preprocessor.cpp @@ -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() |