Title: [94803] trunk/Tools
Revision
94803
Author
le...@chromium.org
Date
2011-09-08 14:50:48 -0700 (Thu, 08 Sep 2011)

Log Message

check-webkit-style: Ref|Own Ptr& should be allowed as a parameter.
https://bugs.webkit.org/show_bug.cgi?id=67797

Reviewed by Eric Seidel.

* Scripts/webkitpy/style/checkers/cpp.py: Allow Ref/Own Ptr when it ends with &.
* Scripts/webkitpy/style/checkers/cpp_unittest.py: Added test cases for this.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (94802 => 94803)


--- trunk/Tools/ChangeLog	2011-09-08 21:38:04 UTC (rev 94802)
+++ trunk/Tools/ChangeLog	2011-09-08 21:50:48 UTC (rev 94803)
@@ -1,3 +1,13 @@
+2011-09-08  David Levin  <le...@chromium.org>
+
+        check-webkit-style: Ref|Own Ptr& should be allowed as a parameter.
+        https://bugs.webkit.org/show_bug.cgi?id=67797
+
+        Reviewed by Eric Seidel.
+
+        * Scripts/webkitpy/style/checkers/cpp.py: Allow Ref/Own Ptr when it ends with &.
+        * Scripts/webkitpy/style/checkers/cpp_unittest.py: Added test cases for this.
+
 2011-09-08  Fady Samuel  <fsam...@chromium.org>
 
         Fixed Layout Mode should be adjustable from layoutTestController for testing on Chromium platforms

Modified: trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py (94802 => 94803)


--- trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py	2011-09-08 21:38:04 UTC (rev 94802)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py	2011-09-08 21:50:48 UTC (rev 94803)
@@ -1577,7 +1577,7 @@
     """
     match_ref_or_own_ptr = '(?=\W|^)(Ref|Own)Ptr(?=\W)'
     bad_type_usage = search(match_ref_or_own_ptr, type_text)
-    if not bad_type_usage:
+    if not bad_type_usage or type_text.endswith('&'):
         return
     type_name = bad_type_usage.group(0)
     error(row, 'readability/pass_ptr', 5,

Modified: trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py (94802 => 94803)


--- trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py	2011-09-08 21:38:04 UTC (rev 94802)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py	2011-09-08 21:50:48 UTC (rev 94803)
@@ -3275,6 +3275,11 @@
             '{\n'
             '}',
             'The parameter type should use PassRefPtr instead of RefPtr.  [readability/pass_ptr] [5]')
+        self.assert_pass_ptr_check(
+            'int myFunction(RefPtr<Type1>&)\n'
+            '{\n'
+            '}',
+            '')
 
     def test_own_ptr_parameter_value(self):
         self.assert_pass_ptr_check(
@@ -3287,6 +3292,11 @@
             '{\n'
             '}',
             'The parameter type should use PassOwnPtr instead of OwnPtr.  [readability/pass_ptr] [5]')
+        self.assert_pass_ptr_check(
+            'int myFunction(OwnPtr<Type1>& simple)\n'
+            '{\n'
+            '}',
+            '')
 
     def test_ref_ptr_member_variable(self):
         self.assert_pass_ptr_check(
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to