diff options
| author | Mitchell Balan <mitchell@stellarscience.com> | 2019-11-20 15:36:45 -0500 |
|---|---|---|
| committer | Mitchell Balan <mitchell@stellarscience.com> | 2019-11-20 18:08:37 -0500 |
| commit | 24aafcadff3851ec3a0c42303fec63e815b19566 (patch) | |
| tree | 2761ee140707f24772e277bea72e765204e6cb99 /clang-tools-extra/clang-tidy/utils/LexerUtils.h | |
| parent | a329cf69696f1d1103c569b4c4d68d212b204710 (diff) | |
| download | bcm5719-llvm-24aafcadff3851ec3a0c42303fec63e815b19566.tar.gz bcm5719-llvm-24aafcadff3851ec3a0c42303fec63e815b19566.zip | |
[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
Diffstat (limited to 'clang-tools-extra/clang-tidy/utils/LexerUtils.h')
| -rw-r--r-- | clang-tools-extra/clang-tidy/utils/LexerUtils.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/clang-tools-extra/clang-tidy/utils/LexerUtils.h b/clang-tools-extra/clang-tidy/utils/LexerUtils.h index 8330266e634..2c4a2518259 100644 --- a/clang-tools-extra/clang-tidy/utils/LexerUtils.h +++ b/clang-tools-extra/clang-tidy/utils/LexerUtils.h @@ -80,6 +80,11 @@ SourceLocation findNextAnyTokenKind(SourceLocation Start, } } +// Finds next token that's not a comment. +Optional<Token> findNextTokenSkippingComments(SourceLocation Start, + const SourceManager &SM, + const LangOptions &LangOpts); + /// Re-lex the provide \p Range and return \c false if either a macro spans /// multiple tokens, a pre-processor directive or failure to retrieve the /// next token is found, otherwise \c true. |

