History log of /external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
21a869aace45586125238fde88c477b330618a0b 16-Oct-2011 Chandler Carruth <chandlerc@gmail.com> Persist the TextDiagnostic object across multiple diagnostics as long as
the SourceManager doesn't change, and the source files don't change.
This greatly simplifies the interfaces and interactions. The lifetime of
the TextDiagnostic object forms the 'session' over which we attempt to
condense and deduplicate information in diagnostics.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142104 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
7531f571808201d44002fa38b67ee0a81e5ae936 16-Oct-2011 Chandler Carruth <chandlerc@gmail.com> Clean up the names of all the TextDiagnostic methods (and even a static
function) to agree with the coding conventions, and in one case have
a bit more information in it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142088 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
db463bb2e4a9751f4cbe53996db751e1985ee966 16-Oct-2011 Chandler Carruth <chandlerc@gmail.com> Graduate the TextDiagnostic interface to its own header and source file,
making it accessible to anyone from the Frontend library. Still a good
bit of cleanup to do here, but its a good milestone. This ensures that
*all* of the functionality needed to implement the DiagnosticConsumer is
exposed via the generic interface in some form. No sneaky re-use of
static functions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142086 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
1f3839e2574292ced2e629f758d8d697aa50719a 16-Oct-2011 Chandler Carruth <chandlerc@gmail.com> Move the message printing to a class-static function so that it can be
part of the TextDiagnostic interface without requiring a full instance.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142085 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
7eb84dc2504c8b2d1bb9e1247fd445cb16297360 16-Oct-2011 Chandler Carruth <chandlerc@gmail.com> Move the diagnostic level printing into a class static helper. This will
allow the TextDiagnosticPrinter to continue using it even if
TextDiagnostic is implemented in a separate file.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142084 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
03efd2efeeafc97db9a956df8c6ab88fbb6160da 16-Oct-2011 Chandler Carruth <chandlerc@gmail.com> Rationalize the last bit of "arbitrary" state that is carried between
diagnostics to control suppression of redundant information. It now
follows the same model as all the other state, and has a bit more clear
semantics.

This is making the duality of the state a bit annoying, and I've added
a FIXME to resolve it. The problem is that I need to lift the
TextDiagnostic up into an externally visible layer before that can
happen.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142083 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
d614040a678c994b0171234e7f5f9cf61e9f86fe 15-Oct-2011 Chandler Carruth <chandlerc@gmail.com> Neither 'Warning' nor 'NonNote' was a good name for this location...
It's the last include-stack-root we tried to walk up. Use a better name
and better doxyments for it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142071 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
67e2d51a86b14a61e3c0e9c41224c7a8f020b4a6 15-Oct-2011 Chandler Carruth <chandlerc@gmail.com> Nuke a bunch of FIXMEs that are now fixed. =] Also, remove the now-dead
TextDiagnosticPrinter argument to the TextDiagnostic helper class. This
cements the proper ordering of things: TextDiagnostic is now a viable
stand-alone class for emitting pretty-printed textual diagnostics to
a terminal.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142070 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
cae9ab1a8af46643f8cf89399c9ccfb28fba0c36 15-Oct-2011 Chandler Carruth <chandlerc@gmail.com> Sink the include stack printing into the generic text diagnostic
utility. This is a particularly nice win because it removes a pile of
parameters from these routines. Also name them a bit better. I'm trying
to follow the pattern of 'emit' routines writing directly to what is
expected to be the final output, while 'print' routines take a output
stream argument and can be used to build up intermediate buffers, etc.

Also, fix a bug I spotted by inspection from my last commit where
'LastLoc' and 'LastNonNoteLoc' were reversed. It's really scary that
this didn't trigger a single test failure. Will be working on tests for
more of this functionality now.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142069 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
f54a61454e548fff63d6ce5700ecc2958297207e 15-Oct-2011 Chandler Carruth <chandlerc@gmail.com> 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
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
9ed3066cfe4545acec30aff63581d1a7b5c88128 15-Oct-2011 Chandler Carruth <chandlerc@gmail.com> Sink the EmitDiagnosticLoc method down to the generic TextDiagnostic
interface now that its only caller is there.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142065 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
60e4a2a5e9bf534e106b0c2553d06e06c3d07794 15-Oct-2011 Chandler Carruth <chandlerc@gmail.com> Sink the non-caret diagnostic logic down and out of the diagnostic
consumer. The TextDiagnostic interface now has a generic entry point for
emitting a diagnostic which uses a minimal interface that should be
compatible with StoredDiagnostics such as are available in libclang etc.

Some unfortunate shuffling of static functions as things get relocated.
Also some unfortunate public interface points added to
TextDiagnosticPrinter, but those are the next bits to get moved so they
won't last long.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142064 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
55c611021e771a816e6e3679928439f667f12eb9 15-Oct-2011 Chandler Carruth <chandlerc@gmail.com> Simplify the interface of a helper method in the TextDiagnosticPrinter
to operate directly on the source location and ranges associated with
a diagnostic rather than digging them out of the diagnostic. This had
a side benefit of cleaning up its code a tiny bit by using the ArrayRef
interface.

No functionality changed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142063 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
d79e4628da88b58e9913008ff32f2e1ca785a4e7 15-Oct-2011 Chandler Carruth <chandlerc@gmail.com> Change 'Emit' to 'EmitCaret' which sums up what it *should* be doing.
Also note that it is actually doing much more than it should. This paves
the way for building a more generic 'Emit' routine that is the real
entry point here.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142035 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
76101cfe52d1b56974bf0e316247b3201f87c463 29-Sep-2011 Daniel Dunbar <daniel@zuster.org> Basic/Diagnostics: Add an isDefaultMappingAsError method, and switch TextDiagnosticPrinter to use that instead of extracting the current mapping via getDiagnosticLevel, which fixes one class of corner cases w.r.t. printing the "-Werror" diagnostic option marker.
- The TextDiagnosticPrinter code is still fragile as it is just "reverse engineering" what the diagnostic engine is doing. Not my current priority to fix though.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140752 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
aee526e77657afd1600276450e9c346953ad51d7 29-Sep-2011 Douglas Gregor <dgregor@apple.com> Introduce a pure virtual clone() method to DiagnosticConsumer, so that
we have the ability to create a new, distict diagnostic consumer when
we go off and build a module. This avoids the currently horribleness
where the same diagnostic consumer sees diagnostics for multiple
translation units (and multiple SourceManagers!) causing all sorts of havok.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140743 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
64b0cee15206d55913240dca676ed3f340c60926 26-Sep-2011 Chandler Carruth <chandlerc@gmail.com> Add back support for a manually formatted section of the diagnostic
message. Specifically, we now only line-wrap the first line of te
diagnostic message and assume the remainder is manually formatted. While
adding it back, simplify the logic for doing this.

