[cfe-dev] Proposed minor refactoring of the diag subsystem
Nico Weber
nicolasweber at gmx.de
Sat Aug 9 09:44:47 PDT 2008
> If isInPrivateHeader() is not meaningful for all DiagClients, it
> should be removed from DiagClient. Perhaps Diag should have two
> methods, ReportWithFile(), that takes a HeaderSearch, and Report().
> Then Lex, Parser, and Sema could call this method, and other clients
> could call the ordinary Report() function.
The attached patch does the following changes:
* Remove isInSystemHeader() from DiagClient
* Instead, give Diagnostic a few more Report() overloads that take a
HeaderSearch as parameter, so that clients calling Report() decide if
a HeaderSearch should be used (and, in turn, warning from system
headers should be ignored)
* To make this possible, move HeaderSearch, HeaderMap and
DirectoryLookup to Basic
* Change Lex, Parse, and Sema so that they pass a HeaderSearch object
to Report()
* Move FormatError() from TextDiagnostic up to DiagClient, remove now
empty class TextDiagnostic
This fixes the following problems:
* -html-diags (and probably others) does now output the same set of
warnings as console clang does
* nothing crashes if one forgets to call setHeaderSearch() on
TextDiagnostic
* some code duplication is removed
Another approach would be to make HeaderSearch a (possibly NULL)
member of Diagnostic instead of passing it to Report(), but then all
clients of Diagnostic have to remember to set this. Now, only the
clients of Report() have to do this. As Report() is mostly clang-
internal, but Diagnostic is used by clients linking clang's libraries,
this makes more sense to me.
Nico
-------------- next part --------------
A non-text attachment was scrubbed...
Name: diag_refactor_v2_2.patch
Type: application/octet-stream
Size: 82332 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20080809/0c6a0150/attachment.obj>
-------------- next part --------------
More information about the cfe-dev
mailing list