PE: Fix file pattern regular expression

If the warning contains chained warnings we end up grabbing
too much and the file path is corrupt which also ends up
in strange visual issues on the issues pane.

Change-Id: Id343935ec933026d461d6572e7e5f4e15dc3da74
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Christian Stenger
2021-08-27 13:58:16 +02:00
parent aca5e375f4
commit d96d9c1f3d

View File

@@ -35,7 +35,7 @@
using namespace Utils; using namespace Utils;
// As of MSVC 2015: "foo.cpp(42) :" -> "foo.cpp(42):" // As of MSVC 2015: "foo.cpp(42) :" -> "foo.cpp(42):"
static const char FILE_POS_PATTERN[] = "^(?:\\d+>)?(cl|LINK|.+[^ ]) ?: "; static const char FILE_POS_PATTERN[] = "^(?:\\d+>)?(cl|LINK|.+?[^ ]) ?: ";
static QPair<FilePath, int> parseFileName(const QString &input) static QPair<FilePath, int> parseFileName(const QString &input)
{ {
@@ -398,6 +398,24 @@ void ProjectExplorerPlugin::testMsvcOutputParsers_data()
FilePath::fromUserInput("x:\\src\\plugins\\projectexplorer\\msvcparser.cpp"), 69)) FilePath::fromUserInput("x:\\src\\plugins\\projectexplorer\\msvcparser.cpp"), 69))
<< ""; << "";
QTest::newRow("labeled chained warning")
<< "x:\\src\\libs\\narf\\stringutils.cpp(155): warning C4996: "
"'std::wstring_convert<std::codecvt_utf8_utf16<wchar_t,1114111,(std::codecvt_mode)0>"
",wchar_t,std::allocator<wchar_t>,std::allocator<char>>::from_bytes': "
"warning STL4017: std::wbuffer_convert, std::wstring_convert, and the <codecvt> "
"header (containing std::codecvt_mode, std::codecvt_utf8, std::codecvt_utf16, and "
"std::codecvt_utf8_utf16) are deprecated in C++17. more blabla"
<< OutputParserTester::STDOUT
<< "" << ""
<< (Tasks()
<< CompileTask(Task::Warning,
"STL4017: std::wbuffer_convert, std::wstring_convert, and the "
"<codecvt> header (containing std::codecvt_mode, std::codecvt_utf8, "
"std::codecvt_utf16, and std::codecvt_utf8_utf16) are deprecated in "
"C++17. more blabla",
FilePath::fromUserInput("x:\\src\\libs\\narf\\stringutils.cpp"), 155))
<< "";
QTest::newRow("additional information") QTest::newRow("additional information")
<< "x:\\src\\plugins\\texteditor\\icompletioncollector.h(50) : warning C4099: 'TextEditor::CompletionItem' : type name first seen using 'struct' now seen using 'class'\n" << "x:\\src\\plugins\\texteditor\\icompletioncollector.h(50) : warning C4099: 'TextEditor::CompletionItem' : type name first seen using 'struct' now seen using 'class'\n"
" x:\\src\\plugins\\texteditor\\completionsupport.h(39) : see declaration of 'TextEditor::CompletionItem'" " x:\\src\\plugins\\texteditor\\completionsupport.h(39) : see declaration of 'TextEditor::CompletionItem'"