forked from qt-creator/qt-creator
Linux icc parser
Reviewed-By: hunger
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
|
||||
#include "gccparser.h"
|
||||
#include "ldparser.h"
|
||||
#include "projectexplorerconstants.h"
|
||||
#include "taskwindow.h"
|
||||
#include "projectexplorerconstants.h"
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
|
||||
179
src/plugins/projectexplorer/linuxiccparser.cpp
Normal file
179
src/plugins/projectexplorer/linuxiccparser.cpp
Normal file
@@ -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
|
||||
58
src/plugins/projectexplorer/linuxiccparser.h
Normal file
58
src/plugins/projectexplorer/linuxiccparser.h
Normal file
@@ -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
|
||||
@@ -194,6 +194,9 @@ private slots:
|
||||
void testGccOutputParsers_data();
|
||||
void testGccOutputParsers();
|
||||
|
||||
void testLinuxIccOutputParsers_data();
|
||||
void testLinuxIccOutputParsers();
|
||||
|
||||
void testGnuMakeParserParsing_data();
|
||||
void testGnuMakeParserParsing();
|
||||
void testGnuMakeParserTaskMangling_data();
|
||||
|
||||
@@ -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 \
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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.";
|
||||
|
||||
Reference in New Issue
Block a user