Index: include/lldb/Utility/FileSpec.h =================================================================== --- include/lldb/Utility/FileSpec.h +++ include/lldb/Utility/FileSpec.h @@ -18,6 +18,7 @@ // Other libraries and framework includes // Project includes #include "lldb/Utility/ConstString.h" +#include "lldb/Utility/RegularExpression.h" #include "llvm/ADT/StringRef.h" // for StringRef #include "llvm/Support/FileSystem.h" @@ -583,6 +584,7 @@ mutable bool m_is_resolved = false; ///< True if this path has been resolved. PathSyntax m_syntax; ///< The syntax that this path uses (e.g. Windows / Posix) + RegularExpression m_regex; ///< Regular expression in "regex:" prefix passed. }; //---------------------------------------------------------------------- Index: source/Utility/FileSpec.cpp =================================================================== --- source/Utility/FileSpec.cpp +++ source/Utility/FileSpec.cpp @@ -185,7 +185,8 @@ //------------------------------------------------------------------ FileSpec::FileSpec(const FileSpec &rhs) : m_directory(rhs.m_directory), m_filename(rhs.m_filename), - m_is_resolved(rhs.m_is_resolved), m_syntax(rhs.m_syntax) {} + m_is_resolved(rhs.m_is_resolved), m_syntax(rhs.m_syntax), + m_regex(rhs.m_regex) {} //------------------------------------------------------------------ // Copy constructor @@ -209,6 +210,7 @@ m_filename = rhs.m_filename; m_is_resolved = rhs.m_is_resolved; m_syntax = rhs.m_syntax; + m_regex = rhs.m_regex; } return *this; } @@ -232,6 +234,12 @@ if (pathname.empty()) return; + if(pathname.startswith("regex:")) { + m_filename.SetString(pathname); + m_regex.Compile(pathname.substr(6)); + return; + } + llvm::SmallString<64> resolved(pathname); if (resolve) { @@ -301,6 +309,9 @@ // Equal to operator //------------------------------------------------------------------ bool FileSpec::operator==(const FileSpec &rhs) const { + if (m_regex.IsValid()) + return m_regex.Execute(rhs.GetPath()); + if (!FileEquals(rhs)) return false; if (DirectoryEquals(rhs)) @@ -411,6 +422,9 @@ bool FileSpec::Equal(const FileSpec &a, const FileSpec &b, bool full, bool remove_backups) { + if (a.m_regex.IsValid()) + return a.m_regex.Execute(b.GetPath()); + static ConstString g_dot_string("."); static ConstString g_dot_dot_string("..");