summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/app/main.cpp1
-rw-r--r--src/libs/cplusplus/Macro.h7
-rw-r--r--src/libs/cplusplus/pp-engine.cpp46
-rw-r--r--src/plugins/cppeditor/cppeditor.cpp6
-rw-r--r--src/plugins/cppeditor/cppfollowsymbolundercursor.cpp10
-rw-r--r--src/plugins/cpptools/cppfindreferences.cpp2
-rw-r--r--src/plugins/cpptools/cpphighlightingsupportinternal.cpp3
-rw-r--r--src/plugins/debugger/debuggeritemmodel.cpp8
-rw-r--r--src/plugins/projectexplorer/buildconfiguration.cpp10
-rw-r--r--src/plugins/projectexplorer/kitinformation.cpp9
-rw-r--r--src/plugins/projectexplorer/localenvironmentaspect.cpp14
-rw-r--r--src/plugins/qmlprojectmanager/qmlprojectenvironmentaspect.cpp7
12 files changed, 78 insertions, 45 deletions
diff --git a/src/app/main.cpp b/src/app/main.cpp
index 69fda6f0ff..da6f0716c7 100644
--- a/src/app/main.cpp
+++ b/src/app/main.cpp
@@ -298,7 +298,6 @@ int main(int argc, char **argv)
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
// QML is unusable with the xlib backend
QApplication::setGraphicsSystem(QLatin1String("raster"));
- qputenv("QSG_RENDER_LOOP", "basic"); // workaround for QTBUG-35143
#endif
SharedTools::QtSingleApplication app((QLatin1String(appNameC)), argc, argv);
diff --git a/src/libs/cplusplus/Macro.h b/src/libs/cplusplus/Macro.h
index a3d83b1f00..1c340dba65 100644
--- a/src/libs/cplusplus/Macro.h
+++ b/src/libs/cplusplus/Macro.h
@@ -137,6 +137,12 @@ public:
void setVariadic(bool isVariadic)
{ f._variadic = isVariadic; }
+ bool isPredefined() const
+ { return f._predefined; }
+
+ void setPredefined(bool isPredefined)
+ { f._predefined = isPredefined; }
+
QString toString() const;
QString toStringWithLineBreaks() const;
@@ -151,6 +157,7 @@ private:
unsigned _hidden: 1;
unsigned _functionLike: 1;
unsigned _variadic: 1;
+ unsigned _predefined: 1;
};
QByteArray _name;
diff --git a/src/libs/cplusplus/pp-engine.cpp b/src/libs/cplusplus/pp-engine.cpp
index 48736f805e..4bbb229734 100644
--- a/src/libs/cplusplus/pp-engine.cpp
+++ b/src/libs/cplusplus/pp-engine.cpp
@@ -906,7 +906,51 @@ bool Preprocessor::handleIdentifier(PPToken *tk)
{
ScopedBoolSwap s(m_state.m_inPreprocessorDirective, true);
- Macro *macro = m_env->resolve(tk->asByteArrayRef());
+ 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;
+ QByteArray txt;
+ if (macroNameRef == ppLine) {
+ txt = QByteArray::number(tk->lineno);
+ newTk = generateToken(T_STRING_LITERAL, txt.constData(), txt.size(), tk->lineno, false);
+ } else if (macroNameRef == ppFile) {
+ 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) {
+ 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) {
+ 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()) {
+ Macro macro;
+ macro.setName(macroNameRef.toByteArray());
+ macro.setFileName(m_env->currentFile);
+ macro.setPredefined(true);
+ macro.setDefinition(txt, QVector<PPToken>() << newTk);
+ m_env->bind(macro);
+ if (m_client)
+ m_client->macroAdded(macro);
+ }
+ }
+
+ Macro *macro = m_env->resolve(macroNameRef);
if (!macro
|| (tk->expanded()
&& m_state.m_tokenBuffer
diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp
index 63d5bc2e5b..740269efed 100644
--- a/src/plugins/cppeditor/cppeditor.cpp
+++ b/src/plugins/cppeditor/cppeditor.cpp
@@ -797,10 +797,12 @@ const Macro *CPPEditorWidget::findCanonicalMacro(const QTextCursor &cursor, Docu
if (const Macro *macro = doc->findMacroDefinitionAt(line)) {
QTextCursor macroCursor = cursor;
const QByteArray name = identifierUnderCursor(&macroCursor).toLatin1();
- if (macro->name() == name)
+ if (macro->name() == name && !macro->isPredefined())
return macro;
} else if (const Document::MacroUse *use = doc->findMacroUseAt(cursor.position())) {
- return &use->macro();
+ const Macro &macro = use->macro();
+ if (!macro.isPredefined())
+ return &macro;
}
return 0;
diff --git a/src/plugins/cppeditor/cppfollowsymbolundercursor.cpp b/src/plugins/cppeditor/cppfollowsymbolundercursor.cpp
index 19a5a3a5e5..050ba6ef8f 100644
--- a/src/plugins/cppeditor/cppfollowsymbolundercursor.cpp
+++ b/src/plugins/cppeditor/cppfollowsymbolundercursor.cpp
@@ -592,10 +592,12 @@ BaseTextEditorWidget::Link FollowSymbolUnderCursor::findLink(const QTextCursor &
m_widget->showPreProcessorWidget();
} else if (fileName != CppModelManagerInterface::configurationFileName()) {
const Macro &macro = use->macro();
- link.targetFileName = macro.fileName();
- link.targetLine = macro.line();
- link.linkTextStart = use->begin();
- link.linkTextEnd = use->end();
+ if (!macro.isPredefined()) {
+ link.targetFileName = macro.fileName();
+ link.targetLine = macro.line();
+ link.linkTextStart = use->begin();
+ link.linkTextEnd = use->end();
+ }
}
return link;
}
diff --git a/src/plugins/cpptools/cppfindreferences.cpp b/src/plugins/cpptools/cppfindreferences.cpp
index a1e9625e85..17bc85f97d 100644
--- a/src/plugins/cpptools/cppfindreferences.cpp
+++ b/src/plugins/cpptools/cppfindreferences.cpp
@@ -558,6 +558,8 @@ restart_search:
usages.clear();
foreach (const Document::MacroUse &use, doc->macroUses()) {
const Macro &useMacro = use.macro();
+ if (useMacro.isPredefined())
+ continue;
if (useMacro.fileName() == macro.fileName()) { // Check if this is a match, but possibly against an outdated document.
if (source.isEmpty())
diff --git a/src/plugins/cpptools/cpphighlightingsupportinternal.cpp b/src/plugins/cpptools/cpphighlightingsupportinternal.cpp
index 3009d45c16..d2a14170e4 100644
--- a/src/plugins/cpptools/cpphighlightingsupportinternal.cpp
+++ b/src/plugins/cpptools/cpphighlightingsupportinternal.cpp
@@ -58,6 +58,9 @@ QFuture<TextEditor::HighlightingResult> CppHighlightingSupportInternal::highligh
// Get macro definitions
foreach (const CPlusPlus::Macro& macro, doc->definedMacros()) {
+ if (macro.isPredefined())
+ continue; // No "real" definition location
+
int line, column;
editor()->convertPosition(macro.offset(), &line, &column);
++column; //Highlighting starts at (column-1) --> compensate here
diff --git a/src/plugins/debugger/debuggeritemmodel.cpp b/src/plugins/debugger/debuggeritemmodel.cpp
index f2c2382040..005115dbae 100644
--- a/src/plugins/debugger/debuggeritemmodel.cpp
+++ b/src/plugins/debugger/debuggeritemmodel.cpp
@@ -37,6 +37,8 @@
namespace Debugger {
namespace Internal {
+const int AbiRole = Qt::UserRole + 2;
+
static QList<QStandardItem *> describeItem(const DebuggerItem &item)
{
QList<QStandardItem *> row;
@@ -44,7 +46,7 @@ static QList<QStandardItem *> describeItem(const DebuggerItem &item)
row.append(new QStandardItem(item.command().toUserOutput()));
row.append(new QStandardItem(item.engineTypeName()));
row.at(0)->setData(item.id());
- row.at(0)->setData(item.abiNames(), Qt::UserRole + 2);
+ row.at(0)->setData(item.abiNames(), AbiRole);
row.at(0)->setEditable(false);
row.at(1)->setEditable(false);
row.at(1)->setData(item.toMap());
@@ -158,7 +160,7 @@ bool DebuggerItemModel::updateDebuggerStandardItem(const DebuggerItem &item, boo
QFont font = sitem->font();
font.setBold(changed);
parent->child(row, 0)->setData(item.displayName(), Qt::DisplayRole);
- parent->child(row, 0)->setData(item.abiNames(), Qt::UserRole + 2);
+ parent->child(row, 0)->setData(item.abiNames(), AbiRole);
parent->child(row, 0)->setFont(font);
parent->child(row, 1)->setData(item.command().toUserOutput(), Qt::DisplayRole);
parent->child(row, 1)->setFont(font);
@@ -178,7 +180,7 @@ DebuggerItem DebuggerItemModel::debuggerItem(QStandardItem *sitem) const
item.m_id = i->data();
item.setDisplayName(i->data(Qt::DisplayRole).toString());
- QStringList abis = i->data(Qt::UserRole + 2).toStringList();
+ QStringList abis = i->data(AbiRole).toStringList();
QList<ProjectExplorer::Abi> abiList;
foreach (const QString &abi, abis)
abiList << ProjectExplorer::Abi(abi);
diff --git a/src/plugins/projectexplorer/buildconfiguration.cpp b/src/plugins/projectexplorer/buildconfiguration.cpp
index ca460ca540..fb1f5a32c6 100644
--- a/src/plugins/projectexplorer/buildconfiguration.cpp
+++ b/src/plugins/projectexplorer/buildconfiguration.cpp
@@ -250,16 +250,8 @@ Target *BuildConfiguration::target() const
Utils::Environment BuildConfiguration::baseEnvironment() const
{
Utils::Environment result;
- if (useSystemEnvironment()) {
-#if 1
- // workaround for QTBUG-35143
- result = Utils::Environment::systemEnvironment();
- result.unset(QLatin1String("QSG_RENDER_LOOP"));
-#else
+ if (useSystemEnvironment())
result = Utils::Environment::systemEnvironment();
-#endif
- }
-
target()->kit()->addToEnvironment(result);
return result;
}
diff --git a/src/plugins/projectexplorer/kitinformation.cpp b/src/plugins/projectexplorer/kitinformation.cpp
index 23edc2d2ab..87c6caf320 100644
--- a/src/plugins/projectexplorer/kitinformation.cpp
+++ b/src/plugins/projectexplorer/kitinformation.cpp
@@ -357,11 +357,10 @@ QList<Task> DeviceKitInformation::validate(const Kit *k) const
void DeviceKitInformation::fix(Kit *k)
{
IDevice::ConstPtr dev = DeviceKitInformation::device(k);
- if (!dev.isNull() && dev->type() == DeviceTypeKitInformation::deviceTypeId(k))
- return;
-
- qWarning("Device is no longer known, removing from kit \"%s\".", qPrintable(k->displayName()));
- setDeviceId(k, Core::Id());
+ if (!dev.isNull() && dev->type() != DeviceTypeKitInformation::deviceTypeId(k)) {
+ qWarning("Device is no longer known, removing from kit \"%s\".", qPrintable(k->displayName()));
+ setDeviceId(k, Core::Id());
+ }
}
void DeviceKitInformation::setup(Kit *k)
diff --git a/src/plugins/projectexplorer/localenvironmentaspect.cpp b/src/plugins/projectexplorer/localenvironmentaspect.cpp
index 6d9268aba3..faef642a17 100644
--- a/src/plugins/projectexplorer/localenvironmentaspect.cpp
+++ b/src/plugins/projectexplorer/localenvironmentaspect.cpp
@@ -69,23 +69,11 @@ Utils::Environment LocalEnvironmentAspect::baseEnvironment() const
if (BuildConfiguration *bc = runConfiguration()->target()->activeBuildConfiguration()) {
env = bc->environment();
} else { // Fallback for targets without buildconfigurations:
-#if 1
- // workaround for QTBUG-35143
env = Utils::Environment::systemEnvironment();
- env.unset(QLatin1String("QSG_RENDER_LOOP"));
-#else
- env = Utils::Environment::systemEnvironment();
-#endif
runConfiguration()->target()->kit()->addToEnvironment(env);
}
} else if (base == static_cast<int>(SystemEnvironmentBase)) {
-#if 1
- // workaround for QTBUG-35143
- env = Utils::Environment::systemEnvironment();
- env.unset(QLatin1String("QSG_RENDER_LOOP"));
-#else
- env = Utils::Environment::systemEnvironment();
-#endif
+ env = Utils::Environment::systemEnvironment();
}
if (const LocalApplicationRunConfiguration *rc = qobject_cast<const LocalApplicationRunConfiguration *>(runConfiguration()))
diff --git a/src/plugins/qmlprojectmanager/qmlprojectenvironmentaspect.cpp b/src/plugins/qmlprojectmanager/qmlprojectenvironmentaspect.cpp
index ab60581b20..cef5dfeee4 100644
--- a/src/plugins/qmlprojectmanager/qmlprojectenvironmentaspect.cpp
+++ b/src/plugins/qmlprojectmanager/qmlprojectenvironmentaspect.cpp
@@ -51,14 +51,7 @@ QString QmlProjectEnvironmentAspect::baseEnvironmentDisplayName(int base) const
Utils::Environment QmlProjectManager::QmlProjectEnvironmentAspect::baseEnvironment() const
{
-#if 1
- // workaround for QTBUG-35143
- Utils::Environment env = Utils::Environment::systemEnvironment();
- env.unset(QLatin1String("QSG_RENDER_LOOP"));
- return env;
-#else
return Utils::Environment::systemEnvironment();
-#endif
}
QmlProjectEnvironmentAspect::QmlProjectEnvironmentAspect(ProjectExplorer::RunConfiguration *rc) :