Don't warn about RefPtr* parameters
authoroliver@apple.com <oliver@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 6 Nov 2012 23:52:34 +0000 (23:52 +0000)
committeroliver@apple.com <oliver@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 6 Nov 2012 23:52:34 +0000 (23:52 +0000)
https://bugs.webkit.org/show_bug.cgi?id=101403

Reviewed by Gavin Barraclough.

RefPtr<>* is a valid parameter type.

* Scripts/webkitpy/style/checkers/cpp.py:
(check_function_definition_and_pass_ptr):
* Scripts/webkitpy/style/checkers/cpp_unittest.py:
(PassPtrTest.test_ref_ptr_parameter_value):

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

Tools/ChangeLog
Tools/Scripts/webkitpy/style/checkers/cpp.py
Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py

index 91b2f9e..cfb4544 100644 (file)
@@ -1,3 +1,17 @@
+2012-11-06  Oliver Hunt  <oliver@apple.com>
+
+        Don't warn about RefPtr* parameters
+        https://bugs.webkit.org/show_bug.cgi?id=101403
+
+        Reviewed by Gavin Barraclough.
+
+        RefPtr<>* is a valid parameter type.
+
+        * Scripts/webkitpy/style/checkers/cpp.py:
+        (check_function_definition_and_pass_ptr):
+        * Scripts/webkitpy/style/checkers/cpp_unittest.py:
+        (PassPtrTest.test_ref_ptr_parameter_value):
+
 2012-11-06  Raphael Kubo da Costa  <raphael.kubo.da.costa@intel.com>
 
         [WTR] Reset EventSender before running each test.
index ebbd1ad..a1447e2 100644 (file)
@@ -1594,7 +1594,7 @@ def check_function_definition_and_pass_ptr(type_text, row, location_description,
     """
     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 or type_text.endswith('&'):
+    if not bad_type_usage or type_text.endswith('&') or type_text.endswith('*'):
         return
     type_name = bad_type_usage.group(0)
     error(row, 'readability/pass_ptr', 5,
index 6f001e0..5522201 100644 (file)
@@ -3421,6 +3421,11 @@ class PassPtrTest(CppStyleTestBase):
             '{\n'
             '}',
             '')
+        self.assert_pass_ptr_check(
+            'int myFunction(RefPtr<Type1>*)\n'
+            '{\n'
+            '}',
+            '')
 
     def test_own_ptr_parameter_value(self):
         self.assert_pass_ptr_check(