This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy] Add "clang-tidy as a clang plugin" skeleton.
ClosedPublic

Authored by bkramer on Mar 2 2016, 6:47 AM.

Details

Summary

This doesn't really do much at the moment. You can load it via libclang
and set the -checks via an extra command line argument as illustrated in
the test case. Support for other options (including headers check) is
currently missing. Also when using this with libclang some checks may
not work with the precompiled preamble in place.

This can be used to easily show clang-tidy warnings in an editor
integration as all that's needed is adding command line flags that are
passed into libclang. Warnings and FixIts are exposed via the existing
CXDiagnostic machinery.

Diff Detail

Repository
rL LLVM

Event Timeline

bkramer updated this revision to Diff 49615.Mar 2 2016, 6:47 AM
bkramer retitled this revision from to [clang-tidy] Add "clang-tidy as a clang plugin" skeleton..
bkramer updated this object.
bkramer added a reviewer: klimek.
bkramer added a subscriber: cfe-commits.
klimek accepted this revision.Mar 2 2016, 6:57 AM
klimek edited edge metadata.

LG. For now I don't see a better path forward.

This revision is now accepted and ready to land.Mar 2 2016, 6:57 AM

Would this also be usable as a way to run clang-tidy checks as part of
normal compilation? (some things in clang-tidy aren't there because the FP
is too high to be a hard error on old codebases (but might be viable once a
codebase is able to be cleaned up (like several have been with LLVM)) or
because they're project specific (either stylistically, or because they're
about some project specific API))

This revision was automatically updated to reflect the committed changes.