[cfe-commits] Improving Clang Diagnostics [1.3]: StringRefize DiagnosticIDs API

Matthieu Monrocq matthieu.monrocq at gmail.com
Sun May 1 06:45:33 PDT 2011


Hello,

This patch StringRefize DiagnosticIDs API (and internals).

I had some troubles because of macro expansion: not easy to see that a
StringRef was built from a null pointer and track down the crash... but
could the issue via an assert in the StringRef class itself. I've submitted
the patch for this already, hopefully it'll get applied so that others have
an easier time figuring out what's going wrong when they introduce
StringRef.

Apart from this, there are two functions that could perhaps benefit from
deeper changes, in the clients of DiagnosticIDs:
- ProcessWarningOptions in lib/FrontEnd/Warnings.cpp, which deals with
processing the -W family of options. There is a lot of manipulation of
OptStart / OptEnd pointers that I think could be easily translated into
using StringRef
- PragmaDiagnosticHandler::HandlePragma in lib/Lex/Pragma.cpp, I believe
WarningName could be a StringRef, but I need to investigate what
Literal.GetString returns to be sure it's possible

I'll handle this as two follow-up patches, dependent on this one, unless you
think it's better to merge the changes into this patch.

Please review.
Matthieu.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110501/51ef5ee2/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clang_stringrefize_diags.diff
Type: application/octet-stream
Size: 17000 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110501/51ef5ee2/attachment.obj>


More information about the cfe-commits mailing list