diff --git a/src/libs/cplusplus/pp-engine.cpp b/src/libs/cplusplus/pp-engine.cpp index 6a6e5274272a28f6745a8de1a81e612bb8aeae40..806449959a4c7e309afa584f4d7f443aa0902e82 100644 --- a/src/libs/cplusplus/pp-engine.cpp +++ b/src/libs/cplusplus/pp-engine.cpp @@ -662,6 +662,21 @@ bool Preprocessor::markGeneratedTokens(bool markGeneratedTokens, return previous; } +bool Preprocessor::maybeAfterComment() const +{ + unsigned endOfPreviousToken = 0; + + if (_dot != _tokens.constBegin()) + endOfPreviousToken = (_dot - 1)->end(); + + const char *start = _source.constBegin() + endOfPreviousToken; + + if (*start == '/') + return true; + + return false; +} + void Preprocessor::preprocess(const QString &fileName, const QByteArray &source, QByteArray *result) { @@ -710,7 +725,7 @@ void Preprocessor::preprocess(const QString &fileName, const QByteArray &source, } else { - if (_dot->f.whitespace) { + if (_dot->f.whitespace || maybeAfterComment()) { unsigned endOfPreviousToken = 0; if (_dot != _tokens.constBegin()) diff --git a/src/libs/cplusplus/pp-engine.h b/src/libs/cplusplus/pp-engine.h index 596a223e0583ad358ec8e1388e03fe44579df37c..b75a5ab60e0fb364ab7b1909144db4e08d8c92b5 100644 --- a/src/libs/cplusplus/pp-engine.h +++ b/src/libs/cplusplus/pp-engine.h @@ -172,6 +172,7 @@ private: void out(const char *s); QString string(const char *first, int len) const; + bool maybeAfterComment() const; private: Client *client;