diff options
author | Alexander Kornienko <alexfh@google.com> | 2017-02-01 15:28:25 +0000 |
---|---|---|
committer | Alexander Kornienko <alexfh@google.com> | 2017-02-01 15:28:25 +0000 |
commit | 165fe63b4e16fe066663fbafffff5b49b95fd5e4 (patch) | |
tree | 4d3456f01f67fb94e25ee83991bd15202d27143d /clang-tools-extra/clang-tidy/misc/ArgumentCommentCheck.cpp | |
parent | c9a89f6936883f1a30a9ccc3fd5f74a3a74f6e33 (diff) | |
download | bcm5719-llvm-165fe63b4e16fe066663fbafffff5b49b95fd5e4.tar.gz bcm5719-llvm-165fe63b4e16fe066663fbafffff5b49b95fd5e4.zip |
[clang-tidy] misc-argument-comment: ignore comments after arguments
llvm-svn: 293771
Diffstat (limited to 'clang-tools-extra/clang-tidy/misc/ArgumentCommentCheck.cpp')
-rw-r--r-- | clang-tools-extra/clang-tidy/misc/ArgumentCommentCheck.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/clang-tools-extra/clang-tidy/misc/ArgumentCommentCheck.cpp b/clang-tools-extra/clang-tidy/misc/ArgumentCommentCheck.cpp index f80b9850afe..4c4e4a9ad32 100644 --- a/clang-tools-extra/clang-tidy/misc/ArgumentCommentCheck.cpp +++ b/clang-tools-extra/clang-tidy/misc/ArgumentCommentCheck.cpp @@ -67,16 +67,19 @@ getCommentsInRange(ASTContext *Ctx, CharSourceRange Range) { Token Tok; if (TheLexer.LexFromRawLexer(Tok)) break; - if (Tok.getLocation() == Range.getEnd() || Tok.getKind() == tok::eof) + if (Tok.getLocation() == Range.getEnd() || Tok.is(tok::eof)) break; - if (Tok.getKind() == tok::comment) { + if (Tok.is(tok::comment)) { std::pair<FileID, unsigned> CommentLoc = SM.getDecomposedLoc(Tok.getLocation()); assert(CommentLoc.first == BeginLoc.first); Comments.emplace_back( Tok.getLocation(), StringRef(Buffer.begin() + CommentLoc.second, Tok.getLength())); + } else { + // Clear comments found before the different token, e.g. comma. + Comments.clear(); } } |