This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy] fix for NOLINT after macro expansion
ClosedPublic

Authored by mgehre on Sep 22 2016, 2:36 PM.

Details

Summary

When having

#define MACRO code-with-warning
MACRO; // NOLINT

clang-tidy would still show the warning, because
it searched for "NOLINT" only in the first line,
not on the second.
This caused e.g. https://llvm.org/bugs/show_bug.cgi?id=29089
(where the macro was defined in a system header). See also
the added test cases.
Now clang-tidy looks at the line of macro invocation and every line
of macro definition for a NOLINT comment.

Diff Detail

Event Timeline

mgehre updated this revision to Diff 72214.Sep 22 2016, 2:36 PM
mgehre retitled this revision from to [clang-tidy] fix for NOLINT after macro expansion.
mgehre updated this object.
mgehre added reviewers: alexfh, aaron.ballman, hokein.
mgehre added a subscriber: cfe-commits.
mgehre updated this object.Sep 22 2016, 2:37 PM
alexfh accepted this revision.Sep 23 2016, 7:13 PM
alexfh edited edge metadata.

Awesome, thanks!

clang-tidy/ClangTidyDiagnosticConsumer.cpp
303

Just return false;?

This revision is now accepted and ready to land.Sep 23 2016, 7:13 PM
This revision was automatically updated to reflect the committed changes.