forked from qt-creator/qt-creator
Clang: Simplify regex patterns
...by removing pointless backslashes. '/' is not meta character, therefore escaping it with a backslash is not needed. Change-Id: Ic0bd1f85b3eed721cad67f4b4d616352ea9e098a Reviewed-by: Cristian Adam <cristian.adam@qt.io> Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
@@ -123,14 +123,14 @@ QString clangIncludeDirectory(const QString &clangVersion, const QString &clangR
|
||||
HeaderPaths::iterator resourceIterator(HeaderPaths &headerPaths, bool isMacOs)
|
||||
{
|
||||
// include/c++, include/g++, libc++\include and libc++abi\include
|
||||
static const QString cppIncludes = R"((.*\/include\/.*(g\+\+|c\+\+).*))"
|
||||
R"(|(.*libc\+\+\/include))"
|
||||
R"(|(.*libc\+\+abi\/include))";
|
||||
static const QString cppIncludes = R"((.*/include/.*(g\+\+|c\+\+).*))"
|
||||
R"(|(.*libc\+\+/include))"
|
||||
R"(|(.*libc\+\+abi/include))";
|
||||
static const QRegularExpression includeRegExp("\\A(" + cppIncludes + ")\\z");
|
||||
|
||||
// The same as includeRegExp but also matches /usr/local/include
|
||||
static const QRegularExpression includeRegExpMac("\\A(" + cppIncludes
|
||||
+ R"(|(\/usr\/local\/include))" + ")\\z");
|
||||
+ R"(|(/usr/local/include))" + ")\\z");
|
||||
|
||||
const QRegularExpression &includePathRegEx = isMacOs ? includeRegExpMac : includeRegExp;
|
||||
|
||||
@@ -148,7 +148,7 @@ bool isClangSystemHeaderPath(const HeaderPath &headerPath)
|
||||
// For example GCC on macOS uses system clang include path which makes clang code model
|
||||
// include incorrect system headers.
|
||||
static const QRegularExpression clangIncludeDir(
|
||||
R"(\A.*\/lib\d*\/clang\/\d+\.\d+(\.\d+)?\/include\z)");
|
||||
R"(\A.*/lib\d*/clang/\d+\.\d+(\.\d+)?/include\z)");
|
||||
return clangIncludeDir.match(headerPath.path).hasMatch();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user