]> granicus.if.org Git - clang/commit
Switch the emission of diagnostics without a source location to
authorChandler Carruth <chandlerc@gmail.com>
Mon, 26 Sep 2011 11:25:30 +0000 (11:25 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Mon, 26 Sep 2011 11:25:30 +0000 (11:25 +0000)
commit0ef898865aaec8c99addee23d01e03c7abdbd2b3
tree3dde95709428ffbb6c08aaaff80fa0d1b3c6d49e
parent75c1befb4592387ef1bec3bff5f0f5c0c931ea84
Switch the emission of diagnostics without a source location to
a dedicated path. The logic for such diagnostics is much simpler than
for others.

This begins to make an important separation in this routine. We expect
most (and most interesting) textual diagnostics to be made in the
presence of at least *some* source locations and a source manager.
However the DiagnosticConsumer must be prepared to diagnose errors even
when the source manager doesn't (yet) exist or when there is no location
information at all. In order to sink more and more logic into the
TextDiagnostic class while minimizing its complexity, my plan is to
force the DiagnosticConsumer to special case diagnosing any locationless
messages and then hand the rest to the TextDiagnostic class. I'd
appreciate any comments on this design. It requires a bit of code
duplication in order to keep interfaces simple. Alternatively, if we
really need TextDiagnostic to be capable of handling diagnostics even in
the absence of a viable SourceManager, then this split isn't necessary.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140525 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Frontend/TextDiagnosticPrinter.cpp