aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2020-07-06 17:17:49 +0200
committerChristian Kandeler <christian.kandeler@qt.io>2020-07-07 10:21:43 +0000
commit284ff753f388171b2a5ccc4ade154c9af88cf09b (patch)
tree4735a9e634b4cb714edad1801e87772425710362
parentef87abdfbffc3b69f5948841a1eae6722336148e (diff)
GccParser: Catch file paths in "inlined from" lines
Change-Id: Ia16e5e4e3d3ce453e54df8eac48248164059bdc9 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
-rw-r--r--src/plugins/projectexplorer/gccparser.cpp36
-rw-r--r--src/plugins/projectexplorer/gccparser.h1
2 files changed, 37 insertions, 0 deletions
diff --git a/src/plugins/projectexplorer/gccparser.cpp b/src/plugins/projectexplorer/gccparser.cpp
index e4ea4a94cc..6176bf41c3 100644
--- a/src/plugins/projectexplorer/gccparser.cpp
+++ b/src/plugins/projectexplorer/gccparser.cpp
@@ -52,6 +52,10 @@ GccParser::GccParser()
+ QLatin1String("(\\d+)(:\\d+)?[,:]?$"));
QTC_CHECK(m_regExpIncluded.isValid());
+ m_regExpInlined.setPattern(QString::fromLatin1("\\binlined from\\s.* at ")
+ + FILE_PATTERN + "(\\d+)(:\\d+)?[,:]?$");
+ QTC_CHECK(m_regExpInlined.isValid());
+
// optional path with trailing slash
// optional arm-linux-none-thingy
// name of executable
@@ -166,6 +170,8 @@ OutputLineParser::Result GccParser::handleLine(const QString &line, OutputFormat
}
match = m_regExpIncluded.match(lne);
+ if (!match.hasMatch())
+ match = m_regExpInlined.match(lne);
if (match.hasMatch()) {
const FilePath filePath = absoluteFilePath(FilePath::fromUserInput(match.captured(1)));
const int lineNo = match.captured(3).toInt();
@@ -1106,6 +1112,36 @@ void ProjectExplorerPlugin::testGccOutputParsers_data()
" | ~~~~~~~~~~~~^~~",
FilePath::fromUserInput("param-type-mismatch.c"), 5)}
<< QString();
+
+ QTest::newRow(R"("inlined from")")
+ << QString("In file included from smallstringvector.h:30,\n"
+ " from smallstringio.h:28,\n"
+ " from gtest-creator-printing.h:29,\n"
+ " from googletest.h:41,\n"
+ " from smallstring-test.cpp:26:\n"
+ "In member function ‘void Utils::BasicSmallString<Size>::append(Utils::SmallStringView) [with unsigned int Size = 31]’,\n"
+ " inlined from ‘Utils::BasicSmallString<Size>& Utils::BasicSmallString<Size>::operator+=(Utils::SmallStringView) [with unsigned int Size = 31]’ at smallstring.h:471:15,\n"
+ " inlined from ‘virtual void SmallString_AppendLongSmallStringToShortSmallString_Test::TestBody()’ at smallstring-test.cpp:850:63:\n"
+ "smallstring.h:465:21: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]\n"
+ " 465 | at(newSize) = 0;\n"
+ " | ~~~~~~~~~~~~^~~")
+ << OutputParserTester::STDERR
+ << QString() << QString()
+ << Tasks{CompileTask(Task::Warning,
+ "writing 1 byte into a region of size 0 [-Wstringop-overflow=]\n"
+ "In file included from smallstringvector.h:30,\n"
+ " from smallstringio.h:28,\n"
+ " from gtest-creator-printing.h:29,\n"
+ " from googletest.h:41,\n"
+ " from smallstring-test.cpp:26:\n"
+ "In member function ‘void Utils::BasicSmallString<Size>::append(Utils::SmallStringView) [with unsigned int Size = 31]’,\n"
+ " inlined from ‘Utils::BasicSmallString<Size>& Utils::BasicSmallString<Size>::operator+=(Utils::SmallStringView) [with unsigned int Size = 31]’ at smallstring.h:471:15,\n"
+ " inlined from ‘virtual void SmallString_AppendLongSmallStringToShortSmallString_Test::TestBody()’ at smallstring-test.cpp:850:63:\n"
+ "smallstring.h:465:21: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]\n"
+ " 465 | at(newSize) = 0;\n"
+ " | ~~~~~~~~~~~~^~~",
+ FilePath::fromUserInput("smallstring.h"), 465)}
+ << QString();
}
void ProjectExplorerPlugin::testGccOutputParsers()
diff --git a/src/plugins/projectexplorer/gccparser.h b/src/plugins/projectexplorer/gccparser.h
index 9186998cd4..220fc31444 100644
--- a/src/plugins/projectexplorer/gccparser.h
+++ b/src/plugins/projectexplorer/gccparser.h
@@ -63,6 +63,7 @@ private:
QRegularExpression m_regExp;
QRegularExpression m_regExpIncluded;
+ QRegularExpression m_regExpInlined;
QRegularExpression m_regExpGccNames;
Task m_currentTask;