This it the perfect example of why not to use a StringRef since the string needs to be null terminated. Why did we change this? Now even if you call this function:
RegularExpression r(...); r.Execute(".......................", ...) You will need to duplicate the string on the heap just to execute this. Please revert this. Anything that requires null terminate is not a candidate for converting to StringRef. > On Sep 21, 2016, at 10:13 AM, Zachary Turner via lldb-commits > <lldb-commits@lists.llvm.org> wrote: > > Author: zturner > Date: Wed Sep 21 12:13:51 2016 > New Revision: 282090 > > URL: http://llvm.org/viewvc/llvm-project?rev=282090&view=rev > Log: > Fix failing regex tests. > > r282079 converted the regular expression interface to accept > and return StringRefs instead of char pointers. In one case > a null pointer check was converted to an empty string check, > but this was an incorrect conversion because an empty string > is a valid regular expression. Removing this check should > fix the test failures. > > Modified: > lldb/trunk/source/Core/RegularExpression.cpp > > Modified: lldb/trunk/source/Core/RegularExpression.cpp > URL: > http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/RegularExpression.cpp?rev=282090&r1=282089&r2=282090&view=diff > ============================================================================== > --- lldb/trunk/source/Core/RegularExpression.cpp (original) > +++ lldb/trunk/source/Core/RegularExpression.cpp Wed Sep 21 12:13:51 2016 > @@ -102,7 +102,7 @@ bool RegularExpression::Compile(llvm::St > //--------------------------------------------------------------------- > bool RegularExpression::Execute(llvm::StringRef str, Match *match) const { > int err = 1; > - if (!str.empty() && m_comp_err == 0) { > + if (m_comp_err == 0) { > // Argument to regexec must be null-terminated. > std::string reg_str = str; > if (match) { > > > _______________________________________________ > lldb-commits mailing list > lldb-commits@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits