diff options
author | Christian Kamm <[email protected]> | 2012-08-07 10:47:38 +0200 |
---|---|---|
committer | Christian Kamm <[email protected]> | 2012-08-07 11:31:06 +0200 |
commit | 41e140da048d07622d6b59e2fb49f7fc616551b5 (patch) | |
tree | 53199ec11d2e2d48481d64fe7fa779f0b5a07640 /src/libs/cplusplus/pp-engine.cpp | |
parent | 336511dd99b5e7fca55bb4e872870a04fe86df4a (diff) |
C++: Fix line number information after multiline comments.
Task-number: QTCREATORBUG-7702
Change-Id: I0ec2e1eb9bf1c556b0a426d4405df1c48b5653ed
Reviewed-by: Leandro Melo <[email protected]>
Diffstat (limited to 'src/libs/cplusplus/pp-engine.cpp')
-rw-r--r-- | src/libs/cplusplus/pp-engine.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/libs/cplusplus/pp-engine.cpp b/src/libs/cplusplus/pp-engine.cpp index a7e06000273..303205408ae 100644 --- a/src/libs/cplusplus/pp-engine.cpp +++ b/src/libs/cplusplus/pp-engine.cpp @@ -1137,10 +1137,17 @@ void Preprocessor::trackExpansionCycles(PPToken *tk) } } +static void adjustForCommentNewlines(unsigned *currentLine, const PPToken &tk) +{ + if (tk.is(T_COMMENT) || tk.is(T_DOXY_COMMENT)) + (*currentLine) += tk.asByteArrayRef().count('\n'); +} + void Preprocessor::synchronizeOutputLines(const PPToken &tk, bool forceLine) { if (m_state.m_expansionStatus != NotExpanding || (!forceLine && m_env->currentLine == tk.lineno)) { + adjustForCommentNewlines(&m_env->currentLine, tk); return; } @@ -1157,8 +1164,7 @@ void Preprocessor::synchronizeOutputLines(const PPToken &tk, bool forceLine) } m_env->currentLine = tk.lineno; - if (tk.is(T_COMMENT) || tk.is(T_DOXY_COMMENT)) - m_env->currentLine += tk.asByteArrayRef().count('\n'); + adjustForCommentNewlines(&m_env->currentLine, tk); } void Preprocessor::removeTrailingOutputLines() |