forked from qt-creator/qt-creator
		
	Lexer: Fine-tune recent crash fix
Use the original offset only in the one place where it is relevant.
This amends commit 8eac3fba80.
Fixes: QTCREATORBUG-24221
Change-Id: Idcfc5ecc8a76c875c4f2ca5890d0ba95ce52a6e9
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
			
			
This commit is contained in:
		| @@ -1856,7 +1856,8 @@ void Preprocessor::handleDefineDirective(PPToken *tk) | ||||
| QByteArray Preprocessor::expand(PPToken *tk, PPToken *lastConditionToken) | ||||
| { | ||||
|     unsigned line = tk->lineno; | ||||
|     unsigned bytesBegin = tk->originalOffset(); | ||||
|     unsigned bytesBegin = tk->bytesBegin(); | ||||
|     const int originalOffset = tk->originalOffset(); | ||||
|     unsigned utf16charsBegin = tk->utf16charsBegin(); | ||||
|     PPToken lastTk; | ||||
|     while (isContinuationToken(*tk)) { | ||||
| @@ -1864,8 +1865,8 @@ QByteArray Preprocessor::expand(PPToken *tk, PPToken *lastConditionToken) | ||||
|         lex(tk); | ||||
|     } | ||||
|     // Gather the exact spelling of the content in the source. | ||||
|     QByteArray condition(m_state.m_source.mid(bytesBegin, lastTk.bytesBegin() + lastTk.bytes() | ||||
|                                               - bytesBegin)); | ||||
|     QByteArray condition(m_state.m_source.mid(originalOffset, lastTk.originalOffset() + lastTk.bytes() | ||||
|                                               - originalOffset)); | ||||
|  | ||||
| //    qDebug("*** Condition before: [%s]", condition.constData()); | ||||
|     QByteArray result; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user