This is an archive of the discontinued LLVM Phabricator instance.

New -assume-filename=param to check_clang_tidy.py (like clang-format)
ClosedPublic

Authored by benhamilton on Oct 16 2017, 10:30 AM.

Details

Summary

Currently, check_clang_tidy.py includes logic to select default
clang flags based on the extension of the source filename passed
as the first argument.

Since the source filename might be a temporary or test file with an
arbitrary extension unrelated to the file type, this adds the ability
to override the logic the same way clang-format's -assume-filename=
parameter does.

I included a test with a nonstandard file extension. I confirmed
when I modified the warning message that the new test failed,
and that it passed again when I restored the warning message.

Ran tests with:

% cmake -G Ninja /path/to/llvm
% ninja check-clang-tools

Diff Detail

Repository
rL LLVM

Event Timeline

benhamilton created this revision.Oct 16 2017, 10:30 AM
hokein accepted this revision.Oct 17 2017, 1:21 AM
hokein added a reviewer: alexfh.

LGTM.

test/clang-tidy/check_clang_tidy.py
42 ↗(On Diff #119175)

It would be clearer to add some documentation for the flag (other flags should have documentation as well, but it is out of scope of this patch)

This revision is now accepted and ready to land.Oct 17 2017, 1:21 AM
This revision was automatically updated to reflect the committed changes.