Finally, add a test that ensures we actually preserve this feature. =D
*Now* its not dead code. Thanks to Doug for the test case.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140538 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
e6d1dff47d17154e99a98c499ee399df70a4bcf1 26-Sep-2011 Chandler Carruth <chandlerc@gmail.com> Hoist and beef up the asserts about the level of infrastructure expected
when working with a diagnostic attached to a source location. Also
comment more thoroughly why its important to handle non-location
diagnostic messages separately.

Finally, hoist the creation of the TextDiagnostic object up to the
beginning of the location-based diagnostics. This paves the way for
sinking more and more of the logic into this class. When everything
below this constructor is sunk into the TextDiagnostic class it should
be sufficiently "feature complete" to accomplish my two goals:
1) Have the printing of a macro expansion note use the exact same code
as any other note.
2) Be able to implement clang_formatDiagnostic in terms of this class.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140526 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
0ef898865aaec8c99addee23d01e03c7abdbd2b3 26-Sep-2011 Chandler Carruth <chandlerc@gmail.com> 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
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
75c1befb4592387ef1bec3bff5f0f5c0c931ea84 26-Sep-2011 Chandler Carruth <chandlerc@gmail.com> Extract the actual printing of the message string into a helper
function. Doing this conveniently requires moving the word wrapping to
use a StringRef which seems generally an improvement. There is a lot
that could be simplified in the word wrapping by using StringRef that
I haven't looked at yet...

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140524 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
8dcdde12e6c98b92e0210cbacf48f801c7c87303 26-Sep-2011 Chandler Carruth <chandlerc@gmail.com> Group the helpers for word wrapping with the primary routine. No
functionality changed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140523 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
a65cb0ced55c8a382e8d42881983f84793b4d5b6 26-Sep-2011 Benjamin Kramer <benny.kra@googlemail.com> Don't print a stray ] at the end of diagnostics.

Also remove an obsolete utostr call.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140511 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
3a2180910a2e6008c2c282f885708d822d2f12c2 26-Sep-2011 Chandler Carruth <chandlerc@gmail.com> Remove support for splitting word-wrapped diagnostic messages on newline
characters. I could find no newline character in a diagnostic message,
and adding an assert to this code never fires in the testsuite.

I think this code is essentially dead, and was previously used for
a different purpose. If I just don't understand how it is we can end up
with a newline here please let me know (with a test case?) and I'll
revert.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140497 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
45b19dea3633737cabdd9a86477f7f2e07024595 26-Sep-2011 Chandler Carruth <chandlerc@gmail.com> Move the word wrapped printing routine down to all the other helper
printing routines, clean up its doxyments and switch it to a camelCase
name as well. No functionality changed here.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140496 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
a3ba6bbac30a3bec488ee7071d203df9d8bcd05d 26-Sep-2011 Chandler Carruth <chandlerc@gmail.com> Switch some of my recently added helper functions to use the proper
style, and add doxyments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140495 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
253d41d74cd449742fd8642753c3076514fb99c5 26-Sep-2011 Chandler Carruth <chandlerc@gmail.com> Rewrite the printing of diagnostic options, categories, etc to actually
use the ostream interface and avoid lots of temporary strings.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140494 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
40847cfb58acc3cac7d68727df9455ac45f2e118 26-Sep-2011 David Blaikie <dblaikie@gmail.com> Rename DiagnosticInfo to Diagnostic as per issue 5397


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140493 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
c3516afb24f62e974e3e8db51437e72deab28b7e 26-Sep-2011 Chandler Carruth <chandlerc@gmail.com> Delete an extraneous line I missed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140491 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
53a529ee614d6a854814273ac49587a03b71a46b 26-Sep-2011 Chandler Carruth <chandlerc@gmail.com> A direct extraction of the rest of the option printing into a helper.
This needs to be cleaned up to better use the ostream object, WIP.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140490 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
761457827001290ca96bd2d5b05f182d21f28296 26-Sep-2011 Chandler Carruth <chandlerc@gmail.com> Start a more correct pattern for factoring out the name printing. Slowly
I'm planning to switch a bunch of these over to use a raw_ostream
instead of += on a string object.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140488 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
a629004ec698daec414b00d773f6a73d8465ef8d 26-Sep-2011 Chandler Carruth <chandlerc@gmail.com> Revert r140484. That was *not* ready to be committed! Only halfway done,
and completely broken at that.

Sorry, must remember to stash rather than commit. =]

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140487 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
534ed20bd2956b912da911f02b39be6b15cb68ec 26-Sep-2011 Chandler Carruth <chandlerc@gmail.com> Fix a formatting goof.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140486 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
89645bab0bd889b03339e69ea949f5edaa2f1081 26-Sep-2011 Chandler Carruth <chandlerc@gmail.com> Extract the diagnostic message formatting into a helper routine.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140484 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
99c4e5bcb93ec0b053bdba48b56939479562f11d 26-Sep-2011 Chandler Carruth <chandlerc@gmail.com> Extract the logic for printing a colorful level name into a helper
function.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140481 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
78ad0b98848c17a0a11847fa1d456e2dfec8aa2f 26-Sep-2011 David Blaikie <dblaikie@gmail.com> Rename DiagnosticClient to DiagnosticConsumer as per issue 5397


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140479 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
d6471f7c1921c7802804ce3ff6fe9768310f72b9 26-Sep-2011 David Blaikie <dblaikie@gmail.com> Rename Diagnostic to DiagnosticsEngine as per issue 5397


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140478 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
026cb7604c8ef0bc7032e4c067500907d03b67a3 26-Sep-2011 Chandler Carruth <chandlerc@gmail.com> Inline this method now that its completely trivial, and prepare for
hoisting parts of the text diagnostic.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140477 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
18fc0025b01472e3961e35a817aaf49fffb333df 26-Sep-2011 Chandler Carruth <chandlerc@gmail.com> Shuffle some names around. 'CaretDiagnostic' is inaccurate as this needs
to handle non-caret diagnostics as well in order to be fully useful in
libclang etc. Also sketch out some more of my plans on this refactoring.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140476 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
8be5c159df96c88880a50086a41efc86b89a46a4 26-Sep-2011 Chandler Carruth <chandlerc@gmail.com> Actually remove the members of CaretDiagnostic no longer in use for
tracking the start and stop of macro expansion suppression. Also remove
the Columns variable which was just a convenience variable based on
DiagOpts. Instead we materialize it in the one piece of code that cared.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140475 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
b9c398b25b9c24769fb30b90c3805a500806e06f 26-Sep-2011 Chandler Carruth <chandlerc@gmail.com> Sink the logic for suppressing some macro expansion notes from the
TextDiagnosticPrinter into the CaretDiagnostic class. Several
interesting results from this:

