Commit 5fe91794 authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

[presubmit] Exclude deleted class members

The V8_NOEXCEPT annotation is not needed for deleted class members.
Also our DISALLOW_COPY_AND_ASSIGN macro does not add it there.

Additionally, include the file name to find the reported location more
easy.

R=jkummerow@chromium.org

Bug: v8:8616
No-Try: true
Change-Id: I93162804493542fed2a5832649b80386e338bd47
Reviewed-on: https://chromium-review.googlesource.com/c/1386870
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58406}
parent 3411e7c3
......@@ -465,8 +465,9 @@ def _CheckNoexceptAnnotations(input_api, output_api):
# matches an argument list that contains only a reference to a class named
# like the first capture group, potentially const.
single_class_ref_arg = r'\((?:const\s+)?\1(?:::\1)?&&?[^,;)]*\)'
# matches anything but a sequence of whitespaces followed by V8_NOEXCEPT.
not_followed_by_noexcept = r'(?!\s+V8_NOEXCEPT\b)'
# matches anything but a sequence of whitespaces followed by either
# V8_NOEXCEPT or "= delete".
not_followed_by_noexcept = r'(?!\s+(?:V8_NOEXCEPT|=\s+delete)\b)'
full_pattern = r'^.*?' + class_name + potential_assignment + \
single_class_ref_arg + not_followed_by_noexcept + '.*?$'
regexp = input_api.re.compile(full_pattern, re.MULTILINE)
......@@ -475,7 +476,8 @@ def _CheckNoexceptAnnotations(input_api, output_api):
for f in input_api.AffectedFiles(include_deletes=False):
with open(f.LocalPath()) as fh:
for match in re.finditer(regexp, fh.read()):
errors.append(match.group().strip())
errors.append('in {}: {}'.format(f.LocalPath(),
match.group().strip()))
if errors:
return [output_api.PresubmitPromptOrNotify(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment