This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy] Fix bugprone-argument-comment bug if there are marcos.
ClosedPublic

Authored by xyb on Sep 2 2019, 8:14 AM.

Details

Summary

Fix bugprone-argument-comment bug if there are marcos.

For example:

#define X(x) (x)
void j(int a, int b, int c);
j(X(1), /*b=*/1, X(1));

clang-tidy can't recognize comment "/*b=*/". It suggests fix like this:

j(X(1), /*b=*//*b=*/1, X(1));

This change tries to fix this issue.

Diff Detail

Repository
rL LLVM

Event Timeline

xyb created this revision.Sep 2 2019, 8:14 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 2 2019, 8:14 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
xyb updated this revision to Diff 218372.Sep 2 2019, 8:16 AM
Eugene.Zelenko retitled this revision from Fix bugprone-argument-comment bug if there are marcos. to [clang-tidy] Fix bugprone-argument-comment bug if there are marcos..Sep 2 2019, 9:55 PM
Eugene.Zelenko set the repository for this revision to rCTE Clang Tools Extra.
Eugene.Zelenko added a project: Restricted Project.
alexfh accepted this revision.Sep 4 2019, 6:53 AM

LG. Thanks!

clang-tools-extra/clang-tidy/bugprone/ArgumentCommentCheck.cpp
326 ↗(On Diff #218372)

I don't know what motivation was to try parsing to the end of the arguments. But since no tests break, it should be fine to change.

This revision is now accepted and ready to land.Sep 4 2019, 6:53 AM
xyb added a comment.Sep 4 2019, 7:11 AM

Thanks. BTW, I can't commit the patch by myself.

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptSep 4 2019, 9:20 AM