- This removes a significant per-diagnostic bit of state from the
CaretDiagnostic class, which should eventually allow us to re-use the
object.
- It removes a redundant recursive walk of the macro expansion stack
just to compute the depth. We don't need the depth until we're
unwinding anyways, so we can just mark when we reach it.
- It also paves the way for several simplifications we can do to how we
implement the suppression.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140474 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
a02a8a984f338076c87fd5aa61dca46ab90f27f4 25-Sep-2011 Chandler Carruth <chandlerc@gmail.com> Split the recursive macro expansion walk out from the routine which
emits a source snippet and caret line.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140467 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
548f6c8e8010b181cb151df92f0a989363cb993e 23-Sep-2011 David Blaikie <dblaikie@gmail.com> More missing header inclusions from llvm_unreachable migration.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140369 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
b219cfc4d75f0a03630b7c4509ef791b7e97b2c8 23-Sep-2011 David Blaikie <dblaikie@gmail.com> Switch assert(0/false) llvm_unreachable.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140367 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
5770bb707db9169c258859a9e7c935f99a32d64c 07-Sep-2011 Chandler Carruth <chandlerc@gmail.com> Extract the emission of the diagnostic's location into a separate
function. This is really the beginning of the second phase of
refactorings here. The end goal is to have (roughly) three interfaces:

1) Base class to format a single diagnostic suitable for display on the
console.
2) Extension of the base class which also displays a caret diagnostic
suitable for display on the console.
3) An adaptor that implements the DiagnosticClient by delegating to #1
and/or #2 as appropriate.

Once we have these, things like libclang's formatDiagnostic can use #1
and #2 to provide really well formatted (and consistently formatted!)
textual formatting of diagnostics.

Getting there is going to be quite a bit of shuffling. I'm basically
sketching out where the interface boundaries can be drawn for #1 and #2
within the existing classes. That lets me shuffle with a minimum of fuss
and delta. Once that's done, and any of the related interfaces that need
to change are updated, I'll hoist these into separate headers and
re-implement libclang in terms of their interfaces. Long WIP, but
comments at each step welcome. =D

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139228 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
6c57ccec994f09d732a381bb4bb16c79d181e5ac 07-Sep-2011 Chandler Carruth <chandlerc@gmail.com> Move the HilightRange method from TextDiagnosticPrinter down to
CaretDiagnostic. It's completely generic, with nothing to do with the
diagnostic client or info APIs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139227 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
d2156fcd15c9ad3e0d538f0fe372d7a9e2be965a 07-Sep-2011 Chandler Carruth <chandlerc@gmail.com> Hoist the tab expansion into a helper function.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139226 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
0580e7dccecadc8edee3ed47fe22283addf92e2b 07-Sep-2011 Chandler Carruth <chandlerc@gmail.com> Don't compute the same line number in two places, once inside a loop.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139225 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
5182a1858f4483c7289997d365ba3e103cd7d1b7 07-Sep-2011 Chandler Carruth <chandlerc@gmail.com> Switch the CharSourceRange array to a small vector. The array was
a stack array of a magical size with an assert() that we never
overflowed it. That seems incredibly risky. We also have a very nice API
for bundling up a vector we expect to usually have a small size without
loss of functionality or security if the size is excessive.

The fallout is to remove the last pointer+size parameter pair that are
traced through the recursive caret diagnostic emission.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139217 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
c79a0d22f84e86ad1f9dcb23ec1081aaf5ae4f20 07-Sep-2011 Chandler Carruth <chandlerc@gmail.com> Remove the doxyment for this now defunct parameter.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139197 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
f15651a3afab339cfe9ea1462230d823629bbc61 07-Sep-2011 Chandler Carruth <chandlerc@gmail.com> Don't recompute the presumed loc twice in 5 lines of code... Spotted by
inspection.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139196 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
8a7b3f73d06a7181f2228d1605235b1b5484255f 07-Sep-2011 Chandler Carruth <chandlerc@gmail.com> Use ArrayRef for the fixit hint array rather than a pointer and a size.
Clean up loops over the hints to use the more idiomatic iterator form in
LLVM and Clang.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139195 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
682630ccaae4306d7cfe142006b923905ca2d90e 07-Sep-2011 Chandler Carruth <chandlerc@gmail.com> Hoist the construction of the FixItHint line into a member function with
a defined interface. This isn't as nice as the previous one, but should
get better as I push through better data types in all these functions.

Also, I'm hoping to pull some aspects of this out into a common routine
(such as tab expansion).

Again, WIP, comments welcome as I'm going through.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139190 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
cca61589cada607478fbf05cdc70a7983c5e58d1 02-Sep-2011 Chandler Carruth <chandlerc@gmail.com> Hoist the emission of parseable fixits into a helper method, simplifying
and reducing indentation through the clever use of early exits. ;]

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139001 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
50c909bd837f00265034d876736e2db47686be38 01-Sep-2011 Chandler Carruth <chandlerc@gmail.com> Create a CaretDiagnostic class to hold the logic for emitting
(unsurprisingly) caret diagnostics. This is designed to bring some
organization to the monstrous EmitCaretDiagnostic function, and allow
factoring it more easily and with less mindless parameter passing.

Currently this just lifts the existing function into a method, and
splits off the obviously invariant arguments to be class members. No
functionality is changed, and there are still lots of warts to let
existing code continue functioning as-is. Definitely WIP, more cleanups
to follow.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138921 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
0d6b893c0d66813fad5d9b9193e7af1058e4742e 01-Sep-2011 Chandler Carruth <chandlerc@gmail.com> Sink all of the include stack printing logic into its member function.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138920 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
96d3589e523a04f4ff2058a7919226ce60696ae8 26-Jul-2011 Chandler Carruth <chandlerc@gmail.com> Rename SourceManager (and InstantiationInfo) isMacroArgInstantiation API
to isMacroArgExpansion.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136053 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
642116259e8df6286063a17361c20e95b5017a0a 25-Jul-2011 Chandler Carruth <chandlerc@gmail.com> Rename getInstantiationLineNumber to getExpansionLineNumber in both
SourceManager and FullSourceLoc.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135969 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
a77c031cb66f75d22672070052cc6e0205289ff8 25-Jul-2011 Chandler Carruth <chandlerc@gmail.com> Rename getInstantiationColumnNumber to getExpansionColumnNumber in both
SourceManager and FullSourceLoc.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135965 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
e7b2b6e87dbe5b1207f77b6ff9c210a02f95bb39 25-Jul-2011 Chandler Carruth <chandlerc@gmail.com> Rename getDecomposedInstantiationLoc to getDecomposedExpansionLoc.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135962 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
999f739404edf2078cf9f9c28b4dc45c19765842 25-Jul-2011 Chandler Carruth <chandlerc@gmail.com> Rename SourceManager::getImmediateInstantiationRange to
getImmediateExpansionRange.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135960 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
edc3dccece244a584f8ebdb81da6c962c08e79be 25-Jul-2011 Chandler Carruth <chandlerc@gmail.com> Rename SourceManager::getInstantiationRange to getExpansionRange.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135915 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
402785357ab053dd53f4fdd858b9630a5e0f8bad 25-Jul-2011 Chandler Carruth <chandlerc@gmail.com> Mechanically rename SourceManager::getInstantiationLoc and
FullSourceLoc::getInstantiationLoc to ...::getExpansionLoc. This is part
of the API and documentation update from 'instantiation' as the term for
macros to 'expansion'.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135914 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
5f9e272e632e951b1efe824cd16acb4d96077930 23-Jul-2011 Chris Lattner <sabre@nondot.org> remove unneeded llvm:: namespace qualifiers on some core types now that LLVM.h imports
them into the clang namespace.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135852 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
7e7736aa826b4f8b29e1eae6584393f97243ab5a 14-Jul-2011 Chandler Carruth <chandlerc@gmail.com> Switch all local code and comments from '[Ii]nstantiat(ion|ed)' to
'[Ee]xpan(sion|ded)' in the TextDiagnosticPrinter.

