Returns rprog_, computing it if needed.
| 245 | |
| 246 | // Returns rprog_, computing it if needed. |
| 247 | re2::Prog* RE2::ReverseProg() const { |
| 248 | std::call_once(rprog_once_, [](const RE2* re) { |
| 249 | re->rprog_ = |
| 250 | re->suffix_regexp_->CompileToReverseProg(re->options_.max_mem() / 3); |
| 251 | if (re->rprog_ == NULL) { |
| 252 | if (re->options_.log_errors()) |
| 253 | LOG(ERROR) << "Error reverse compiling '" << trunc(re->pattern_) << "'"; |
| 254 | // We no longer touch error_ and error_code_ because failing to compile |
| 255 | // the reverse Prog is not a showstopper: falling back to NFA execution |
| 256 | // is fine. More importantly, an RE2 object is supposed to be logically |
| 257 | // immutable: whatever ok() would have returned after Init() completed, |
| 258 | // it should continue to return that no matter what ReverseProg() does. |
| 259 | } |
| 260 | }, this); |
| 261 | return rprog_; |
| 262 | } |
| 263 | |
| 264 | RE2::~RE2() { |
| 265 | if (suffix_regexp_) |
nothing calls this directly
no test coverage detected