This is an archive of the discontinued LLVM Phabricator instance.

[Clang-tidy] Make modernize-redundant-void-arg working with included files
AbandonedPublic

Authored by Eugene.Zelenko on Feb 1 2016, 1:25 PM.

Details

Summary

This fix for PR25894. I checked it on my work code base.

Build and regressions were OK on RHEL 6.

Diff Detail

Repository
rL LLVM

Event Timeline

Eugene.Zelenko retitled this revision from to [Clang-tidy] Make modernize-redundant-void-arg working with included files.
Eugene.Zelenko updated this object.
Eugene.Zelenko set the repository for this revision to rL LLVM.
Eugene.Zelenko added a subscriber: cfe-commits.
aaron.ballman edited edge metadata.Feb 2 2016, 4:40 AM

Missing testcases for this; I suspect that isExpansionInMainFile was being used to filter out results in macro expansions, so some tests to ensure the behavior is correct there would also be appreciated.

I didn't notice test cases for included files for other checkers. So it's hard to tell for should special test case introduced for this specific problem or not.

I didn't notice test cases for included files for other checkers. So it's hard to tell for should special test case introduced for this specific problem or not.

Generally speaking, all changes should have a test case accompanying them unless the change is NFC. It helps ensure we don't regress behavior the we want with the fix.

I think proper solution will be to create tests for included files ot the fly, bu renaming main test to .h and creating dummy source file. But this is task for scripts wizards :-)

I think proper solution will be to create tests for included files ot the fly, bu renaming main test to .h and creating dummy source file. But this is task for scripts wizards :-)

I'm not certain if that's the proper solution or not, but I'm also not comfortable with committing nontrivial changes without an accompanying test case. either. I would recommend writing a simple test include that would fail before applying your patch (and succeeds after) and go that route, unless you want to try your hand at the scripting approach.

I think proper solution will be to create tests for included files ot the fly, bu renaming main test to .h and creating dummy source file. But this is task for scripts wizards :-)

I'm not certain if that's the proper solution or not, but I'm also not comfortable with committing nontrivial changes without an accompanying test case. either. I would recommend writing a simple test include that would fail before applying your patch (and succeeds after) and go that route, unless you want to try your hand at the scripting approach.

My point is that all checks should be test in similar situations. It's not reasonable to introduce special checks only for selected ones.

I think proper solution will be to create tests for included files ot the fly, bu renaming main test to .h and creating dummy source file. But this is task for scripts wizards :-)

I'm not certain if that's the proper solution or not, but I'm also not comfortable with committing nontrivial changes without an accompanying test case. either. I would recommend writing a simple test include that would fail before applying your patch (and succeeds after) and go that route, unless you want to try your hand at the scripting approach.

My point is that all checks should be test in similar situations. It's not reasonable to introduce special checks only for selected ones.

Agreed; however, not all checks have the same behavior regarding macro expansion and header files. Some checks have special behaviors regarding macros, others may require the check to not be run outside of the main file, etc. I'm not certain how well such a test harness can be generalized for this, but if you have ideas in mind, they would be great to explore!

I am already working on fixing this bug (isn't PR25894 already assigned to me?), but what's missing from this patch is an automated test that proves it works.

In order to write such an automated test, I believe some enhancements are needed to the check_clang_tidy.py script before such a test can be written.

Eugene.Zelenko abandoned this revision.Feb 7 2016, 12:50 PM

Obsoleted by D16953.