No functionality changed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135136 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
4e805467121700c31f5a37aaac681524a9b9deef 14-Jul-2011 Chandler Carruth <chandlerc@gmail.com> Switch the diagnostic messages about macros to use the terms 'expanded'
and 'expansions' rather than 'instantiated' and 'contexts'.

This is the first of several patches migrating Clang's terminology
surrounding macros from 'instantiation' to 'expansion'.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135135 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
c8d1ecca1cd3fadbd331d15c420755aa6184554b 08-Jul-2011 Chandler Carruth <chandlerc@gmail.com> Keep track of which source locations are part of a macro argument
instantiation and improve diagnostics which are stem from macro
arguments to trace the argument itself back through the layers of macro
expansion.

This requires some tricky handling of the source locations, as the
argument appears to be expanded in the opposite direction from the
surrounding macro. This patch provides helper routines that encapsulate
the logic and explain the reasoning behind how we step through macros
during diagnostic printing.

This fixes the rest of the test cases originially in PR9279, and later
split out into PR10214 and PR10215.

There is still some more work we can do here to improve the macro
backtrace, but those will follow as separate patches.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134660 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
83068315f7d9ed7b82ec35c2c26702151d186a70 28-Jun-2011 Chris Lattner <sabre@nondot.org> Fix PR9279 - Macro expansion stack trace seriously broken with function-style macros, by not recursively printing notes for other 'instantiated from' notes.

This is a one line fix here:
+ // Don't print recursive instantiation notes from an instantiation note.
+ Loc = SM.getSpellingLoc(Loc);

While here, fix the testcase to be more precise (it got filecheck'ized
brutally), and fix EmitCaretDiagnostic to be private and to not pass down
the unused 'Level' argument.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133993 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
544607ea288b0ff24f7be0db11fcc6007d78da17 24-Jun-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> In TextDiagnosticPrinter::EmitCaretDiagnostic, don't always drop fixits if the caret location
points to a macro instantiation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133802 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
bb6a5677fb8d1ed68c4facd90795aca28d197266 26-May-2011 Richard Trieu <rtrieu@google.com> Change the include stack of "instantiated from" notes to fall under the control of f/fno-diagnostics-show-note-include-stack flags. This should help with reducing diagnostic spew from macros instantiations.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132143 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
477aab6782795e7472055a54108d2df270ce1a89 25-May-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> A StringRef-ication of the DiagnosticIDs API and internals.

Patch by Matthieu Monrocq with tweaks by me to avoid StringRefs in the static
diagnostic data structures, which resulted in a huge global-var-init function.

Depends on llvm commit r132046.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132047 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
c9471b0ff1815ed0149dbfcad0f385ed8648eeb0 21-May-2011 Douglas Gregor <dgregor@apple.com> Introduce the -fdiagnostics-format=xxx option to control how Clang
prints the file, line, and column of a diagnostic. We currently
support Clang's normal format, MSVC, and Vi formats.

Note that we no longer change the diagnostic format based on
-fms-extensions.

Patch by Andrew Fish!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131794 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
7d2b8c1fcc2b707be78b09930a7767477822462f 16-Apr-2011 Douglas Gregor <dgregor@apple.com> Initial work to improve documentation for Clang's diagnostics, from Matthieu Monrocq

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129614 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
32ad9353327afb9e4e69e16dfffaab704eeaffbe 31-Mar-2011 Matt Beaumont-Gay <matthewbg@google.com> Remove a redundant isValid() check

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128606 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
abaca7a8be8e79cc01354676e3bcb26575640311 27-Mar-2011 Chandler Carruth <chandlerc@gmail.com> Add an option to suppress include stack printing on note diagnostics.
These stacks are often less important than those on primary diagnostics.

As the number of notes grows, this becomes increasingly important. The
include stack printing is clever and doesn't print stacks for adjacent
diagnostics from the same file, but when a note is in between a sequence
of errors in a header file, and the notes all refer to some other file,
we end up getting a worst-case ping-pong of include stacks that take up
a great deal of vertical space.

Still, for now, the default behavior isn't changed. We can evaluate user
feedback with the flag.

Patch by Richard Trieu, a couple of style tweaks from me.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128371 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
7decebfc7b9dc841f228c93cc2e41e3e62911ff8 25-Feb-2011 Ted Kremenek <kremenek@apple.com> Teach TextDiagnosticPrinter to print out '-Werror' in addition to the warning flag for a warning mapped to an error.

For example:

t.c:7:9: error: using the result of an assignment as a condition without parentheses [-Werror,-Wparentheses]

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126466 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
04331169f04198eb769925fa17696a21989c9d8b 27-Jan-2011 Axel Naumann <Axel.Naumann@cern.ch> TextDiagnosticPrinter.cpp: Show diagnostics as far as possible even with invalid PresomedLoc, instead of just silencing it.

FileManager.cpp: Allow virtual files in nonexistent directories.
FileManager.cpp: Close FileDescriptor for virtual files that correspond to actual files.
FileManager.cpp: Enable virtual files to be created even for files that were flagged as NON_EXISTENT_FILE, e.g. by a prior (unsuccessful) addFile().

ASTReader.cpp: Read a PCH even if the original source files cannot be found.

Add a test for reading a PCH of a file that has been removed and diagnostics referencing that file.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124374 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
f2224d89a6ae65a3839529e26d0f6d025d83d6bb 18-Nov-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Since multiple diagnostics can share one diagnostic client, have the client keeping track
of the total number of warnings/errors reported.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119731 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
33e4e70c8c0a17e0ccb7465d96556b077a68ecb1 18-Nov-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Refactoring of Diagnostic class.

