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

Jonathan Roelofs via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 15 10:05:30 PST 2015


jroelofs added a comment.

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.

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


================
Comment at: tools/llvm-project/extra/test/clang-tidy/werrors-plural.cpp:7
@@ +6,3 @@
+// CHECK-WARN: warning: namespace 'j' not terminated with a closing comment [llvm-namespace-comment]
+// CHECK-WERR: error: namespace 'j' not terminated with a closing comment [llvm-namespace-comment, -Werrors=]
+
----------------
aaron.ballman wrote:
> jroelofs wrote:
> > aaron.ballman wrote:
> > > One of these tests should complete the -Werrors= chunk just to be sure it's getting printed properly.
> > Not sure what you mean here. Should I be printing the -Werrors argument as the user wrote it? (it isn't currently... this is just a hardcoded string).
> Ah, I didn't pick up on that. What is the = for, then?
I considered that part of the name of the flag.

I can drop that if you think it looks better. Or print out the whole thing as the user wrote it, if you think that's useful (though -checks= and -Werrors= lines are probably pretty long...).



http://reviews.llvm.org/D15528





More information about the cfe-commits mailing list