[cfe-users] Trouble suppressing caret diagnostics with clang-3.6 clang-tidy
Andrew C. Morrow
andrew.c.morrow at gmail.com
Fri Mar 6 14:36:25 PST 2015
I have a project with a working compilation database, on which I would like
to use clang-tidy. I can run clang-tidy, and it points out issues, makes
fix suggestions, can apply them, etc. So that is all working very nicely.
However, for my particular use case, I also want to parse the clang-tidy
output, and it would be helpful to suppress the caret diagnostics as it
makes parsing rather harder. I had thought that using the clang-tidy
-extra-arg option with -fno-caret-diagnostics would work, but it appears to
have no effect:
This is the base output, which has the normal caret diagnostics:
> /usr/local/Cellar/llvm36/3.6.0/bin/clang-tidy-3.6 src/example.cpp
3 warnings generated.
example.cpp:9:19: warning: 'example::Emitter' has virtual functions but
non-virtual destructor [clang-diagnostic-non-virtual-dtor]
struct Emitter {
^
example.cpp:21:12: warning: 'example::Base' has virtual functions but
non-virtual destructor [clang-diagnostic-non-virtual-dtor]
~Base();
^
example.cpp:26:15: warning: 'example::Derived' has virtual functions but
non-virtual destructor [clang-diagnostic-non-virtual-dtor]
class Derived : public Base {
But re-running with -extra-arg=-fno-caret-diagnostics generates the same
output:
> /usr/local/Cellar/llvm36/3.6.0/bin/clang-tidy-3.6
-extra-arg=-fno-caret-diagnostics example.cpp
example.cpp:9:19: warning: 'example::Emitter' has virtual functions but
non-virtual destructor [clang-diagnostic-non-virtual-dtor]
struct Emitter {
^
example.cpp:21:12: warning: 'example::Base' has virtual functions but
non-virtual destructor [clang-diagnostic-non-virtual-dtor]
~Base();
^
example.cpp:26:15: warning: 'example::Derived' has virtual functions but
non-virtual destructor [clang-diagnostic-non-virtual-dtor]
class Derived : public Base {
^
It looks like clang-tidy is actually interpreting the -fno-caret-diagnostic
option, somehow, because if I pass an invalid option, it complains:
> /usr/local/Cellar/llvm36/3.6.0/bin/clang-tidy-3.6
-extra-arg=-fno-caret-diagnosticsXXX example.cpp
3 warnings and 1 error generated.
Error while processing example.cpp.
error: unknown argument: '-fno-caret-diagnosticsXXX'
[clang-diagnostic-error]
I'm using the homebrew llvm36 package on OSX Yosemite. How can I get
clang-tidy to not emit the carets? I'm also interested in doing this
for -fno-diagnostics-show-option.
Thanks,
Andrew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-users/attachments/20150306/a3df123f/attachment.html>
More information about the cfe-users
mailing list