Shameless bump: clang_stringrefize_diags_plus.diff replaces char const* by llvm::StringRef in the DiagnosticIDs interface, and updates the ProcessWarningOptions in lib/FrontEnd/Warnings.cpp and PragmaDiagnosticHandler::HandlePragma in lib/Lex/Pragma.cpp to take advantage of this.
Please review. 2011/5/1 Matthieu Monrocq <[email protected]> > Date: Sun, 1 May 2011 15:45:33 +0200 >> From: Matthieu Monrocq <[email protected]> >> Subject: [cfe-commits] Improving Clang Diagnostics [1.3]: StringRefize >> DiagnosticIDs API >> To: [email protected] >> Message-ID: <[email protected]> >> Content-Type: text/plain; charset="iso-8859-1" >> >> 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.cs.uiuc.edu/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: 16999 bytes >> Desc: not available >> Url : >> http://lists.cs.uiuc.edu/pipermail/cfe-commits/attachments/20110501/51ef5ee2/attachment.obj >> >> ------------------------------ >> > > I had some time on my hands so I went ahead and did the patches. > > The patch in lib/Lex/Pragma.cpp is relatively innocuous and to be frank > does not bring much to the table (syntaxically), it removes a construction > of std::string anyway so might be worth it. > > The patch in lib/Frontend/Warnings.cpp is much more important. It really > cleans up the code consequently, trading awkward pointer differences and > manual call to memcmp for llvm::StringRef smart interface (especially for > prefix comparisons). > > Both patches are based on the patch mentionned above. > > I also provide a "all-in-one" patch (clang_stringrefize_diags_plus.diff), > which bundles the StringRefication of DiagnosticIDs API with those two > patches, for simpler application. > > Please review. > Matthieu. >
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