-Move the stuff of Diagnostic related to creating/querying diagnostic IDs into a new DiagnosticIDs class.
-DiagnosticIDs can be shared among multiple Diagnostics for multiple translation units.
-The rest of the state in Diagnostic object is considered related and tied to one translation unit.
-Have Diagnostic point to the SourceManager that is related with. Diagnostic can now accept just a
SourceLocation instead of a FullSourceLoc.
-Reflect the changes to various interfaces.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119730 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
cb7b1e17b63967317ab5cc55682168cf0380519a 12-Nov-2010 Douglas Gregor <dgregor@apple.com> Make sure to always check the result of
SourceManager::getPresumedLoc(), so that we don't try to make use of
an invalid presumed location. Doing so can cause crashes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118885 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
c417fa024495c10a5e678ea36a5f8c715528bdd1 02-Nov-2010 Douglas Gregor <dgregor@apple.com> Teach SourceManager::getPresumedLoc() how to fail gracefully if getLineNumber/getColumnNumber fail

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117990 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
bf5e09d185275a1942223ecb58e20c2d88dcc340 20-Aug-2010 Douglas Gregor <dgregor@apple.com> Eliminate some extraneous whitespace in the machine-parseable Fix-It output.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111610 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
4786c15f4977c7cee98fde3ebdee213dba23848b 19-Aug-2010 Douglas Gregor <dgregor@apple.com> Add machine-parseable Fix-It output as part of diagnostics, under the
flag -fdiagnostics-parseable-fixits, from Eelis van der Weegen!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111557 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
783c56f47745f719590b17afd7ed937bf2407b53 18-Aug-2010 Douglas Gregor <dgregor@apple.com> Simplify FixItHint by eliminated the unnecessary InsertionLoc
location. Patch by Eelis van der Weegen!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111362 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
45f9b7e8f23072d662ee1cc758f4ecb0da5e3322 21-Jun-2010 Tom Care <tcare@apple.com> Bug 7377: printf checking fails to flag some undefined behavior
http://llvm.org/bugs/show_bug.cgi?id=7377

Updated format string highlighting and fixits to take advantage of the new CharSourceRange class.
- Change HighlightRange to allow highlighting whitespace only in a CharSourceRange (for warnings about the ' ' (space) flag)
- Change format specifier range helper function to allow for half-open ranges (+1 to end)
- Enabled previously failing tests (FIXMEs/XFAILs removed)
- Small fixes and additions to format string test cases

M test/Sema/format-strings.c
M test/Sema/format-strings-fixit.c
M lib/Frontend/TextDiagnosticPrinter.cpp
M lib/Sema/SemaChecking.cpp

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106480 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
0a76aae8c03cb7dd7bdbe683485560afaf695959 19-Jun-2010 Chris Lattner <sabre@nondot.org> introduce a new CharSourceRange class, and enhance the diagnostics routines
to use them instead of SourceRange. CharSourceRange is just a SourceRange
plus a bool that indicates whether the range has the end character resolved
or whether the end location is the start of the end token. While most of
the compiler wants to think of ranges that have ends that are the start of
the end token, the printf diagnostic stuff wants to highlight ranges within
tokens.

This is transparent to the diagnostic stuff. To start taking advantage of
the new capabilities, you can do something like this:
Diag(..) << CharSourceRange::getCharRange(Begin,End)





git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106338 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
d342bf7fdb5a16fe73e46a8c995ad89cf79a7bad 24-May-2010 Chris Lattner <sabre@nondot.org> when too many errors are emitted, and we produce:
fatal error: too many errors emitted, stopping now [-ferror-limit=]

Tell the user that this is controlled with -ferror-limit=, like above.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104528 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
6fbe8398ba1680ffc5daa7395850ff8765b7905b 04-May-2010 Chris Lattner <sabre@nondot.org> add a new -fdiagnostics-show-category=none/id/name option, giving control
over choice of:

t.c:3:11: warning: conversion specifies type 'char *' but the argument has type 'int' [-Wformat]
t.c:3:11: warning: conversion specifies type 'char *' but the argument has type 'int' [-Wformat,1]
t.c:3:11: warning: conversion specifies type 'char *' but the argument has type 'int' [-Wformat,Format String]

dox to come.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103056 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
c9b889044c8e1e2d6ab194e34e8b74f6998094fa 04-May-2010 Chris Lattner <sabre@nondot.org> When -fdiagnostics-print-source-range-info is specified,
print the diagnostic category number in the [] at the end
of the line. For example:

$ cat t.c
#include <stdio.h>
void foo() {
printf("%s", 4);
}
$ clang t.c -fsyntax-only -fdiagnostics-print-source-range-info
t.c:3:11:{3:10-3:12}{3:15-3:16}: warning: conversion specifies type 'char *' but the argument has type 'int' [-Wformat,1]
printf("%s", 4);
~^ ~
1 warning generated.

Clients that want category information can now pick the number
out of the output, rdar://7928231.

More coming.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103053 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
6c1cb9916e9988dcdd65b9266dbe24afd173427a 04-May-2010 Douglas Gregor <dgregor@apple.com> Introduce a limit on the depth of the macro instantiation backtrace
printed in a diagnostic, similar to the limit we already have on the
depth of the template instantiation backtrace. The macro instantiation
backtrace is limited to 10 "instantiated from:" diagnostics; when it's
longer than that, we'll show the first half, then say how many were
suppressed, then show the second half. The limit can be changed with
-fmacro-instantiation-limit=N, and turned off with N=0.

