Title: [100499] trunk/Tools
Revision
100499
Author
le...@chromium.org
Date
2011-11-16 13:51:15 -0800 (Wed, 16 Nov 2011)

Log Message

check-webkit-style should recognize functions even if they have OVERRIDE after them.
https://bugs.webkit.org/show_bug.cgi?id=72515

Reviewed by Adam Barth.

* Scripts/webkitpy/style/checkers/cpp.py:
* Scripts/webkitpy/style/checkers/cpp_unittest.py:

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (100498 => 100499)


--- trunk/Tools/ChangeLog	2011-11-16 21:22:15 UTC (rev 100498)
+++ trunk/Tools/ChangeLog	2011-11-16 21:51:15 UTC (rev 100499)
@@ -1,3 +1,13 @@
+2011-11-16  David Levin  <le...@chromium.org>
+
+        check-webkit-style should recognize functions even if they have OVERRIDE after them.
+        https://bugs.webkit.org/show_bug.cgi?id=72515
+
+        Reviewed by Adam Barth.
+
+        * Scripts/webkitpy/style/checkers/cpp.py:
+        * Scripts/webkitpy/style/checkers/cpp_unittest.py:
+
 2011-11-16  Tony Chang  <t...@chromium.org>
 
         [NRWT] refactor drivers to require pixel_tests param

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


--- trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py	2011-11-16 21:22:15 UTC (rev 100498)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py	2011-11-16 21:51:15 UTC (rev 100499)
@@ -2143,12 +2143,12 @@
         # ')', or ') const' and doesn't begin with 'if|for|while|switch|else'.
         # We also allow '#' for #endif and '=' for array initialization.
         previous_line = get_previous_non_blank_line(clean_lines, line_number)[0]
-        if ((not search(r'[;:}{)=]\s*$|\)\s*const\s*$', previous_line)
+        if ((not search(r'[;:}{)=]\s*$|\)\s*((const|OVERRIDE)\s*)*\s*$', previous_line)
              or search(r'\b(if|for|foreach|while|switch|else)\b', previous_line))
             and previous_line.find('#') < 0):
             error(line_number, 'whitespace/braces', 4,
                   'This { should be at the end of the previous line')
-    elif (search(r'\)\s*(const\s*)?{\s*$', line)
+    elif (search(r'\)\s*(((const|OVERRIDE)\s*)*\s*)?{\s*$', line)
           and line.count('(') == line.count(')')
           and not search(r'\b(if|for|foreach|while|switch)\b', line)
           and not match(r'\s+[A-Z_][A-Z_0-9]+\b', line)):

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


--- trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py	2011-11-16 21:22:15 UTC (rev 100498)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py	2011-11-16 21:51:15 UTC (rev 100499)
@@ -1530,11 +1530,22 @@
             'int foo() const {',
             'Place brace on its own line for function definitions.  [whitespace/braces] [4]')
         self.assert_multi_line_lint(
+            'int foo() const OVERRIDE {',
+            'Place brace on its own line for function definitions.  [whitespace/braces] [4]')
+        self.assert_multi_line_lint(
+            'int foo() OVERRIDE {',
+            'Place brace on its own line for function definitions.  [whitespace/braces] [4]')
+        self.assert_multi_line_lint(
             'int foo() const\n'
             '{\n'
             '}\n',
             '')
         self.assert_multi_line_lint(
+            'int foo() OVERRIDE\n'
+            '{\n'
+            '}\n',
+            '')
+        self.assert_multi_line_lint(
             'if (condition\n'
             '    && condition2\n'
             '    && condition3) {\n'
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to