diff --git a/src/libs/cplusplus/pp-engine.cpp b/src/libs/cplusplus/pp-engine.cpp index 321666ea4c4..f90c02b9080 100644 --- a/src/libs/cplusplus/pp-engine.cpp +++ b/src/libs/cplusplus/pp-engine.cpp @@ -699,9 +699,16 @@ void Preprocessor::preprocess(const QByteArray &fileName, const QByteArray &sour const unsigned endOfPreviousToken = (_dot - 1)->end(); const unsigned beginOfToken = _dot->begin(); - const char *it = _source.constBegin() + endOfPreviousToken; + const char *start = _source.constBegin() + endOfPreviousToken; const char *end = _source.constBegin() + beginOfToken; + const char *it = end - 1; + for (; it != start - 1; --it) { + if (*it == '\n') + break; + } + ++it; + for (; it != end; ++it) { if (std::isspace(*it)) _result->append(*it);