Commit Graph

58 Commits

Author SHA1 Message Date
David Ungar
c5b82b8b94 Cleanup 2018-05-09 19:41:49 -07:00
David Ungar
1e66ee6e28 Another null-pointer fix. 2018-05-09 19:32:34 -07:00
David Ungar
4f003b41de Check for null pointer in finishProcessing. 2018-05-09 18:51:46 -07:00
David Ungar
02fcbf7226 optional pointer to consumer replaces NullDiagnosticConsumer placeholder 2018-05-09 18:09:40 -07:00
Graydon Hoare
689663d2e2 [BatchMode] Fix interaction of bridging PCH and file specific diag consumer.
In batch mode, when using serialized diagnostics, we have a
FileSpecificDiagnosticConsumer splitting diags out to separate .dia files (one
per primary). This constructs a mapping from filenames to consumers when it's
first given a diag. So far so good.

It assumes, however, that there are source buffers to be found for each input
file it knows the name of. This is true -- and useful to assert -- once the
source buffers are set up. It's also a prerequisite for building the map it
uses to direct diags.

Unfortunately there's a small window between the consumer being built and the
source manager getting buffers, and in this window we attach to a bridging PCH.
If that attaching generates a diag of itself (say due to a bogus module map or
such) then the diag consumer is asked to build its map without source buffers.
The thing to do here is just to fall back to the "no mapping found" case; the
only tricky part is identifying when we're in that window of time. I've chosen
to use the approximating condition of "none of the file buffers exist at all".
2018-03-23 20:22:53 -07:00
Jordan Rose
57087c4af3 RangeSpecificDiagnosticConsumer -> FileSpecificDiagnosticConsumer
It turns out that we need to have the diagnostic consumers set up
before we've actually opened the input files, which makes sense
because we might want to emit diagnostics about not being able to open
an input file. Switch to using file names instead, and mapping those
over to source ranges only once we actually need to handle a
diagnostic with a valid source location.
2018-03-02 13:23:16 -08:00
Jordan Rose
51fa9332d8 Add a RangeSpecificDiagnosticConsumer
If a top-level diagnostic is in a particular source range, the
RangeSpecificDiagnosticConsumer will funnel it and any attached notes
to a particular "sub-consumer" designated for that range (intended to
be used with whole files). If it's not in a range designated for any
sub-consumer, the diagnostic is passed to all registered
sub-consumers.

This is intended to be used for batch mode, so that diagnostics that
are definitely associated with a particular file can be emitted in
that file's .dia output, while diagnostics that may be associated with
other files (such as those that come from Clang) will still get
presented to the user.
2018-03-02 13:23:15 -08:00
Maxwell Swadling
93d485e4f7 Changed handleDiagnostic to take a format string and format args instead of the formatted string
This allows diagnostic consumers to modify the way formatting of diagnostics is performed.
rdar://problem/31305854
2017-04-14 11:28:04 -07:00