Rename to Regexp::RequiredPrefixForAccel().

Change-Id: I72084774560d1989d5eac937f4a5039802713d69
Reviewed-on: https://code-review.googlesource.com/c/re2/+/56772
Reviewed-by: Paul Wankadia <junyer@google.com>
(cherry picked from commit 25238e4a33af97b16156f56b4fe7bd7a4e46b182)
Reviewed-on: https://code-review.googlesource.com/c/re2/+/56773
diff --git a/re2/compile.cc b/re2/compile.cc
index 6c48b6c..78edfac 100644
--- a/re2/compile.cc
+++ b/re2/compile.cc
@@ -1191,7 +1191,7 @@
   if (!prog_->reversed()) {
     std::string prefix;
     bool prefix_foldcase;
-    if (re->RequiredPrefixUnanchored(&prefix, &prefix_foldcase) &&
+    if (re->RequiredPrefixForAccel(&prefix, &prefix_foldcase) &&
         !prefix_foldcase) {
       prog_->prefix_size_ = prefix.size();
       prog_->prefix_front_ = prefix.front();
diff --git a/re2/regexp.cc b/re2/regexp.cc
index 1f4bf8d..008e088 100644
--- a/re2/regexp.cc
+++ b/re2/regexp.cc
@@ -715,7 +715,7 @@
 // Determines whether regexp matches must be unanchored
 // with a fixed string prefix.  If so, returns the prefix.
 // The prefix might be ASCII case-insensitive.
-bool Regexp::RequiredPrefixUnanchored(std::string* prefix, bool* foldcase) {
+bool Regexp::RequiredPrefixForAccel(std::string* prefix, bool* foldcase) {
   prefix->clear();
   *foldcase = false;
 
diff --git a/re2/regexp.h b/re2/regexp.h
index 8c8deb3..1af84a9 100644
--- a/re2/regexp.h
+++ b/re2/regexp.h
@@ -444,7 +444,7 @@
   // case-folding).  If so, returns the prefix.
   // Callers should expect *prefix and *foldcase to be "zeroed"
   // regardless of the return value.
-  bool RequiredPrefixUnanchored(std::string* prefix, bool* foldcase);
+  bool RequiredPrefixForAccel(std::string* prefix, bool* foldcase);
 
  private:
   // Constructor allocates vectors as appropriate for operator.
diff --git a/re2/testing/required_prefix_test.cc b/re2/testing/required_prefix_test.cc
index 83d2537..c0c22a1 100644
--- a/re2/testing/required_prefix_test.cc
+++ b/re2/testing/required_prefix_test.cc
@@ -74,7 +74,7 @@
   }
 }
 
-static PrefixTest unanchored_tests[] = {
+static PrefixTest for_accel_tests[] = {
   // Empty cases.
   { "", false },
   { "(?m)^", false },
@@ -98,9 +98,9 @@
   { "☺abc", true, "☺abc", false, },
 };
 
-TEST(RequiredPrefixUnanchored, SimpleTests) {
-  for (size_t i = 0; i < ABSL_ARRAYSIZE(unanchored_tests); i++) {
-    const PrefixTest& t = unanchored_tests[i];
+TEST(RequiredPrefixForAccel, SimpleTests) {
+  for (size_t i = 0; i < ABSL_ARRAYSIZE(for_accel_tests); i++) {
+    const PrefixTest& t = for_accel_tests[i];
     for (size_t j = 0; j < 2; j++) {
       Regexp::ParseFlags flags = Regexp::LikePerl;
       if (j == 0)
@@ -110,7 +110,7 @@
 
       std::string p;
       bool f;
-      ASSERT_EQ(t.return_value, re->RequiredPrefixUnanchored(&p, &f))
+      ASSERT_EQ(t.return_value, re->RequiredPrefixForAccel(&p, &f))
         << " " << t.regexp << " " << (j == 0 ? "latin1" : "utf8")
         << " " << re->Dump();
       if (t.return_value) {