llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

std::regex_iterator

Open mgehre opened this issue 6 years ago • 3 comments

auto f_regex_iterator() {
    static const std::string s = "Quick brown fox.";
    static std::regex words_regex("[^\\s]+");
    return std::sregex_iterator(s.begin(), s.end(), words_regex); // TODO
}

in lifetime-integration-tests/lifetime-attr-test.cpp

mgehre avatar Aug 13 '19 20:08 mgehre

While the example itself is compelling I am not sure if this should be addressed now. My main concern is, often times we can have one piece of logic to address a large number of functions such as begin, data, c_str. I am not sure if it is worth to add one new rule for one single function. This will definitely be caught once all the methods are annotated and we use the annotations though :)

Xazax-hun avatar Aug 13 '19 23:08 Xazax-hun

sregex_iterator is not a function, it's an iterator type that we explicitly annotate as gsl::Pointer. I guess it does not work here, because it's constructor does not take a single argument (some Owner).

mgehre avatar Aug 13 '19 23:08 mgehre

Oh, I see! Yeah, this make sense.

Xazax-hun avatar Aug 13 '19 23:08 Xazax-hun