Author: hans Date: Thu Sep 6 01:54:44 2018 New Revision: 341529 URL: http://llvm.org/viewvc/llvm-project?rev=341529&view=rev Log: Merging r340609: ------------------------------------------------------------------------ r340609 | ldionne | 2018-08-24 16:10:28 +0200 (Fri, 24 Aug 2018) | 13 lines
[libc++] Fix handling of negated character classes in regex Summary: This commit fixes a regression introduced in r316095, where we don't match inverted character classes when there's no negated characrers in the []'s. rdar://problem/43060054 Reviewers: mclow.lists, timshen, EricWF Subscribers: christof, dexonsmith, cfe-commits Differential Revision: https://reviews.llvm.org/D50534 ------------------------------------------------------------------------ Added: libcxx/branches/release_70/test/std/re/re.alg/re.alg.match/inverted_character_classes.pass.cpp - copied unchanged from r340609, libcxx/trunk/test/std/re/re.alg/re.alg.match/inverted_character_classes.pass.cpp Modified: libcxx/branches/release_70/ (props changed) libcxx/branches/release_70/include/regex libcxx/branches/release_70/test/std/re/re.alg/re.alg.search/invert_neg_word_search.pass.cpp Propchange: libcxx/branches/release_70/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Thu Sep 6 01:54:44 2018 @@ -1,2 +1,2 @@ /libcxx/branches/apple:136569-137939 -/libcxx/trunk:339431,339675,339697,339702,339741-339743,339794,339804,339816,339874,340406,340544,340823 +/libcxx/trunk:339431,339675,339697,339702,339741-339743,339794,339804,339816,339874,340406,340544,340609,340823 Modified: libcxx/branches/release_70/include/regex URL: http://llvm.org/viewvc/llvm-project/libcxx/branches/release_70/include/regex?rev=341529&r1=341528&r2=341529&view=diff ============================================================================== --- libcxx/branches/release_70/include/regex (original) +++ libcxx/branches/release_70/include/regex Thu Sep 6 01:54:44 2018 @@ -2414,20 +2414,17 @@ __bracket_expression<_CharT, _Traits>::_ goto __exit; } } - // set of "__found" chars = + // When there's at least one of __neg_chars_ and __neg_mask_, the set + // of "__found" chars is // union(complement(union(__neg_chars_, __neg_mask_)), // other cases...) // - // __neg_chars_ and __neg_mask_'d better be handled together, as there - // are no short circuit opportunities. - // - // In addition, when __neg_mask_/__neg_chars_ is empty, they should be - // treated as all ones/all chars. + // It doesn't make sense to check this when there are no __neg_chars_ + // and no __neg_mask_. + if (!(__neg_mask_ == 0 && __neg_chars_.empty())) { - const bool __in_neg_mask = (__neg_mask_ == 0) || - __traits_.isctype(__ch, __neg_mask_); + const bool __in_neg_mask = __traits_.isctype(__ch, __neg_mask_); const bool __in_neg_chars = - __neg_chars_.empty() || std::find(__neg_chars_.begin(), __neg_chars_.end(), __ch) != __neg_chars_.end(); if (!(__in_neg_mask || __in_neg_chars)) Modified: libcxx/branches/release_70/test/std/re/re.alg/re.alg.search/invert_neg_word_search.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/branches/release_70/test/std/re/re.alg/re.alg.search/invert_neg_word_search.pass.cpp?rev=341529&r1=341528&r2=341529&view=diff ============================================================================== --- libcxx/branches/release_70/test/std/re/re.alg/re.alg.search/invert_neg_word_search.pass.cpp (original) +++ libcxx/branches/release_70/test/std/re/re.alg/re.alg.search/invert_neg_word_search.pass.cpp Thu Sep 6 01:54:44 2018 @@ -18,7 +18,7 @@ #include <regex> #include <cassert> -#include "test_macros.h" + // PR34310 int main() _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits