]> granicus.if.org Git - clang/commit
Rationalize some of how the locations of prior diagnostics are tracked
authorChandler Carruth <chandlerc@gmail.com>
Sat, 15 Oct 2011 11:44:27 +0000 (11:44 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Sat, 15 Oct 2011 11:44:27 +0000 (11:44 +0000)
commitf54a61454e548fff63d6ce5700ecc2958297207e
tree9f4ed5bbf890a942ddd4fcf3570e4d80872df1e5
parent9ed3066cfe4545acec30aff63581d1a7b5c88128
Rationalize some of how the locations of prior diagnostics are tracked
across emissions.

1) The include stack printing is conditioned on non-note diagnostics,
   not just on warning diagnostics.
2) Those should be full source locations as they're tied to a source
   manager.
3) We should pass in the prior state to the TextDiagnostic constructor,
   allow it to mutate as diagnostics are emitted, and then cache the
   final state before tearing it down.

Some of this remains incomplete, specifically #3 isn't finished for the
non-note location. That'll come when the include stack printing sinks
down a level.

This also highlights how *completely* bug-ridden this code is. For
example, we currently do all these comparisons of a FullSourceLoc and
a SourceLocation... which silently does a SourceLocation to
SourceLocation comparison, completely disregarding the source manager
from whence one of the arguments came. Oops! Good thing in practice this
wasn't important, but it could in theory be suppressing caret
diagnostics in a second TU on a single clang invocation. I'm hoping to
hammer these bugs out as the refactorings occur, although for so many of
them it's really unlikely I can dream up a test case that would show the
potentially buggy behavior.

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