[PATCH] D15528: Teach clang-tidy how to -Werror checks.

Alexander Kornienko via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 15 11:33:30 PST 2015


alexfh added a comment.

In http://reviews.llvm.org/D15528#311053, @jroelofs wrote:

> In http://reviews.llvm.org/D15528#311019, @alexfh wrote:
>
> > Jonathan, can you explain what specific use case does this patch address? Why one severity level of native clang-tidy warnings (the current situation) is not enough, and two levels are enough?
>
>
> I have out-of-tree checkers for a very strange out-of-tree target. Some of the checks are on the level of "this should break the build because it cannot possibly work on this target" and others on the level of "tell me about it, but don't force me to fix it". All of these checks are things that don't even remotely apply to other targets.


Thank you for the explanation. One more question: do you need to define Werrors differently in different directories?

> If you're wondering why I haven't hacked up Clang's sema to enforce these constraints, see again: out-of-tree backend... maintaining OOT changes there is expected to be very difficult.


No, a sane person wouldn't suggest maintaining a local patch for Clang as a good solution ;)

> Clang-tidy however provides a very nice framework where they can be kept neatly off to the side, away from most of the merge hassles.


It's one of the goals of clang-tidy to provide an easy way to maintain out-of-tree checks.

> It'd be nice not to have to run clang-tidy twice & parse its output in order to achieve all of that, hence this patch.


Agreed, I want to ensure though, that this is the right approach. In particular, I wonder whether a way to assign labels or severities to clang-tidy diagnostics would be better. Another question is whether we can reuse something from the Clang diagnostic subsystem to map warning levels.


http://reviews.llvm.org/D15528





More information about the cfe-commits mailing list