[clang-tidy] modernize-use-equals-default avoid adding redundant semicolons
authorMitchell Balan <mitchell@stellarscience.com>
Wed, 20 Nov 2019 20:36:45 +0000 (15:36 -0500)
committerMitchell Balan <mitchell@stellarscience.com>
Wed, 20 Nov 2019 23:08:37 +0000 (18:08 -0500)
commit24aafcadff3851ec3a0c42303fec63e815b19566
tree2761ee140707f24772e277bea72e765204e6cb99
parenta329cf69696f1d1103c569b4c4d68d212b204710
[clang-tidy] modernize-use-equals-default avoid adding redundant semicolons

Summary:
`modernize-use-equals-default` replaces default constructors/destructors with `= default;`. When the optional semicolon after a member function is present, this results in two consecutive semicolons.

This patch checks to see if the next non-comment token after the code to be replaced is a semicolon, and if so offers a replacement of `= default` rather than `= default;`.

This patch adds trailing comments and semicolons to about 5 existing tests.

Reviewers: malcolm.parsons, angelgarcia, aaron.ballman, alexfh

Patch by: poelmanc

Subscribers: MyDeveloperDay, JonasToth, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D70144
clang-tools-extra/clang-tidy/modernize/UseEqualsDefaultCheck.cpp
clang-tools-extra/clang-tidy/utils/LexerUtils.cpp
clang-tools-extra/clang-tidy/utils/LexerUtils.h
clang-tools-extra/docs/ReleaseNotes.rst
clang-tools-extra/test/clang-tidy/checkers/modernize-use-equals-default-copy.cpp
clang-tools-extra/test/clang-tidy/checkers/modernize-use-equals-default.cpp