Fix various lint false positives.
* C++11: Expressions related to type_traits templates. Cherry-pick of
internal cl/477737746.
* C++20: requires-expressions. Cherry pick of internal cl/450768176.
* C++20: `co_return *p;`. Unique to Chromium (cpplint_chromium.py).
Bug: 1284275
Change-Id: I06ede7b708dfe71308f669a2d6c37d00ded6c086
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4226465
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Peter Kasting <pkasting@chromium.org>
diff --git a/cpplint_chromium.py b/cpplint_chromium.py
index 4fcd99b..9318a86 100755
--- a/cpplint_chromium.py
+++ b/cpplint_chromium.py
@@ -31,7 +31,9 @@
# Matches Foo *foo declarations.
_RE_PATTERN_POINTER_DECLARATION_WHITESPACE = re.compile(
- r'\s*\w+(?<!\breturn|\bdelete)\s+(?P<pointer_operator>\*|\&)\w+')
+ r'\s*\w+((?<!\breturn|\bdelete)(?<!\bco_return))\s+'
+ r'(?P<pointer_operator>\*|\&)\w+')
+
def CheckPointerDeclarationWhitespace(filename, clean_lines, linenum, error):
"""Checks for Foo *foo declarations.