This eliminates a lot of note spew with libraries making use of the
Boost.Preprocess library.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103014 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
5c5db4e94bd1243ba92563acba51ba66afa94917 20-Apr-2010 Chris Lattner <sabre@nondot.org> change FullSourceLoc to have a *const* SourceManager&, eliminating
a const_cast.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101940 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
ce487ef6c1ba3b35250ce5bfe053e24e34a854e6 16-Apr-2010 Douglas Gregor <dgregor@apple.com> Fix a bug in caret-line-pruning logic that only happens when we have a
source line wider than the terminal where the associated fix-it line
is longer than the caret line. Previously, we would crash in this
case, which was rather unfortunate. Fixes <rdar://problem/7856226>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101426 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
04e442714c292d9381cad2ac14087991132bddca 12-Apr-2010 Chris Lattner <sabre@nondot.org> fix PR6814 - Only print [-pedantic] on a diagnostic if -pedantic
actually turned it on. If a diag is produced by a warning which
is an extension but defaults to on, and has no warning group, don't
print any option info.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101071 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
849b243d4065f56742a4677d6dc8277609a151f8 31-Mar-2010 Douglas Gregor <dgregor@apple.com> Reinstate my CodeModificationHint -> FixItHint renaming patch, without
the C-only "optimization".


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100022 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
275313cbb0847f1f117f60d144d113804d4fa42d 31-Mar-2010 Douglas Gregor <dgregor@apple.com> Revert r100008, which inexplicably breaks the clang-i686-darwin10 builder

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100018 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
d0ebe080eee7c37e73754068b47fd90cc506e128 31-Mar-2010 Douglas Gregor <dgregor@apple.com> Rename CodeModificationHint to FixItHint, since we've been using the
term "fix-it" everywhere and even *I* get tired of long names
sometimes. No functionality change.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100008 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
f6ac97b101c8840efa92bf29166077ce4049e293 16-Mar-2010 Benjamin Kramer <benny.kra@googlemail.com> Let SourceManager::getBufferData return StringRef instead of a pair of two const char*.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98630 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
f715ca12bfc9fddfde75f98a197424434428b821 16-Mar-2010 Douglas Gregor <dgregor@apple.com> Give SourceManager a Diagnostic object with which to report errors,
and start simplifying the interfaces in SourceManager that can fail.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98594 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
aea67dbd653a2dd6dd5cc2159279e81e855b2482 15-Mar-2010 Douglas Gregor <dgregor@apple.com> Introduce a new BufferResult class to act as the return type of
SourceManager's getBuffer() (and similar) operations. This abstract
can be used to force callers to cope with errors in getBuffer(), such
as missing files and changed files. Fix a bunch of callers to use the
new interface.

Add some very basic checks for file consistency (file size,
modification time) into ContentCache::getBuffer(), although these
checks don't help much until we've updated the main callers (e.g.,
SourceManager::getSpelling()).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98585 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
193575455e00eca03fd7177f60e3f2e6263cb661 13-Mar-2010 Kovarththanan Rajaratnam <kovarththanan.rajaratnam@gmail.com> Use SmallString instead of SmallVector

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98436 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
b96b6709fbf5044ab06223ebfefccd58d7aaa88b 25-Feb-2010 Daniel Dunbar <daniel@zuster.org> Add TextDiagnosticPrinter::setPrefix, for adding a string to prefix diagnostic
messages with.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97101 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
8d2ea4ea7b28ee4eed97182bf7866ef918d20813 16-Feb-2010 Chris Lattner <sabre@nondot.org> when a diagnostic is an extension and has no other -W flag,
indicate that it was enabled with -pedantic so people know
why they're getting them:

$ printf "int x;" | clang -xc - -pedantic
<stdin>:1:7: warning: no newline at end of file [-pedantic]
int x;
^



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96365 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
41e79e2912e3765170bb74c9ecf514d01aebffff 12-Feb-2010 Chris Lattner <sabre@nondot.org> restructure code a bit: there are two potential issues
worth asserting about in this code: 1) if the source range
is bogus (begin loc after end loc), and 2) if the client
is trying to highlight a range that is purely whitespace.

