Disabled test for redundant override final specifier

This commit is contained in:
thk123 2016-12-20 16:13:07 +00:00 committed by Michael Tautschnig
parent edcb06ad50
commit e6a50931e2
3 changed files with 19 additions and 31 deletions

View File

@ -0,0 +1,13 @@
/*******************************************************************\
Module: Lint Examples
Author: Thomas Kiley, thomas@diffblue.com
\*******************************************************************/
class test_classt:public base_classt
{
public:
virtual void fun() override final;
};

View File

@ -0,0 +1,6 @@
CORE
main.cpp
^EXIT=0$
^SIGNAL=0$
--

31
scripts/cpplint.py vendored
View File

@ -5812,36 +5812,6 @@ def CheckRedundantVirtual(filename, clean_lines, linenum, error):
# break
def CheckRedundantOverrideOrFinal(filename, clean_lines, linenum, error):
"""Check if line contains a redundant "override" or "final" virt-specifier.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The function to call with any errors found.
"""
# Look for closing parenthesis nearby. We need one to confirm where
# the declarator ends and where the virt-specifier starts to avoid
# false positives.
line = clean_lines.elided[linenum]
declarator_end = line.rfind(')')
if declarator_end >= 0:
fragment = line[declarator_end:]
else:
if linenum > 1 and clean_lines.elided[linenum - 1].rfind(')') >= 0:
fragment = line
else:
return
# Check that at most one of "override" or "final" is present, not both
if Search(r'\boverride\b', fragment) and Search(r'\bfinal\b', fragment):
error(filename, linenum, 'readability/inheritance', 4,
('"override" is redundant since function is '
'already declared as "final"'))
# Returns true if we are at a new block, and it is directly
# inside of a namespace.
@ -5955,7 +5925,6 @@ def ProcessLine(filename, file_extension, clean_lines, line,
CheckInvalidIncrement(filename, clean_lines, line, error)
CheckMakePairUsesDeduction(filename, clean_lines, line, error)
CheckRedundantVirtual(filename, clean_lines, line, error)
CheckRedundantOverrideOrFinal(filename, clean_lines, line, error)
CheckNamespaceOrUsing(filename, clean_lines, line, error)
for check_fn in extra_check_functions:
check_fn(filename, clean_lines, line, error)