Skip to content

Commit

Permalink
Merge pull request diffblue#2253 from peterschrammel/documentation/ov…
Browse files Browse the repository at this point in the history
…erride2

 Get legalistic about use of override without virtual
  • Loading branch information
peterschrammel authored May 30, 2018
2 parents 40ecff8 + 050b344 commit 779fa71
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion CODING_STANDARD.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ Formatting is enforced using clang-format. For more information about this, see
- Make references `const` whenever possible
- Make member functions `const` whenever possible
- Do not hide base class functions
- You are encouraged to use `override`
- When overriding a virtual function, use `override` (without `virtual`)
- Single argument constructors must be `explicit`
- Avoid implicit conversions
- Avoid `friend` declarations
Expand Down
30 changes: 15 additions & 15 deletions scripts/cpplint.py
Original file line number Diff line number Diff line change
Expand Up @@ -6148,21 +6148,21 @@ def CheckRedundantVirtual(filename, clean_lines, linenum, error):
if end_col < 0:
return # Couldn't find end of parameter list, give up

# # Look for "override" or "final" after the parameter list
# # (possibly on the next few lines).
# for i in xrange(end_line, min(end_line + 3, clean_lines.NumLines())):
# line = clean_lines.elided[i][end_col:]
# match = Search(r'\b(override|final)\b', line)
# if match:
# error(filename, linenum, 'readability/inheritance', 4,
# ('"virtual" is redundant since function is '
# 'already declared as "%s"' % match.group(1)))
#
# # Set end_col to check whole lines after we are done with the
# # first line.
# end_col = 0
# if Search(r'[^\w]\s*$', line):
# break
# Look for "override" or "final" after the parameter list
# (possibly on the next few lines).
for i in xrange(end_line, min(end_line + 3, clean_lines.NumLines())):
line = clean_lines.elided[i][end_col:]
match = Search(r'\b(override|final)\b', line)
if match:
error(filename, linenum, 'readability/inheritance', 4,
('"virtual" is redundant since function is '
'already declared as "%s"' % match.group(1)))

# Set end_col to check whole lines after we are done with the
# first line.
end_col = 0
if Search(r'[^\w]\s*$', line):
break



Expand Down

0 comments on commit 779fa71

Please sign in to comment.