It is possible to just silently ignore #2, but it seems like
it is always a bug, so lets keep asserting on this condition,
but with a better assert message.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95998 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
e44433c29e59a57ef1fac9cd252a2a98a0afb2e7 18-Jan-2010 Douglas Gregor <dgregor@apple.com> Print fix-it hints properly around tabs, from Christian Adåker!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93750 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
52388f9aefba585475a38081272ce582d033c883 13-Jan-2010 Chris Lattner <sabre@nondot.org> diagnose invalid values of -ftabstop, patch by Christian Adaker!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93288 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
124fca533d9fef2e3f6359283909bd342b5f5f26 09-Jan-2010 Chris Lattner <sabre@nondot.org> implement -ftabstop=width, patch by Christian Adåker


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93078 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
eae18f89ede182c686e8ee47014fdb3cd3ed496c 06-Dec-2009 Daniel Dunbar <daniel@zuster.org> Fix an off by one in findEndOfWord, which could scan past the end of the string in a corner case.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90703 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
0304c6cb7fd3b2137213858b1e5ae85ef3f4f8e2 05-Dec-2009 Steve Naroff <snaroff@apple.com> Remove 'LangOpts' from Diagnostic (added in http://llvm.org/viewvc/llvm-project?view=rev&revision=90642).

Simply use the 'LangOpts' member already present in TextDiagnosticPrinter.

Sorry for the confusion!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90664 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
e0c4d895ffe4320aa4e29485711ad7d154f2cc2b 05-Dec-2009 Steve Naroff <snaroff@apple.com> Integrate the following from the 'objective-rewrite' branch:

http://llvm.org/viewvc/llvm-project?view=rev&revision=71086

Note - This commit only includes the fix for:

<rdar://problem/6309338> slightly different error message format for Visual Studio.

The fix for <rdar://problem/6845623> from protocol to template. is separate/forthcoming.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90642 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
2e77aa1c2a596b66d436d27b8ec2ea695cf9a748 04-Dec-2009 Chris Lattner <sabre@nondot.org> Use PresumedLoc when emitting the 'included from' diagnostics. For a malformed
test like this:

#line 4 "foo"

#define XX ?

#if XX
#endif

We now emit:

In file included from t.c:7:
foo:7:5: error: invalid token at start of a preprocessor expression
#if XX
^
foo:5:12: note: instantiated from:
#define XX ?
^

instead of:

In file included from t.c:7:
foo:7:5: error: invalid token at start of a preprocessor expression
#if XX
^
./t.h:6:12: note: instantiated from:
#define XX ?
^

(where the note doesn't obey #line or print the include stack when needed).

This fixes PR5617



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90554 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
aea364195b81f933515e8968b5254a1195eb0337 11-Nov-2009 Daniel Dunbar <daniel@zuster.org> Allow TextDiagnosticPrinter to have optional ownership of its output stream.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86823 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
efcbe9475348ecab6b85153baa21d0e894e39607 05-Nov-2009 Daniel Dunbar <daniel@zuster.org> Replace DiagnosticClient::setLangOptions with {Begin,End}SourceFile, and clarify
invariants (diagnostics with source informations must occur between
{Begin,End}SourceFile).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86113 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
eace8743030d2979251a0c5ae247371cfd9056e5 04-Nov-2009 Daniel Dunbar <daniel@zuster.org> Factor out a diagnostic options class.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86010 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
06d10728b86ebb2bd73b593146e95e0c1688acc4 19-Oct-2009 Daniel Dunbar <daniel@zuster.org> Workaround a bug exposed by the FileCheckify of message-length.c, the caret end
column computation isn't correct and could exceed the line length, which
resulted in a buffer overflow later.
- Chris, is there a better way for this code to compute the final column used
by the caret?

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84475 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
1eb4433ac451dc16f4133a88af2d002ac26c58ef 09-Sep-2009 Mike Stump <mrs@apple.com> Remove tabs, and whitespace cleanups.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81346 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
cbff0dc7fefe37bcef9044ec89e9f1131f3c76a9 08-Sep-2009 Daniel Dunbar <daniel@zuster.org> Remove trailing whitespace.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81169 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
81ebe9bf80b9a4eb1e5a30b0de39b2d638044ae4 15-Jun-2009 Chris Lattner <sabre@nondot.org> Minor tweak to -fdiagnostics-print-source-range-info to make it print
ranges more similar to the console output. Consider:

#define FOO(X, Y) X/ Y

void foo(int *P, int *Q) {
FOO(P, Q);
}

Before we emitted:

t.c:4:3:{4:3-4:6}{4:3-4:6}: error: invalid operands to binary expression ('int *' and 'int *')
FOO(P, Q);
^~~~~~~~~
...

Note that while we underline the macro args that the range info just includes FOO
without its macros. This change teaches the printed ranges to include macro args
also so that we get:

t.c:4:3:{4:3-4:12}{4:3-4:12}: error: invalid operands to binary expression ('int *' and 'int *')
FOO(P, Q);
^~~~~~~~~
...

This fixes rdar://6939599


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73378 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
603fca728136f0e5d258a84e7bd4a0e1e9bd0803 04-Jun-2009 Torok Edwin <edwintorok@gmail.com> Add ANSI color support for clang.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72855 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
1f0eb56d7cd1b24c21ac24112dfb41d3b29fb21c 19-May-2009 Douglas Gregor <dgregor@apple.com> "This patch fixes an obvious buffer overrun in
SelectInterestingSourceRegion()," from Jay Foad!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72049 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
c95bd4de800dfc643f0dab0122757f9ca9723fe9 15-May-2009 Douglas Gregor <dgregor@apple.com> When word-wrapping, be more defensive about a ridiculously small number of columns. Fixes <rdar://problem/6892178>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71870 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
2cc2b9ca22d21cd855f06f545b8720f6a7a965b4 06-May-2009 Douglas Gregor <dgregor@apple.com> Eliminate extra vertical space in Clang diagnostics

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71066 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
037fb7f3691966aa66f2b878a149fba57b947355 06-May-2009 Chris Lattner <sabre@nondot.org> Fix rdar://6849429 - -Wunused-value with deeply nested macro expansion generates untraceable warnings

The "instantiated from" messages coming from the caret diagnostics system are
basically walking the macro expansion tree, emitting each level as it goes. However, it was
skipping certain leaves in the tree by skipping up the entire instantiation arm every time
it went up one spelling arm. This caused it to miss some things. For example, in this
testcase:

#define M1(x) x
#define M2 1;

void foo() {
M1(M2)
}

we now print:

/Users/sabre/Desktop/clang-unused-value-macro.c:6:2: warning: expression result unused

M1(M2)
^~~~~~
/Users/sabre/Desktop/clang-unused-value-macro.c:6:5: note: instantiated from:

M1(M2)
^~
/Users/sabre/Desktop/clang-unused-value-macro.c:3:12: note: instantiated from:

#define M2 1;
^

Previously we didn't print the last line, so we never emitted the caret pointing to the 1!

Incidentally, the spaces between the lines is really noisy, I think we should reconsider
this heuristic (which adds them when the printed code starts too close to the start of the
line).

The regression test can't use -verify, because -verify doesn't catch notes for macro
instantiation history.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71025 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
2fb3ea3ea447fb643173b098fa05a192441b089e 04-May-2009 Douglas Gregor <dgregor@apple.com> Simplify the interesting-region code by assimmilating blocks of non-whitespace text with each expansion step. It's easier and seems to have better results.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70833 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
cfe1f9d86d4d3b2538ed41a9f5ff313dcd20c6a9 04-May-2009 Douglas Gregor <dgregor@apple.com> Tweak the extraction of the "interesting" part of a source range in two ways:

1) First of all, we treat _ as part of an identifier and not as
punctuation (oops).
2) Second of all, always make sure that the token that the ^ is
pointing at is fully within the "interesting" part of the range.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70831 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
1ef29d217ef9084bca57fe31e0d1541efa6d120a 04-May-2009 Daniel Dunbar <daniel@zuster.org> Fix an infinite loop in diagnostic printing.
- The diagnostic is still poor, however. Doug, can you investigate?

