summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy/misc/ArgumentCommentCheck.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang-tools-extra/clang-tidy/misc/ArgumentCommentCheck.cpp')
-rw-r--r--clang-tools-extra/clang-tidy/misc/ArgumentCommentCheck.cpp7
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();
}
}
OpenPOWER on IntegriCloud