diff options
author | Leandro Melo <[email protected]> | 2012-08-20 23:11:34 +0200 |
---|---|---|
committer | Leandro Melo <[email protected]> | 2012-08-23 14:35:53 +0200 |
commit | b53d5628168b69352ee95b08ffa2c3f5693aa626 (patch) | |
tree | 95d7816f0414a9b0341215084d4027e2c49ff884 /src/libs/cplusplus/pp-engine.cpp | |
parent | e148d030f59ae1e88c68a1843d75cd5cac444439 (diff) |
C++: Take multiline strings into account when preprocessing
It was creating extra line(s)...
Change-Id: If28a9ccf16195c71747479db838a5589ea6683a0
Reviewed-by: Roberto Raggi <[email protected]>
Diffstat (limited to 'src/libs/cplusplus/pp-engine.cpp')
-rw-r--r-- | src/libs/cplusplus/pp-engine.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libs/cplusplus/pp-engine.cpp b/src/libs/cplusplus/pp-engine.cpp index 303205408ae..45cf36f5882 100644 --- a/src/libs/cplusplus/pp-engine.cpp +++ b/src/libs/cplusplus/pp-engine.cpp @@ -1137,9 +1137,9 @@ void Preprocessor::trackExpansionCycles(PPToken *tk) } } -static void adjustForCommentNewlines(unsigned *currentLine, const PPToken &tk) +static void adjustForCommentOrStringNewlines(unsigned *currentLine, const PPToken &tk) { - if (tk.is(T_COMMENT) || tk.is(T_DOXY_COMMENT)) + if (tk.is(T_COMMENT) || tk.is(T_DOXY_COMMENT) || tk.isStringLiteral()) (*currentLine) += tk.asByteArrayRef().count('\n'); } @@ -1147,7 +1147,7 @@ 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); + adjustForCommentOrStringNewlines(&m_env->currentLine, tk); return; } @@ -1164,7 +1164,7 @@ void Preprocessor::synchronizeOutputLines(const PPToken &tk, bool forceLine) } m_env->currentLine = tk.lineno; - adjustForCommentNewlines(&m_env->currentLine, tk); + adjustForCommentOrStringNewlines(&m_env->currentLine, tk); } void Preprocessor::removeTrailingOutputLines() |