Merge 15bebb3a53502dbf58fcf785c5c72806d3ed6efb into 8487c083e1faecb1259be8a8873618cfdb69d33d

This commit is contained in:
Lucas Mirelmann 2024-03-19 10:46:43 -03:00 committed by GitHub
commit 98773ed9ac
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 1 deletions

3
cpplint/cpplint.py vendored
View File

@ -4664,7 +4664,8 @@ def _GetTextInside(text, start_pattern):
# >
_RE_PATTERN_IDENT = r'[_a-zA-Z]\w*' # =~ [[:alpha:]][[:alnum:]]*
_RE_PATTERN_TYPE = (
r'(?:const\s+)?(?:typename\s+|class\s+|struct\s+|union\s+|enum\s+)?'
r'(?:const\s+)?(?:typename\s+|class\s+|struct\s+|union\s+|enum\s+'
r'|signed\s+|unsigned\s+)?'
r'(?:\w|'
r'\s*<(?:<(?:<[^<>]*>|[^<>])*>|[^<>])*>|'
r'::)+')

View File

@ -2217,6 +2217,9 @@ class CpplintTest(CpplintTestBase):
self.TestLint('istringstream& LogFunc(istringstream& s);', '')
# Returning a non-const reference from a function is OK.
self.TestLint('int& g();', '')
# Passing signed or unsigned const references is OK.
self.TestLint('void foo(const unsigned int& bar);', '');
self.TestLint('void foo(const signed int& bar);', '');
# Passing a const reference to a struct (using the struct keyword) is OK.
self.TestLint('void foo(const struct tm& tm);', '')
# Passing a const reference to a typename is OK.