diff options
author | Simon Schäfer <simon.schaefer@koeln.de> | 2013-11-26 21:56:30 +0100 |
---|---|---|
committer | Nikolai Kosjar <nikolai.kosjar@digia.com> | 2013-11-28 11:40:37 +0100 |
commit | 1d834c1126dde58dd71e595b3f5e135cc0ca4dbd (patch) | |
tree | 28b8436acd7c5fb8661ddc345a4830eb2939a468 /src/libs/cplusplus/pp-engine.cpp | |
parent | e4d800ad4a2b7f29c302f43c0efaa7e592633cc7 (diff) | |
download | qt-creator-1d834c1126dde58dd71e595b3f5e135cc0ca4dbd.tar.gz |
Preprocessor Enginge: fix bug in pp-engine.cpp
Preprocessor variables __LINE__,__FILE__,__TIME__,__DATE__ where destroying
the following systems when affected variables were standing within the
same line with those variables:
* highlighting
* refactoring
* local renaming
Task-number: QTCREATORBUG-8036
Change-Id: I1a4b919d15812872ca5a8e63b1031ec1ab144c22
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
Diffstat (limited to 'src/libs/cplusplus/pp-engine.cpp')
-rw-r--r-- | src/libs/cplusplus/pp-engine.cpp | 44 |
1 files changed, 1 insertions, 43 deletions
diff --git a/src/libs/cplusplus/pp-engine.cpp b/src/libs/cplusplus/pp-engine.cpp index 05a7a083d3..48736f805e 100644 --- a/src/libs/cplusplus/pp-engine.cpp +++ b/src/libs/cplusplus/pp-engine.cpp @@ -906,49 +906,7 @@ bool Preprocessor::handleIdentifier(PPToken *tk) { ScopedBoolSwap s(m_state.m_inPreprocessorDirective, true); - static const QByteArray ppLine("__LINE__"); - static const QByteArray ppFile("__FILE__"); - static const QByteArray ppDate("__DATE__"); - static const QByteArray ppTime("__TIME__"); - - ByteArrayRef macroNameRef = tk->asByteArrayRef(); - - if (macroNameRef.size() == 8 - && macroNameRef[0] == '_' - && macroNameRef[1] == '_') { - PPToken newTk; - if (macroNameRef == ppLine) { - QByteArray txt = QByteArray::number(tk->lineno); - newTk = generateToken(T_STRING_LITERAL, txt.constData(), txt.size(), tk->lineno, false); - } else if (macroNameRef == ppFile) { - QByteArray txt; - txt.append('"'); - txt.append(m_env->currentFileUtf8); - txt.append('"'); - newTk = generateToken(T_STRING_LITERAL, txt.constData(), txt.size(), tk->lineno, false); - } else if (macroNameRef == ppDate) { - QByteArray txt; - txt.append('"'); - txt.append(QDate::currentDate().toString().toUtf8()); - txt.append('"'); - newTk = generateToken(T_STRING_LITERAL, txt.constData(), txt.size(), tk->lineno, false); - } else if (macroNameRef == ppTime) { - QByteArray txt; - txt.append('"'); - txt.append(QTime::currentTime().toString().toUtf8()); - txt.append('"'); - newTk = generateToken(T_STRING_LITERAL, txt.constData(), txt.size(), tk->lineno, false); - } - - if (newTk.hasSource()) { - newTk.f.newline = tk->newline(); - newTk.f.whitespace = tk->whitespace(); - *tk = newTk; - return false; - } - } - - Macro *macro = m_env->resolve(macroNameRef); + Macro *macro = m_env->resolve(tk->asByteArrayRef()); if (!macro || (tk->expanded() && m_state.m_tokenBuffer |