From 6ffabeec07aa176a0e5523331d94af972cc1269b Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Sun, 2 Apr 2017 17:12:44 +0300 Subject: MSVCParser: Support "note" lines MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit main.cpp(7): error C2733: 'func': second C linkage of overloaded function not allowed main.cpp(6): note: see declaration of 'func' Change-Id: I46bbc86add628e7eadd5930ddf2fe9518b9e7adf Reviewed-by: André Hartmann Reviewed-by: Tobias Hunger --- src/plugins/projectexplorer/msvcparser.cpp | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) (limited to 'src/plugins/projectexplorer/msvcparser.cpp') diff --git a/src/plugins/projectexplorer/msvcparser.cpp b/src/plugins/projectexplorer/msvcparser.cpp index 929d265448..74eb294096 100644 --- a/src/plugins/projectexplorer/msvcparser.cpp +++ b/src/plugins/projectexplorer/msvcparser.cpp @@ -32,7 +32,6 @@ // As of MSVC 2015: "foo.cpp(42) :" -> "foo.cpp(42):" static const char FILE_POS_PATTERN[] = "^(?:\\d+>)?(cl|LINK|.+[^ ]) ?: "; -static const char ERROR_PATTERN[] = "[A-Z]+\\d\\d\\d\\d ?:"; static QPair parseFileName(const QString &input) { @@ -97,9 +96,9 @@ static Task::TaskType taskType(const QString &category) MsvcParser::MsvcParser() { setObjectName(QLatin1String("MsvcParser")); - m_compileRegExp.setPattern(QLatin1String(FILE_POS_PATTERN) - + QLatin1String("(Command line |fatal )?(warning|error) (") - + QLatin1String(ERROR_PATTERN) + QLatin1String(".*)$")); + m_compileRegExp.setPattern(QString(FILE_POS_PATTERN) + + "(?:Command line |fatal )?(?:(warning|error) " + "([A-Z]+\\d{4} ?: )|note: )(.*)$"); QTC_CHECK(m_compileRegExp.isValid()); m_additionalInfoRegExp.setPattern(QString::fromLatin1("^ (?:(could be |or )\\s*')?(.*)\\((\\d+)\\) : (.*)$")); QTC_CHECK(m_additionalInfoRegExp.isValid()); @@ -175,8 +174,8 @@ bool MsvcParser::processCompileLine(const QString &line) QRegularExpressionMatch match = m_compileRegExp.match(line); if (match.hasMatch()) { QPair position = parseFileName(match.captured(1)); - m_lastTask = Task(taskType(match.captured(3)), - match.captured(4).trimmed() /* description */, + m_lastTask = Task(taskType(match.captured(2)), + match.captured(3) + match.captured(4).trimmed(), // description position.first, position.second, Constants::TASK_CATEGORY_COMPILE); m_lines = 1; @@ -547,6 +546,22 @@ void ProjectExplorerPlugin::testMsvcOutputParsers_data() << QString() << QString::fromLatin1("/home/qtwebkithelpviewer.h:0: Note: No relevant classes found. No output generated.\n") << (QList()) << QString(); + + QTest::newRow("error with note") + << "main.cpp(7): error C2733: 'func': second C linkage of overloaded function not allowed\n" + "main.cpp(6): note: see declaration of 'func'" + << OutputParserTester::STDOUT + << QString() << QString() + << (QList() + << Task(Task::Error, + "C2733: 'func': second C linkage of overloaded function not allowed", + Utils::FileName::fromUserInput("main.cpp"), 7, + Constants::TASK_CATEGORY_COMPILE) + << Task(Task::Unknown, + "see declaration of 'func'", + Utils::FileName::fromUserInput("main.cpp"), 6, + Constants::TASK_CATEGORY_COMPILE)) + << QString(); } void ProjectExplorerPlugin::testMsvcOutputParsers() -- cgit v1.2.1