diff options
author | Orgad Shaneh <orgad.shaneh@audiocodes.com> | 2013-07-19 11:37:46 +0300 |
---|---|---|
committer | Orgad Shaneh <orgads@gmail.com> | 2013-07-19 13:01:20 +0200 |
commit | 9744c54580bca54e1ce5db0d7ad94da333b9c213 (patch) | |
tree | 7cc4b4f47770075bdf7132fac39b57059708cf18 /src | |
parent | a27b0907ee9aecf1f9095e4cfaf4e6be9b33f908 (diff) | |
download | qt-creator-9744c54580bca54e1ce5db0d7ad94da333b9c213.tar.gz |
Add soft assertions for regexp patterns
Change-Id: If0072f8f9761bdc34b35d01aac4d00c5391b8a20
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/cmakeprojectmanager/cmakeparser.cpp | 4 | ||||
-rw-r--r-- | src/plugins/projectexplorer/gccparser.cpp | 5 | ||||
-rw-r--r-- | src/plugins/projectexplorer/gnumakeparser.cpp | 5 | ||||
-rw-r--r-- | src/plugins/projectexplorer/ldparser.cpp | 4 | ||||
-rw-r--r-- | src/plugins/projectexplorer/linuxiccparser.cpp | 5 | ||||
-rw-r--r-- | src/plugins/projectexplorer/msvcparser.cpp | 3 |
6 files changed, 26 insertions, 0 deletions
diff --git a/src/plugins/cmakeprojectmanager/cmakeparser.cpp b/src/plugins/cmakeprojectmanager/cmakeparser.cpp index 9242ee538b..0aaa844623 100644 --- a/src/plugins/cmakeprojectmanager/cmakeparser.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeparser.cpp @@ -29,6 +29,8 @@ #include "cmakeparser.h" +#include <utils/qtcassert.h> + #include <projectexplorer/gnumakeparser.h> #include <projectexplorer/projectexplorerconstants.h> @@ -46,9 +48,11 @@ CMakeParser::CMakeParser() : { m_commonError.setPattern(QLatin1String(COMMON_ERROR_PATTERN)); m_commonError.setMinimal(true); + QTC_CHECK(m_commonError.isValid()); m_nextSubError.setPattern(QLatin1String(NEXT_SUBERROR_PATTERN)); m_nextSubError.setMinimal(true); + QTC_CHECK(m_nextSubError.isValid()); appendOutputParser(new GnuMakeParser()); } diff --git a/src/plugins/projectexplorer/gccparser.cpp b/src/plugins/projectexplorer/gccparser.cpp index 1cd2b725c4..613707e656 100644 --- a/src/plugins/projectexplorer/gccparser.cpp +++ b/src/plugins/projectexplorer/gccparser.cpp @@ -32,6 +32,8 @@ #include "task.h" #include "projectexplorerconstants.h" +#include <utils/qtcassert.h> + using namespace ProjectExplorer; // opt. drive letter + filename: (2 brackets) @@ -44,10 +46,12 @@ GccParser::GccParser() m_regExp.setPattern(QLatin1Char('^') + QLatin1String(FILE_PATTERN) + QLatin1String("(\\d+):(\\d+:)?\\s+((fatal |#)?(warning|error|note):?\\s)?([^\\s].+)$")); m_regExp.setMinimal(true); + QTC_CHECK(m_regExp.isValid()); m_regExpIncluded.setPattern(QString::fromLatin1("\\bfrom\\s") + QLatin1String(FILE_PATTERN) + QLatin1String("(\\d+)(:\\d+)?[,:]?$")); m_regExpIncluded.setMinimal(true); + QTC_CHECK(m_regExpIncluded.isValid()); // optional path with trailing slash // optional arm-linux-none-thingy @@ -56,6 +60,7 @@ GccParser::GccParser() // optional .exe postfix m_regExpGccNames.setPattern(QLatin1String(COMMAND_PATTERN)); m_regExpGccNames.setMinimal(true); + QTC_CHECK(m_regExpGccNames.isValid()); appendOutputParser(new LdParser); } diff --git a/src/plugins/projectexplorer/gnumakeparser.cpp b/src/plugins/projectexplorer/gnumakeparser.cpp index e478255382..a1d19cc64f 100644 --- a/src/plugins/projectexplorer/gnumakeparser.cpp +++ b/src/plugins/projectexplorer/gnumakeparser.cpp @@ -32,6 +32,8 @@ #include "projectexplorerconstants.h" #include "task.h" +#include <utils/qtcassert.h> + #include <QDir> #include <QFile> @@ -50,10 +52,13 @@ GnuMakeParser::GnuMakeParser() : m_makeDir.setPattern(QLatin1String(MAKE_PATTERN) + QLatin1String("(\\w+) directory .(.+).$")); m_makeDir.setMinimal(true); + QTC_CHECK(m_makeDir.isValid()); m_makeLine.setPattern(QLatin1String(MAKE_PATTERN) + QLatin1String("(\\*\\*\\*\\s)?(.*)$")); m_makeLine.setMinimal(true); + QTC_CHECK(m_makeLine.isValid()); m_makefileError.setPattern(QLatin1String("^(.*):(\\d+):\\s\\*\\*\\*\\s(.*)$")); m_makefileError.setMinimal(true); + QTC_CHECK(m_makefileError.isValid()); } void GnuMakeParser::setWorkingDirectory(const QString &workingDirectory) diff --git a/src/plugins/projectexplorer/ldparser.cpp b/src/plugins/projectexplorer/ldparser.cpp index a555171524..55f21eec07 100644 --- a/src/plugins/projectexplorer/ldparser.cpp +++ b/src/plugins/projectexplorer/ldparser.cpp @@ -31,6 +31,8 @@ #include "projectexplorerconstants.h" #include "task.h" +#include <utils/qtcassert.h> + using namespace ProjectExplorer; namespace { @@ -50,9 +52,11 @@ LdParser::LdParser() QString::fromLatin1(FILE_PATTERN) + QLatin1String(")?(") + QLatin1String(POSITION_PATTERN) + QLatin1String(")?\\s(.+)$")); m_regExpLinker.setMinimal(true); + QTC_CHECK(m_regExpLinker.isValid()); m_regExpGccNames.setPattern(QLatin1String(COMMAND_PATTERN)); m_regExpGccNames.setMinimal(true); + QTC_CHECK(m_regExpGccNames.isValid()); } void LdParser::stdError(const QString &line) diff --git a/src/plugins/projectexplorer/linuxiccparser.cpp b/src/plugins/projectexplorer/linuxiccparser.cpp index bdd6f3ac1f..901c3afe23 100644 --- a/src/plugins/projectexplorer/linuxiccparser.cpp +++ b/src/plugins/projectexplorer/linuxiccparser.cpp @@ -31,6 +31,8 @@ #include "ldparser.h" #include "projectexplorerconstants.h" +#include <utils/qtcassert.h> + using namespace ProjectExplorer; LinuxIccParser::LinuxIccParser() @@ -44,16 +46,19 @@ LinuxIccParser::LinuxIccParser() " ((error|warning)( #\\d+)?: )?" // optional type (cap 4) and optional error number // TODO really optional ? "(.*)$")); // description (cap 6) //m_firstLine.setMinimal(true); + QTC_CHECK(m_firstLine.isValid()); // Note pattern also matches caret lines m_continuationLines.setPattern(QLatin1String("^\\s+" // At least one whitespace "(.*)$"));// description m_continuationLines.setMinimal(true); + QTC_CHECK(m_continuationLines.isValid()); m_caretLine.setPattern(QLatin1String("^\\s*" // Whitespaces "\\^" // a caret "\\s*$")); // and again whitespaces m_caretLine.setMinimal(true); + QTC_CHECK(m_caretLine.isValid()); appendOutputParser(new LdParser); } diff --git a/src/plugins/projectexplorer/msvcparser.cpp b/src/plugins/projectexplorer/msvcparser.cpp index b3fa47cfd3..56c4e4bc69 100644 --- a/src/plugins/projectexplorer/msvcparser.cpp +++ b/src/plugins/projectexplorer/msvcparser.cpp @@ -30,6 +30,7 @@ #include "msvcparser.h" #include "projectexplorerconstants.h" +#include <utils/qtcassert.h> #ifdef Q_OS_WIN #include <utils/winutils.h> #endif @@ -74,8 +75,10 @@ MsvcParser::MsvcParser() + QLatin1String("(Command line |fatal )?(warning|error) (") + QLatin1String(ERROR_PATTERN) + QLatin1String(".*)$")); m_compileRegExp.setMinimal(true); + QTC_CHECK(m_compileRegExp.isValid()); m_additionalInfoRegExp.setPattern(QString::fromLatin1("^ (.*)\\((\\d+)\\) : (.*)$")); m_additionalInfoRegExp.setMinimal(true); + QTC_CHECK(m_additionalInfoRegExp.isValid()); } void MsvcParser::stdOutput(const QString &line) |