diff options
| author | Orgad Shaneh <[email protected]> | 2014-01-10 09:08:39 +0200 |
|---|---|---|
| committer | Orgad Shaneh <[email protected]> | 2014-02-24 21:56:40 +0100 |
| commit | dabdb60299d01d12857f45baa2b04f10077c27cc (patch) | |
| tree | 2758d02a231159e6503e608f10aa5df1034cebc4 /src/libs/cplusplus/pp-engine.cpp | |
| parent | 6133920bfe7aa8d8370fdb53f176a1ccdd97273d (diff) | |
C++: Preserve comments after preprocessor directives
Task-number: QTCREATORBUG-11216
Change-Id: Iac10e75f0f5c504b79e8466607dc1f478e578f99
Reviewed-by: Erik Verbruggen <[email protected]>
Diffstat (limited to 'src/libs/cplusplus/pp-engine.cpp')
| -rw-r--r-- | src/libs/cplusplus/pp-engine.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/libs/cplusplus/pp-engine.cpp b/src/libs/cplusplus/pp-engine.cpp index c17d36555d2..9c86b7e35d2 100644 --- a/src/libs/cplusplus/pp-engine.cpp +++ b/src/libs/cplusplus/pp-engine.cpp @@ -898,6 +898,11 @@ void Preprocessor::skipPreprocesorDirective(PPToken *tk) ScopedBoolSwap s(m_state.m_inPreprocessorDirective, true); while (isContinuationToken(*tk)) { + if (tk->isComment()) { + synchronizeOutputLines(*tk); + enforceSpacing(*tk, true); + currentOutputBuffer().append(tk->tokenStart(), tk->length()); + } lex(tk); } } @@ -1703,8 +1708,13 @@ void Preprocessor::handleDefineDirective(PPToken *tk) previousLine = tk->lineno; // Discard comments in macro definitions (keep comments flag doesn't apply here). - if (!tk->isComment()) + if (tk->isComment()) { + synchronizeOutputLines(*tk); + enforceSpacing(*tk, true); + currentOutputBuffer().append(tk->tokenStart(), tk->length()); + } else { bodyTokens.push_back(*tk); + } lex(tk); } |
