summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorTobias Hunger <tobias.hunger@digia.com>2013-10-29 12:07:16 +0100
committerTobias Hunger <tobias.hunger@digia.com>2013-10-29 15:42:01 +0100
commit54d9f41c0629f2f6971f3ce36e9b71c6fae47e9f (patch)
treeed12de36d259b734cf50e86bd520777491a849d9 /src/plugins
parentb17bb91355a428ecd89504ba7968e272e854ceb5 (diff)
downloadqt-creator-54d9f41c0629f2f6971f3ce36e9b71c6fae47e9f.tar.gz
GccToolChain: Make macro retrieval more explicit
Make the retrieval of information on pre-defined macros more explicit and use the information to populate the tool chain with after it is constructed. This avoids doing one run of the compiler per auto-detected debugger during the start-up of Qt Creator. Change-Id: Ie741dccede91079b4126056676c31975f340dbae Reviewed-by: Daniel Teske <daniel.teske@digia.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/projectexplorer/gcctoolchain.cpp15
-rw-r--r--src/plugins/projectexplorer/gcctoolchain.h2
-rw-r--r--src/plugins/projectexplorer/gcctoolchainfactories.h1
3 files changed, 14 insertions, 4 deletions
diff --git a/src/plugins/projectexplorer/gcctoolchain.cpp b/src/plugins/projectexplorer/gcctoolchain.cpp
index 48a05ed271..b12a3d401b 100644
--- a/src/plugins/projectexplorer/gcctoolchain.cpp
+++ b/src/plugins/projectexplorer/gcctoolchain.cpp
@@ -214,6 +214,7 @@ static QList<Abi> guessGccAbi(const QString &m, const QByteArray &macros)
}
static QList<Abi> guessGccAbi(const FileName &path, const QStringList &env,
+ const QByteArray &macros,
const QStringList &extraArgs = QStringList())
{
if (path.isEmpty())
@@ -224,7 +225,6 @@ static QList<Abi> guessGccAbi(const FileName &path, const QStringList &env,
QString machine = QString::fromLocal8Bit(runGcc(path, arguments, env)).trimmed();
if (machine.isEmpty())
return QList<Abi>(); // no need to continue if running failed once...
- QByteArray macros = gccPredefinedMacros(path, gccPredefinedMacrosOptions(), env);
return guessGccAbi(machine, macros);
}
@@ -724,7 +724,8 @@ QList<Abi> GccToolChain::detectSupportedAbis() const
{
Environment env = Environment::systemEnvironment();
addToEnvironment(env);
- return guessGccAbi(m_compilerCommand, env.toStringList(), platformCodeGenFlags());
+ QByteArray macros = predefinedMacros(QStringList());
+ return guessGccAbi(m_compilerCommand, env.toStringList(), macros, platformCodeGenFlags());
}
QString GccToolChain::detectVersion() const
@@ -803,7 +804,9 @@ QList<ToolChain *> GccToolChainFactory::autoDetectToolchains(const QString &comp
return result;
GccToolChain::addCommandPathToEnvironment(compilerPath, systemEnvironment);
- QList<Abi> abiList = guessGccAbi(compilerPath, systemEnvironment.toStringList());
+ QByteArray macros
+ = gccPredefinedMacros(compilerPath, gccPredefinedMacrosOptions(), systemEnvironment.toStringList());
+ QList<Abi> abiList = guessGccAbi(compilerPath, systemEnvironment.toStringList(), macros);
if (!abiList.contains(requiredAbi)) {
if (requiredAbi.wordWidth() != 64
|| !abiList.contains(Abi(requiredAbi.architecture(), requiredAbi.os(), requiredAbi.osFlavor(),
@@ -813,6 +816,7 @@ QList<ToolChain *> GccToolChainFactory::autoDetectToolchains(const QString &comp
foreach (const Abi &abi, abiList) {
QScopedPointer<GccToolChain> tc(createToolChain(true));
+ tc->setMacroCache(QStringList(), macros);
if (tc.isNull())
return result;
@@ -875,6 +879,7 @@ void GccToolChainConfigWidget::applyImpl()
tc->setDisplayName(displayName); // reset display name
tc->setPlatformCodeGenFlags(splitString(m_platformCodeGenFlagsLineEdit->text()));
tc->setPlatformLinkerFlags(splitString(m_platformLinkerFlagsLineEdit->text()));
+ tc->setMacroCache(tc->platformCodeGenFlags(), m_macros);
}
void GccToolChainConfigWidget::setFromToolchain()
@@ -937,7 +942,9 @@ void GccToolChainConfigWidget::handleCompilerCommandChange()
if (haveCompiler) {
Environment env = Environment::systemEnvironment();
GccToolChain::addCommandPathToEnvironment(path, env);
- abiList = guessGccAbi(path, env.toStringList(),
+ QStringList args = gccPredefinedMacrosOptions() + splitString(m_platformCodeGenFlagsLineEdit->text());
+ m_macros = gccPredefinedMacros(path, args, env.toStringList());
+ abiList = guessGccAbi(path, env.toStringList(), m_macros,
splitString(m_platformCodeGenFlagsLineEdit->text()));
}
m_abiWidget->setEnabled(haveCompiler);
diff --git a/src/plugins/projectexplorer/gcctoolchain.h b/src/plugins/projectexplorer/gcctoolchain.h
index 2bcf3f0002..7b377da76f 100644
--- a/src/plugins/projectexplorer/gcctoolchain.h
+++ b/src/plugins/projectexplorer/gcctoolchain.h
@@ -43,6 +43,7 @@ namespace ProjectExplorer {
namespace Internal {
class ClangToolChainFactory;
+class GccToolChainConfigWidget;
class GccToolChainFactory;
class MingwToolChainFactory;
class LinuxIccToolChainFactory;
@@ -145,6 +146,7 @@ private:
mutable QList<HeaderPath> m_headerPaths;
mutable QString m_version;
+ friend class Internal::GccToolChainConfigWidget;
friend class Internal::GccToolChainFactory;
friend class ToolChainFactory;
};
diff --git a/src/plugins/projectexplorer/gcctoolchainfactories.h b/src/plugins/projectexplorer/gcctoolchainfactories.h
index 7a2ef000de..b1186ecc9d 100644
--- a/src/plugins/projectexplorer/gcctoolchainfactories.h
+++ b/src/plugins/projectexplorer/gcctoolchainfactories.h
@@ -102,6 +102,7 @@ private:
QList<Abi> m_abiList;
bool m_isReadOnly;
+ QByteArray m_macros;
};
// --------------------------------------------------------------------------