Changeset 216000 in webkit
- Timestamp:
- Apr 30, 2017, 4:39:51 PM (8 years ago)
- Location:
- trunk/Tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r215997 r216000 1 2017-04-30 Dan Bernstein <mitz@apple.com> 2 3 [Cocoa] Have check-webkit-style advise against use of [get…Class() alloc] 4 https://bugs.webkit.org/show_bug.cgi?id=171486 5 6 Reviewed by Sam Weinig. 7 8 * Scripts/webkitpy/style/checkers/cpp.py: 9 (check_soft_link_class_alloc): Added. Looks for [get…Class() alloc] and suggests 10 alloc…Instance() instead. 11 (check_style): Invoke new check. 12 1 13 2017-04-30 Brady Eidson <beidson@apple.com> 2 14 -
trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py
r207559 r216000 2730 2730 2731 2731 2732 def check_soft_link_class_alloc(clean_lines, line_number, error): 2733 """Checks that allocating an instance of a soft-linked class uses alloc[Class]Instance. 2734 2735 Args: 2736 clean_lines: A CleansedLines instance containing the file. 2737 line_number: The number of the line to check. 2738 error: The function to call with any errors found. 2739 """ 2740 2741 line = clean_lines.elided[line_number] 2742 2743 matched = search(r'\[get([^\s]+)Class\(\)\s+alloc\]', line) 2744 if matched: 2745 error(line_number, 'runtime/soft-linked-alloc', 4, 2746 'Using +alloc with a soft-linked class. Use alloc%sInstance() instead.' % matched.group(1)) 2747 2748 2732 2749 def get_line_width(line): 2733 2750 """Determines the width of the line in column positions. … … 2823 2840 check_for_comparisons_to_zero(clean_lines, line_number, error) 2824 2841 check_for_null(clean_lines, line_number, file_state, error) 2842 check_soft_link_class_alloc(clean_lines, line_number, error) 2825 2843 check_indentation_amount(clean_lines, line_number, error) 2826 2844 check_enum_casing(clean_lines, line_number, enum_state, error)
Note:
See TracChangeset
for help on using the changeset viewer.