From d96d9c1f3d8df215d10262016e601969812988fd Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Fri, 27 Aug 2021 13:58:16 +0200 Subject: [PATCH] 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 --- src/plugins/projectexplorer/msvcparser.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/plugins/projectexplorer/msvcparser.cpp b/src/plugins/projectexplorer/msvcparser.cpp index 2ed0366902a..4b3a5b56d76 100644 --- a/src/plugins/projectexplorer/msvcparser.cpp +++ b/src/plugins/projectexplorer/msvcparser.cpp @@ -35,7 +35,7 @@ using namespace Utils; // 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 parseFileName(const QString &input) { @@ -398,6 +398,24 @@ void ProjectExplorerPlugin::testMsvcOutputParsers_data() 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" + ",wchar_t,std::allocator,std::allocator>::from_bytes': " + "warning STL4017: std::wbuffer_convert, std::wstring_convert, and the " + "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 " + " 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") << "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'"