[cfe-dev] Patch: "Did you mean" warning correction handles negative options poorly

Chris Jefferson chris at bubblescope.net
Thu Nov 8 04:33:08 PST 2012


The "did you mean" for warnings first removes the '-Wno-', if present, 
and then only matches against positive options. This leads to some 
annoying problems, like:

$ clang++ -Wnoarc
clang: warning: unknown warning option '-Wnoarc'; did you mean '-Warc'?

When what I really want is a suggestion to use '-Wno-arc'

Attached is a patch that takes a stab at dealing with this. It does in 
principle make the existing code slower, my turning a bunch of 
StringRefs into std::strings, but I don't imagine spell-checking warning 
options is on the critical path!

I tried adding a test, which is purposefully broken (note the ' 
PURPOSEFUL BREAK ' comment in it), but which doesn't seem to be getting 
run (and failing). I looked around and could not figure out why it is 
not getting invoked, any comments welcome.

Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20121108/8cb393a4/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: warning-no.patch
Type: text/x-patch
Size: 4774 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20121108/8cb393a4/attachment.bin>


More information about the cfe-dev mailing list