This is an archive of the discontinued LLVM Phabricator instance.

Add a test for clang-tidy using the clang cl driver
ClosedPublic

Authored by zturner on Aug 12 2016, 5:58 PM.

Details

Summary

In order to get this to work, the positional arguments must use --driver-mode=cl <args>, and NOT clang-cl <args>. In the latter case, clang-tidy has to try really hard to "guess" whether the first argument is argv[0] or argv[1]. This still tests effectively the same thing, but without the convoluted magic of having to care about the name of the tool being run.

This is the test for D23455

Diff Detail

Repository
rL LLVM

Event Timeline

zturner updated this revision to Diff 67948.Aug 12 2016, 5:58 PM
zturner retitled this revision from to Add a test for clang-tidy using the clang cl driver.
zturner updated this object.
zturner added a reviewer: alexfh.
zturner added a subscriber: cfe-commits.
alexfh accepted this revision.Aug 13 2016, 10:24 AM
alexfh edited edge metadata.

LG with two nits.

In order to get this to work, the positional arguments must use --driver-mode=cl <args>, and NOT clang-cl <args>

It's not that important for the fixed compilation database, as long as there is a way to specify the driver mode. However, we need to make sure clang-tidy is able to figure out correct driver mode from JSON compilation databases generated on Windows for clang-cl builds. It should be a separate test though.

test/clang-tidy/clang-cl-driver.cpp
1 ↗(On Diff #67948)

I wonder whether the /Dname#value format should work in clang-cl mode as well (it's supported by cl.exe, if I understand https://msdn.microsoft.com/en-us/library/hhzbb5c8.aspx correctly).

18 ↗(On Diff #67948)

Please fix the "No newline at end of file".

This revision is now accepted and ready to land.Aug 13 2016, 10:24 AM
This revision was automatically updated to reflect the committed changes.