Changeset 260659 in webkit


Ignore:
Timestamp:
Apr 24, 2020 11:42:53 AM (4 years ago)
Author:
ddkilzer@apple.com
Message:

check-webkit-style should recognize *Internal.h and *Private.h as primary headers
<https://webkit.org/b/210979>

Reviewed by Darin Adler.

  • Scripts/webkitpy/style/checkers/cpp.py:

(_classify_include): If a header has an "Internal.h" or a
"Private.h" suffix with the same base name as the source file,
consider it a primary header--the header that comes after
"config.h".

  • Scripts/webkitpy/style/checkers/cpp_unittest.py:

(OrderOfIncludesTest.test_classify_include): Add tests.

Location:
trunk/Tools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r260658 r260659  
     12020-04-24  David Kilzer  <ddkilzer@apple.com>
     2
     3        check-webkit-style should recognize *Internal.h and *Private.h as primary headers
     4        <https://webkit.org/b/210979>
     5
     6        Reviewed by Darin Adler.
     7
     8        * Scripts/webkitpy/style/checkers/cpp.py:
     9        (_classify_include): If a header has an "Internal.h" or a
     10        "Private.h" suffix with the same base name as the source file,
     11        consider it a primary header--the header that comes after
     12        "config.h".
     13        * Scripts/webkitpy/style/checkers/cpp_unittest.py:
     14        (OrderOfIncludesTest.test_classify_include): Add tests.
     15
    1162020-04-24  Alex Christensen  <achristensen@webkit.org>
    217
  • trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py

    r260485 r260659  
    32253225    if not include_state.visited_primary_section():
    32263226        if target_base.find(include_base) != -1:
     3227            return _PRIMARY_HEADER
     3228        if include_base in ['{}Internal'.format(target_base), '{}Private'.format(target_base)]:
    32273229            return _PRIMARY_HEADER
    32283230
  • trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py

    r260355 r260659  
    35583558                                         '#include "ResourceHandleWin.h"\n',
    35593559                                         '')
     3560        # Internal.h and Private.h headers are primary headers.
     3561        self.assertEqual(cpp_style._PRIMARY_HEADER,
     3562                         classify_include('WKWebProcessPlugInNodeHandle.mm',
     3563                                          'WKWebProcessPlugInNodeHandleInternal.h',
     3564                                          False, include_state))
     3565        self.assertEqual(cpp_style._PRIMARY_HEADER,
     3566                         classify_include('WKWebProcessPlugInNodeHandle.mm',
     3567                                          'WKWebProcessPlugInNodeHandlePrivate.h',
     3568                                          False, include_state))
    35603569
    35613570    def test_try_drop_common_suffixes(self):
Note: See TracChangeset for help on using the changeset viewer.