Using "auto <function()> -> returnType" breaks prepare-ChangeLog
authorjfbastien@apple.com <jfbastien@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 28 Jul 2017 18:54:33 +0000 (18:54 +0000)
committerjfbastien@apple.com <jfbastien@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 28 Jul 2017 18:54:33 +0000 (18:54 +0000)
https://bugs.webkit.org/show_bug.cgi?id=174930

Reviewed by Daniel Bates.

Teach prepare-ChangeLog about C++ auto arrow return, and while I'm
here also teach it about const and volatile overloads. I didn't do
reference and rvalue reference overloads because we don't really
use them, and the current parser throws away those characters and
it doesn't seem worth making it more complex.

* Scripts/prepare-ChangeLog:
(get_function_line_ranges_for_cpp):
* Scripts/webkitperl/prepare-ChangeLog_unittest/resources/cpp_unittests-expected.txt:
* Scripts/webkitperl/prepare-ChangeLog_unittest/resources/cpp_unittests.cpp:
(Foo::Arrow::arrow):
(Foo::Arrow::otherArrow):
(Foo::Arrow::otherArrow const):
(Foo::Arrow::otherArrow volatile):
(Foo::Arrow::otherArrow const volatile):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@220010 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/Scripts/prepare-ChangeLog
Tools/Scripts/webkitperl/prepare-ChangeLog_unittest/resources/cpp_unittests-expected.txt
Tools/Scripts/webkitperl/prepare-ChangeLog_unittest/resources/cpp_unittests.cpp

index f564cb9..9d1baf0 100644 (file)
@@ -1,3 +1,26 @@
+2017-07-28  JF Bastien  <jfbastien@apple.com>
+
+        Using "auto <function()> -> returnType" breaks prepare-ChangeLog
+        https://bugs.webkit.org/show_bug.cgi?id=174930
+
+        Reviewed by Daniel Bates.
+
+        Teach prepare-ChangeLog about C++ auto arrow return, and while I'm
+        here also teach it about const and volatile overloads. I didn't do
+        reference and rvalue reference overloads because we don't really
+        use them, and the current parser throws away those characters and
+        it doesn't seem worth making it more complex.
+
+        * Scripts/prepare-ChangeLog:
+        (get_function_line_ranges_for_cpp):
+        * Scripts/webkitperl/prepare-ChangeLog_unittest/resources/cpp_unittests-expected.txt:
+        * Scripts/webkitperl/prepare-ChangeLog_unittest/resources/cpp_unittests.cpp:
+        (Foo::Arrow::arrow):
+        (Foo::Arrow::otherArrow):
+        (Foo::Arrow::otherArrow const):
+        (Foo::Arrow::otherArrow volatile):
+        (Foo::Arrow::otherArrow const volatile):
+
 2017-07-28  Adrian Perez de Castro  <aperez@igalia.com>
 
         [GTK] Building with ENABLE_VIDEO=OFF fails
index 0f44f20..888e9b7 100755 (executable)
@@ -1007,9 +1007,25 @@ sub get_function_line_ranges_for_cpp($$)
                 next;
             }
 
+            if ($1 eq "const") {
+                $potential_name .= " const";
+                next;
+            }
+
+            if ($1 eq "volatile") {
+                $potential_name .= " volatile";
+                next;
+            }
+
+            # C++ auto function() -> type
+            if ($1 eq ">") {
+                $skip_til_brace_or_semicolon = 1 unless ($in_parentheses || $in_braces);
+                next;
+            }
+
             # C++ constructor initializers
             if ($1 eq ":") {
-                  $skip_til_brace_or_semicolon = 1 unless ($in_parentheses || $in_braces);
+                $skip_til_brace_or_semicolon = 1 unless ($in_parentheses || $in_braces);
             }
 
             # Open brace.
index 8f11f7a..f275576 100644 (file)
       '391',
       '393',
       'Class110<TemplateClass>::func36'
+    ],
+    [
+      '399',
+      '402',
+      'Foo::Arrow::arrow'
+    ],
+    [
+      '409',
+      '412',
+      'Foo::Arrow::otherArrow'
+    ],
+    [
+      '414',
+      '417',
+      'Foo::Arrow::otherArrow const'
+    ],
+    [
+      '419',
+      '422',
+      'Foo::Arrow::otherArrow volatile'
+    ],
+    [
+      '424',
+      '427',
+      'Foo::Arrow::otherArrow const volatile'
     ]
   ]
 }
index 936f80b..1d8d912 100644 (file)
@@ -391,3 +391,38 @@ class Class109 {
 void Class110<TemplateClass>::func36()
 {
 }
+
+namespace Foo {
+    class Arrow {
+    public:
+        typedef int MyType;
+        auto arrow(MyType a, MyType b) -> MyType
+        {
+            return 42;
+        }
+        MyType otherArrow(MyType a);
+        MyType otherArrow(MyType a) const;
+        MyType otherArrow(MyType a) volatile;
+        MyType otherArrow(MyType a) const volatile;
+    };
+
+    auto Arrow::otherArrow(MyType a) -> MyType
+    {
+        return 0xc0defefe;
+    }
+
+    auto Arrow::otherArrow(MyType a) const -> MyType
+    {
+        return 0xc0defefe;
+    }
+
+    auto Arrow::otherArrow(MyType a) volatile -> MyType
+    {
+        return 0xc0defefe;
+    }
+
+    auto Arrow::otherArrow(MyType a) const volatile -> MyType
+    {
+        return 0xc0defefe;
+    }
+}