summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordt <qtc-committer@nokia.com>2010-04-09 18:43:05 +0200
committerdt <qtc-committer@nokia.com>2010-04-12 15:05:11 +0200
commit3de06688943ce4e276c3c7f68d42b9e490176797 (patch)
tree6b164cebeafb6374b9b6c81fd6a39af2f9fd5e83 /src
parentdb0bf8f30e6e24b1cdc76703aa70c7a32bde659f (diff)
downloadqt-creator-3de06688943ce4e276c3c7f68d42b9e490176797.tar.gz
Linux icc parser
Reviewed-By: hunger
Diffstat (limited to 'src')
-rw-r--r--src/plugins/debugger/debuggermanager.cpp4
-rw-r--r--src/plugins/genericprojectmanager/genericproject.cpp5
-rw-r--r--src/plugins/projectexplorer/gccparser.cpp2
-rw-r--r--src/plugins/projectexplorer/linuxiccparser.cpp179
-rw-r--r--src/plugins/projectexplorer/linuxiccparser.h58
-rw-r--r--src/plugins/projectexplorer/projectexplorer.h3
-rw-r--r--src/plugins/projectexplorer/projectexplorer.pro6
-rw-r--r--src/plugins/projectexplorer/toolchain.cpp25
-rw-r--r--src/plugins/projectexplorer/toolchain.h12
-rw-r--r--src/plugins/qt4projectmanager/qt4runconfiguration.cpp1
-rw-r--r--src/plugins/qt4projectmanager/qtversionmanager.cpp6
11 files changed, 289 insertions, 12 deletions
diff --git a/src/plugins/debugger/debuggermanager.cpp b/src/plugins/debugger/debuggermanager.cpp
index ba2c527fd1..94ab51002c 100644
--- a/src/plugins/debugger/debuggermanager.cpp
+++ b/src/plugins/debugger/debuggermanager.cpp
@@ -962,7 +962,7 @@ static QString msgEngineNotAvailable(const char *engine)
static IDebuggerEngine *debuggerEngineForToolChain(int toolChainType)
{
switch (toolChainType) {
- //case ProjectExplorer::ToolChain::LinuxICC:
+ case ProjectExplorer::ToolChain::LINUX_ICC:
case ProjectExplorer::ToolChain::MinGW:
case ProjectExplorer::ToolChain::GCC:
return gdbEngine;
@@ -1892,7 +1892,7 @@ bool DebuggerManager::checkDebugConfiguration(int toolChain,
bool success = true;
switch(toolChain) {
case ProjectExplorer::ToolChain::GCC:
- //case ProjectExplorer::ToolChain::LinuxICC:
+ case ProjectExplorer::ToolChain::LINUX_ICC:
case ProjectExplorer::ToolChain::MinGW:
case ProjectExplorer::ToolChain::WINCE: // S60
case ProjectExplorer::ToolChain::WINSCW:
diff --git a/src/plugins/genericprojectmanager/genericproject.cpp b/src/plugins/genericprojectmanager/genericproject.cpp
index c21d3744b0..d699c609b2 100644
--- a/src/plugins/genericprojectmanager/genericproject.cpp
+++ b/src/plugins/genericprojectmanager/genericproject.cpp
@@ -348,10 +348,11 @@ void GenericProject::setToolChainType(ProjectExplorer::ToolChain::ToolChainType
} else if (type == ToolChain::WINCE) {
const QString msvcVersion, wincePlatform; // ### FIXME
m_toolChain = ToolChain::createWinCEToolChain(msvcVersion, wincePlatform);
-
- } else if (type == ToolChain::GCC || type == ToolChain::GCC) {
+ } else if (type == ToolChain::GCC) {
const QLatin1String qmake_cxx("g++"); // ### FIXME
m_toolChain = ToolChain::createGccToolChain(qmake_cxx);
+ } else if (type == ToolChain::LINUX_ICC) {
+ m_toolChain = ToolChain::createLinuxIccToolChain();
}
}
diff --git a/src/plugins/projectexplorer/gccparser.cpp b/src/plugins/projectexplorer/gccparser.cpp
index 6cfab50305..a9deb7a241 100644
--- a/src/plugins/projectexplorer/gccparser.cpp
+++ b/src/plugins/projectexplorer/gccparser.cpp
@@ -29,8 +29,8 @@
#include "gccparser.h"
#include "ldparser.h"
-#include "projectexplorerconstants.h"
#include "taskwindow.h"
+#include "projectexplorerconstants.h"
using namespace ProjectExplorer;
diff --git a/src/plugins/projectexplorer/linuxiccparser.cpp b/src/plugins/projectexplorer/linuxiccparser.cpp
new file mode 100644
index 0000000000..cb45e8a844
--- /dev/null
+++ b/src/plugins/projectexplorer/linuxiccparser.cpp
@@ -0,0 +1,179 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+
+#include "linuxiccparser.h"
+#include "ldparser.h"
+#include "taskwindow.h"
+#include "projectexplorerconstants.h"
+#include <QtCore/QDebug>
+
+using namespace ProjectExplorer;
+
+LinuxIccParser::LinuxIccParser()
+ : m_expectFirstLine(true)
+{
+ // main.cpp(53): error #308: function \"AClass::privatefunc\" (declared at line 4 of \"main.h\") is inaccessible
+
+ m_firstLine.setPattern("^([^\\(\\)]+)" // filename (cap 1)
+ "\\((\\d+)\\):" // line number including : (cap 2)
+ " ((error|warning)( #\\d+)?: )?" // optional type (cap 4) and optional error number // TODO really optional ?
+ "(.*)$"); // description (cap 6)
+ //m_firstLine.setMinimal(true);
+
+ // Note pattern also matches caret lines
+ m_continuationLines.setPattern("^\\s+" // At least one whitespace
+ "(.*)$");// description
+ m_continuationLines.setMinimal(true);
+
+ m_caretLine.setPattern("^\\s*" // Whitespaces
+ "\\^" // a caret
+ "\\s*$"); // and again whitespaces
+ m_caretLine.setMinimal(true);
+
+ appendOutputParser(new LdParser);
+}
+
+void LinuxIccParser::stdError(const QString &line)
+{
+ if (m_expectFirstLine && m_firstLine.indexIn(line) != -1) {
+ // Clear out old task
+ m_temporary = ProjectExplorer::Task();
+ m_temporary.file = m_firstLine.cap(1);
+ m_temporary.line = m_firstLine.cap(2).toInt();
+ QString category = m_firstLine.cap(4);
+ if (category == QLatin1String("error"))
+ m_temporary.type = Task::Error;
+ else if (category == QLatin1String("warning"))
+ m_temporary.type = Task::Warning;
+ else
+ m_temporary.type = Task::Unknown;
+ m_temporary.category = Constants::TASK_CATEGORY_COMPILE;
+ m_temporary.description = m_firstLine.cap(6).trimmed();
+
+ m_expectFirstLine = false;
+ } else if (!m_expectFirstLine && m_caretLine.indexIn(line) != -1) {
+ // TODO do something
+ } else if (!m_expectFirstLine && line.trimmed().isEmpty()) { // last Line
+ m_expectFirstLine = true;
+ emit addTask(m_temporary);
+ } else if (!m_expectFirstLine && m_continuationLines.indexIn(line) != -1) {
+ m_temporary.description.append("\n");
+ m_temporary.description.append(m_continuationLines.cap(1).trimmed());
+ } else {
+ IOutputParser::stdError(line);
+ }
+}
+
+#ifdef WITH_TESTS
+# include <QTest>
+# include "projectexplorer.h"
+# include "metatypedeclarations.h"
+# include "outputparser_test.h"
+
+void ProjectExplorerPlugin::testLinuxIccOutputParsers_data()
+{
+ QTest::addColumn<QString>("input");
+ QTest::addColumn<OutputParserTester::Channel>("inputChannel");
+ QTest::addColumn<QString>("childStdOutLines");
+ QTest::addColumn<QString>("childStdErrLines");
+ QTest::addColumn<QList<ProjectExplorer::Task> >("tasks");
+ QTest::addColumn<QString>("outputLines");
+
+
+ QTest::newRow("pass-through stdout")
+ << QString::fromLatin1("Sometext") << OutputParserTester::STDOUT
+ << QString::fromLatin1("Sometext") << QString()
+ << QList<ProjectExplorer::Task>()
+ << QString();
+ QTest::newRow("pass-through stderr")
+ << QString::fromLatin1("Sometext") << OutputParserTester::STDERR
+ << QString() << QString::fromLatin1("Sometext")
+ << QList<ProjectExplorer::Task>()
+ << QString();
+
+ QTest::newRow("undeclared function")
+ << QString::fromLatin1("main.cpp(13): error: identifier \"f\" is undefined\n"
+ " f(0);\n"
+ " ^\n"
+ "\n")
+ << OutputParserTester::STDERR
+ << QString() << QString()
+ << (QList<ProjectExplorer::Task>()
+ << Task(Task::Error,
+ QLatin1String("identifier \"f\" is undefined\nf(0);"),
+ QLatin1String("main.cpp"), 13,
+ Constants::TASK_CATEGORY_COMPILE))
+ << QString();
+
+ QTest::newRow("private function")
+ << QString::fromLatin1("main.cpp(53): error #308: function \"AClass::privatefunc\" (declared at line 4 of \"main.h\") is inaccessible\n"
+ " b.privatefunc();\n"
+ " ^\n"
+ "\n")
+ << OutputParserTester::STDERR
+ << QString() << QString()
+ << (QList<ProjectExplorer::Task>()
+ << Task(Task::Error,
+ QLatin1String("function \"AClass::privatefunc\" (declared at line 4 of \"main.h\") is inaccessible\nb.privatefunc();"),
+ QLatin1String("main.cpp"), 53,
+ Constants::TASK_CATEGORY_COMPILE))
+ << QString();
+
+ QTest::newRow("simple warning")
+ << QString::fromLatin1("main.cpp(41): warning #187: use of \"=\" where \"==\" may have been intended\n"
+ " while (a = true)\n"
+ " ^\n"
+ "\n")
+ << OutputParserTester::STDERR
+ << QString() << QString()
+ << (QList<ProjectExplorer::Task>()
+ << Task(Task::Warning,
+ QLatin1String("use of \"=\" where \"==\" may have been intended\nwhile (a = true)"),
+ QLatin1String("main.cpp"), 41,
+ Constants::TASK_CATEGORY_COMPILE))
+ << QString();
+}
+
+void ProjectExplorerPlugin::testLinuxIccOutputParsers()
+{
+ OutputParserTester testbench;
+ testbench.appendOutputParser(new LinuxIccParser);
+ QFETCH(QString, input);
+ QFETCH(OutputParserTester::Channel, inputChannel);
+ QFETCH(QList<Task>, tasks);
+ QFETCH(QString, childStdOutLines);
+ QFETCH(QString, childStdErrLines);
+ QFETCH(QString, outputLines);
+
+ testbench.testParsing(input, inputChannel,
+ tasks, childStdOutLines, childStdErrLines,
+ outputLines);
+}
+
+#endif
diff --git a/src/plugins/projectexplorer/linuxiccparser.h b/src/plugins/projectexplorer/linuxiccparser.h
new file mode 100644
index 0000000000..0c4b472ff4
--- /dev/null
+++ b/src/plugins/projectexplorer/linuxiccparser.h
@@ -0,0 +1,58 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+
+#ifndef LINUXICCPARSER_H
+#define LINUXICCPARSER_H
+
+#include "ioutputparser.h"
+
+#include <QtCore/QRegExp>
+
+namespace ProjectExplorer {
+
+class LinuxIccParser : public ProjectExplorer::IOutputParser
+{
+ Q_OBJECT
+
+public:
+ LinuxIccParser();
+ virtual void stdError(const QString &line);
+
+private:
+ QRegExp m_firstLine;
+ QRegExp m_continuationLines;
+ QRegExp m_caretLine;
+
+ bool m_expectFirstLine;
+ ProjectExplorer::Task m_temporary;
+};
+
+} // namespace ProjectExplorer
+
+#endif // GCCPARSER_H
diff --git a/src/plugins/projectexplorer/projectexplorer.h b/src/plugins/projectexplorer/projectexplorer.h
index 3dcbb42102..467f124e7e 100644
--- a/src/plugins/projectexplorer/projectexplorer.h
+++ b/src/plugins/projectexplorer/projectexplorer.h
@@ -194,6 +194,9 @@ private slots:
void testGccOutputParsers_data();
void testGccOutputParsers();
+ void testLinuxIccOutputParsers_data();
+ void testLinuxIccOutputParsers();
+
void testGnuMakeParserParsing_data();
void testGnuMakeParserParsing();
void testGnuMakeParserTaskMangling_data();
diff --git a/src/plugins/projectexplorer/projectexplorer.pro b/src/plugins/projectexplorer/projectexplorer.pro
index 5c9a208458..a4c9668f13 100644
--- a/src/plugins/projectexplorer/projectexplorer.pro
+++ b/src/plugins/projectexplorer/projectexplorer.pro
@@ -78,7 +78,8 @@ HEADERS += projectexplorer.h \
addtargetdialog.h \
buildenvironmentwidget.h \
buildconfigdialog.h \
- ldparser.h
+ ldparser.h \
+ linuxiccparser.h
SOURCES += projectexplorer.cpp \
projectwindow.cpp \
buildmanager.cpp \
@@ -143,7 +144,8 @@ SOURCES += projectexplorer.cpp \
addtargetdialog.cpp \
buildenvironmentwidget.cpp \
buildconfigdialog.cpp \
- ldparser.cpp
+ ldparser.cpp \
+ linuxiccparser.cpp
FORMS += processstep.ui \
editorsettingspropertiespage.ui \
runsettingspropertiespage.ui \
diff --git a/src/plugins/projectexplorer/toolchain.cpp b/src/plugins/projectexplorer/toolchain.cpp
index a4bb2db97b..523689e57b 100644
--- a/src/plugins/projectexplorer/toolchain.cpp
+++ b/src/plugins/projectexplorer/toolchain.cpp
@@ -33,6 +33,7 @@
#include "projectexplorersettings.h"
#include "gccparser.h"
#include "msvcparser.h"
+#include "linuxiccparser.h"
#include <QtCore/QDebug>
#include <QtCore/QFileInfo>
@@ -83,6 +84,11 @@ ToolChain *ToolChain::createMinGWToolChain(const QString &gcc, const QString &mi
return new MinGWToolChain(gcc, mingwPath);
}
+ToolChain *ToolChain::createLinuxIccToolChain()
+{
+ return new LinuxIccToolChain();
+}
+
ToolChain *ToolChain::createMSVCToolChain(const QString &name, bool amd64)
{
return MSVCToolChain::create(name, amd64);
@@ -124,8 +130,8 @@ QString ToolChain::toolChainName(ToolChainType tc)
switch (tc) {
case GCC:
return QCoreApplication::translate("ToolChain", "GCC");
-// case LinuxICC:
-// return QCoreApplication::translate("ToolChain", "Intel C++ Compiler (Linux)");
+ case LINUX_ICC:
+ return QCoreApplication::translate("ToolChain", "Intel C++ Compiler (Linux)");
case MinGW:
return QString::fromLatin1("MinGW");
case MSVC:
@@ -319,6 +325,21 @@ IOutputParser *MinGWToolChain::outputParser() const
return new GccParser;
}
+LinuxIccToolChain::LinuxIccToolChain()
+ : GccToolChain(QLatin1String("icpc"))
+{
+}
+
+ToolChain::ToolChainType LinuxIccToolChain::type() const
+{
+ return ToolChain::LINUX_ICC;
+}
+
+IOutputParser *LinuxIccToolChain::outputParser() const
+{
+ return new LinuxIccParser;
+}
+
// ---------------- MSVC installation location code
// Format the name of an SDK or VC installation version with platform
diff --git a/src/plugins/projectexplorer/toolchain.h b/src/plugins/projectexplorer/toolchain.h
index 99cf9667e3..ea3453d9e1 100644
--- a/src/plugins/projectexplorer/toolchain.h
+++ b/src/plugins/projectexplorer/toolchain.h
@@ -76,7 +76,7 @@ public:
enum ToolChainType
{
GCC = 0,
- // LINUX_ICC = 1,
+ LINUX_ICC = 1,
MinGW = 2,
MSVC = 3,
WINCE = 4,
@@ -107,6 +107,7 @@ public:
// Factory methods
static ToolChain *createGccToolChain(const QString &gcc);
static ToolChain *createMinGWToolChain(const QString &gcc, const QString &mingwPath);
+ static ToolChain *createLinuxIccToolChain();
static ToolChain *createMSVCToolChain(const QString &name, bool amd64);
static ToolChain *createWinCEToolChain(const QString &name, const QString &platform);
static QStringList availableMSVCVersions();
@@ -157,6 +158,15 @@ private:
QString m_mingwPath;
};
+class PROJECTEXPLORER_EXPORT LinuxIccToolChain : public GccToolChain
+{
+public:
+ LinuxIccToolChain();
+ virtual ToolChainType type() const;
+
+ virtual IOutputParser *outputParser() const;
+};
+
// TODO some stuff needs to be moved into this
class PROJECTEXPLORER_EXPORT MSVCToolChain : public ToolChain
{
diff --git a/src/plugins/qt4projectmanager/qt4runconfiguration.cpp b/src/plugins/qt4projectmanager/qt4runconfiguration.cpp
index 25ef2e71d9..c5f62e8654 100644
--- a/src/plugins/qt4projectmanager/qt4runconfiguration.cpp
+++ b/src/plugins/qt4projectmanager/qt4runconfiguration.cpp
@@ -142,6 +142,7 @@ bool Qt4RunConfiguration::isEnabled(ProjectExplorer::BuildConfiguration *configu
case ToolChain::GCC: case ToolChain::MinGW:
case ToolChain::GCCE_GNUPOC: case ToolChain::RVCT_ARMV5_GNUPOC:
case ToolChain::OTHER: case ToolChain::UNKNOWN:
+ case ToolChain::LINUX_ICC:
case ToolChain::INVALID:
enabled = true;
break;
diff --git a/src/plugins/qt4projectmanager/qtversionmanager.cpp b/src/plugins/qt4projectmanager/qtversionmanager.cpp
index 003809aea4..ddf3291188 100644
--- a/src/plugins/qt4projectmanager/qtversionmanager.cpp
+++ b/src/plugins/qt4projectmanager/qtversionmanager.cpp
@@ -1333,16 +1333,18 @@ void QtVersion::updateToolChainAndMkspec() const
// we should try to do a better job, but for now that's good enough
ProjectExplorer::Environment env = ProjectExplorer::Environment::systemEnvironment();
//addToEnvironment(env);
- qmakeCXX = env.searchInPath(qmakeCXX);
if (qmakeCXX.isEmpty()) {
// macx-xcode mkspec resets the value of QMAKE_CXX.
// Unfortunately, we need a valid QMAKE_CXX to configure the parser.
qmakeCXX = QLatin1String("cc");
}
+ qmakeCXX = env.searchInPath(qmakeCXX);
m_toolChains << ToolChainPtr(ProjectExplorer::ToolChain::createGccToolChain(qmakeCXX));
m_targetIds.insert(QLatin1String(Constants::DESKTOP_TARGET_ID));
+ } else if (qmakeCXX == QLatin1String("icpc")) {
+ m_toolChains << ToolChainPtr(ProjectExplorer::ToolChain::createLinuxIccToolChain());
+ m_targetIds.insert(QLatin1String(Constants::DESKTOP_TARGET_ID));
}
-
if (m_toolChains.isEmpty()) {
qDebug()<<"Could not create ToolChain for"<<m_mkspecFullPath<<qmakeCXX;
qDebug()<<"Qt Creator doesn't know about the system includes, nor the systems defines.";