This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy] allow tests to use --config-file instead of --config
ClosedPublic

Authored by amurzeau on Feb 14 2023, 11:53 AM.

Details

Summary

The previous way to test hungarian notation doesn't check CHECK-FIXES.

This will allow readability-identifier-naming tests of Hungarian
notation to keep the use of an external .clang-tidy file (not embedded
within the .cpp test file) and properly check CHECK-FIXES.

Also, it turns out the hungarian notation tests use the wrong
.clang-tidy file, so fix that too to make these tests ok.

This is a part of a fix for issue https://github.com/llvm/llvm-project/issues/60670.

Diff Detail

Event Timeline

amurzeau created this revision.Feb 14 2023, 11:53 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 14 2023, 11:53 AM
Herald added a subscriber: xazax.hun. · View Herald Transcript
amurzeau requested review of this revision.Feb 14 2023, 11:53 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 14 2023, 11:53 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
amurzeau edited the summary of this revision. (Show Details)Feb 14 2023, 11:55 AM
PiotrZSL added inline comments.
clang-tools-extra/test/clang-tidy/check_clang_tidy.py
109–110

clang-tidy works with -config and with --config.
But in documentation there is --config.

This python script should be updated to accept both single and double dash arguments for config.

clang-tools-extra/test/clang-tidy/checkers/readability/identifier-naming-hungarian-notation-cfgfile.cpp
1

maybe double -- for config-file ?

--config-file=<string>         -
                                 Specify the path of .clang-tidy or custom config file:
                                  e.g. --config-file=/some/path/myTidyConfigFile
                                 This option internally works exactly the same way as
                                  --config option after reading specified config file.
Eugene.Zelenko added inline comments.
clang-tools-extra/test/clang-tidy/check_clang_tidy.py
109–110

Please follow 80 characters limit.

carlosgalvezp requested changes to this revision.Feb 15 2023, 7:30 AM

LGTM except the comments left by other reviewers! Marking it as "Request Changes" for visibility.

This revision now requires changes to proceed.Feb 15 2023, 7:30 AM
amurzeau updated this revision to Diff 497773.Feb 15 2023, 12:54 PM
amurzeau retitled this revision from [clang-tidy] allow tests to use -config-file instead of -config to [clang-tidy] allow tests to use --config-file instead of --config.

Allow use of --config and --config-file (with double dashes)

amurzeau marked 3 inline comments as done.Feb 15 2023, 12:56 PM
carlosgalvezp accepted this revision.Feb 15 2023, 11:14 PM

LGTM, thanks for the fix!

This revision is now accepted and ready to land.Feb 15 2023, 11:14 PM

I do not have commit access to the repo, can someone commit this patch for me ?