- Improved the test case to not depend on the file name, now it can
be extended to actually check the formatting of the diagnostics
(I'm hoping grep -A is portable here).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70807 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
2167de4c4934d6beb3af3a4d74ee160def67f74a 03-May-2009 Douglas Gregor <dgregor@apple.com> Fix crash in source-line truncation code for diagnostic
printing. Also, when we only need to truncate the line at the end,
make sure there is room for the ellipsis.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70781 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
cb6929bf439bbb5bc4604ac18893c790be63f95f 03-May-2009 Chris Lattner <sabre@nondot.org> temporary hack to work around PR4128


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70681 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
844da34736c0439ae50017826a7393406e75acd8 03-May-2009 Douglas Gregor <dgregor@apple.com> When a fix-it hint would span multiple lines, don't print it; half a
fix-it hint is much worse than no fix-it hint. (Fixes PR4084).

When we need to truncate a source line to fix in the terminal, make
sure to take the width of the fix-it information into account, too.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70656 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
7d101f6fd7f311b0a7fdd83a50f8668bd8a659cd 03-May-2009 Douglas Gregor <dgregor@apple.com> When we truncate a source line to fit it within the terminal width,
show an ellipsis where we have removed text. An example:

/Users/dgregor/Projects/llvm/tools/clang/test/Misc/message-length.c:18:120:
warning:
comparison of distinct pointer types ('int *' and 'float *')
...a_func_to_call(ip == FloatPointer, ip[ALongIndexName], ...
~~ ^ ~~~~~~~~~~~~



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70655 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
44cf08ecf648210347191942b1664e36d46290c5 03-May-2009 Douglas Gregor <dgregor@apple.com> Respect the COLUMNS environment variable for word-wrapping (so we get
word-wrapping by default in Emacs; yay!). Thanks, Daniel.

Use LLVM's System layer rather than calling isatty() directly.

Fix a thinko in printing the indentation string that was causing some
weird output.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70654 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
47f717788082cdc38b899faf18acc8d1cda1b9c5 02-May-2009 Douglas Gregor <dgregor@apple.com> When printing a source line as part of a diagnostic, the source line
might be wider than we're supposed to print. In this case, we try to
select the "important" subregion of the source line, which contains
everything that we want to show (e.g., with underlining and the caret
itself) and tries to also contain some of the context.

From the fantastically long line in the test case, we get an error
message that slices down to this:

message-length.c:18:120: warning: comparison of distinct pointer types
('int *' and 'float *')
a_func_to_call(ip == FloatPointer, ip[ALongIndexName],
~~ ^ ~~~~~~~~~~~~

There are a bunch of gee-it-sounds-good heuristics in here, which seem
to do well on the various simple tests I've thrown at it. However,
we're going to need to look at a bunch more diagnostics to tweak these
heuristics.

This is the second part of <rdar://problem/6711348>. Almost there!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70597 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
fffd93f38340d4d2ca7ee78a8c91c890b2ff3fa0 01-May-2009 Douglas Gregor <dgregor@apple.com> Implement -fmessage-length=N, which word-wraps diagnostics to N columns.

Also, put a line of whitespace between the diagnostic and the source
code/caret line when the start of the actual source code text lines up
(or nearly lines up) with the most recent line of the diagnostic. For
example, here it's okay for the last line of the diagnostic to be
(vertically) next to the source line, because there is horizontal
whitespace to separate them:

decl-expr-ambiguity.cpp:12:16: error: function-style cast to a builtin
type can only take one argument
typeof(int)(a,5)<<a;

However, here is a case where we need the vertical separation (since
there is no horizontal separation):

message-length.c:10:46: warning: incompatible pointer types initializing 'void
(int, float, char, float)', expected 'int (*)(int, float, short,
float)'

int (*fp1)(int, float, short, float) = f;

This is part one of <rdar://problem/6711348>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70578 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
770dbf04b4e56a2aa0901b7515318cf9e59adf2a 29-Apr-2009 Chris Lattner <sabre@nondot.org> In -fdiagnostics-print-source-range-info mode, print a space before the
lines that clang extracts from the source code so that machine parsing can
easily ignore them.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70337 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
5ce24c87918dde1716d6c9f3ca6acf8b6c1c5472 21-Apr-2009 Chris Lattner <sabre@nondot.org> make "in included from" and "in instatiation from" messages respect
-fno-show-location, patch by Alexei Svitkine (PR4024)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69657 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
74548e67d835254c3852b95bfb6dbbd6609a91f5 20-Apr-2009 Chris Lattner <sabre@nondot.org> don't crash on invalid ranges in -fprint-source-range-info
mode, just ignore them as usual.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69558 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
aa5bf2e8dc01f9835efef76222dc440a5c18b160 19-Apr-2009 Chris Lattner <sabre@nondot.org> implement compiler support for -fno-diagnostics-fixit-info,
rdar://6805442


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69525 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
19cbb44e3c4f2181dafa2ab92d3e3a26619b71d9 16-Apr-2009 Chris Lattner <sabre@nondot.org> tblgen is now passing diagnostic group information in the .inc file, ignore it everywhere.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69269 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
d51d74a3e89c5e5fc9bfd2814996a5feab6dc932 16-Apr-2009 Chris Lattner <sabre@nondot.org> implement framework for -fdiagnostics-show-option, but tblgen isn't
passing down the right info yet.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69268 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
2c78b873f4f3823ae859c15674cb3d76c8554113 15-Apr-2009 Chris Lattner <sabre@nondot.org> Change Lexer::MeasureTokenLength to take a LangOptions reference.
This allows it to accurately measure tokens, so that we get:

t.cpp:8:13: error: unknown type name 'X'
static foo::X P;
~~~~~^

instead of the woefully inferior:

t.cpp:8:13: error: unknown type name 'X'
static foo::X P;
~~~~ ^

Most of this is just plumbing to push the reference around.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69099 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
1fbee5d02860d3c72a713d3dfb4179fa9f400cb3 13-Mar-2009 Chris Lattner <sabre@nondot.org> implement a new -fprint-source-range-info option, which
defaults to off. When enabled, it emits range info along
with the file/line/col information for a diagnostic. This
allows tools that textually parse the output of clang to know
where the ranges are, even if they span multiple lines. For
example, with:

$ clang exprs.c -fprint-source-range-info

We now produce:

exprs.c:21:11:{21:12-21:13}: warning: use of unary operator that may be intended as compound assignment (+=)
var =+ 5; // expected-warning {{use of unary operator that may be intended as compound assignment (+=)}}
^~
exprs.c:22:11:{22:12-22:13}: warning: use of unary operator that may be intended as compound assignment (-=)
var =- 5; // expected-warning {{use of unary operator that may be intended as compound assignment (-=)}}
^~
exprs.c:36:13:{36:3-36:12}: error: assignment to cast is illegal, lvalue casts are not supported
(float*)X = P; // expected-error {{assignment to cast is illegal, lvalue casts are not supported}}
~~~~~~~~~ ^
exprs.c:41:4:{41:3-41:4}: error: called object type 'int' is not a function or function pointer
X(); // expected-error {{called object type 'int' is not a function or function pointer}}
~^
exprs.c:45:15:{45:8-45:14}{45:17-45:24}: error: invalid operands to binary expression ('int *' and '_Complex float')
P = (P-42) + Gamma*4; // expected-error {{invalid operands to binary expression ('int *' and '_Complex float')}}
~~~~~~ ^ ~~~~~~~
exprs.c:61:7:{61:16-61:22}: error: invalid application of '__alignof' to bitfield
R = __alignof(P->x); // expected-error {{invalid application of '__alignof' to bitfield}} expected-warning {{extension used}}
^ ~~~~~~

Note the range info after the column in the initial diagnostic.

This is obviously really annoying if you're not a tool parsing the
output of clang, which is why it is off by default.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66862 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
df667e71b1daadeacb230cf94fc717843f1a138a 10-Mar-2009 Douglas Gregor <dgregor@apple.com> Extend the notion of active template instantiations to include the
context of a template-id for which we need to instantiate default
template arguments.

In the TextDiagnosticPrinter, don't suppress the caret diagnostic if
we are producing a non-note diagnostic that follows a note diagnostic
with the same location, because notes are (conceptually) a part of the
warning or error that comes before them.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66572 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
cd1148b6145094ae3cabd02e6ef1d50dcc2d07b0 08-Mar-2009 Chris Lattner <sabre@nondot.org> generalize the "end of line" checking logic to stop at any \0 at the
end of line instead of just the end of buffer. Scratch buffers contain
embedded \0's between tokens which are logic line separators. If a
normal text buffer contains \0's, it doesn't make a lot of sense to include
them in the caret diag output anyway.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66374 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
7b5b5b4409a64849908f67b9e389c0ba185b64b0 02-Mar-2009 Chris Lattner <sabre@nondot.org> fix PR2639


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65869 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/TextDiagnosticPrinter.cpp
e1bd4e6d7c5b13462f83245865f7d9e9b6ea8486 02-Mar-2009 Daniel Dunbar <daniel@zuster.org> Rename lib/Driver (etc) to lib/Frontend in prep for the *actual*
driver taking lib/Driver.


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