summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/TextDiagnostic.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* When an error occurs while building a module on demand, provide "WhileDouglas Gregor2012-11-301-0/+11
| | | | | | | | | building module 'Foo' imported from..." notes (the same we we provide "In file included from..." notes) in the diagnostic, so that we know how this module got included in the first place. This is part of <rdar://problem/12696425>. llvm-svn: 169021
* only truncate source lines in text diagnostics whenSeth Cantrell2012-11-031-2/+2
| | | | | | the ellipsis is shorter than the text it replaces llvm-svn: 167364
* don't step into the middle of multibyte sequencesSeth Cantrell2012-11-031-2/+2
| | | | llvm-svn: 167361
* fix bug in SourceColumnMap::startOfPreviousColumnSeth Cantrell2012-11-031-1/+1
| | | | llvm-svn: 167360
* Add a proper algorithm to compute accurate source ranges for diagnostics withEli Friedman2012-11-031-10/+2
| | | | | | | | | caret locations and source ranges in macros. Makes ranges more accurate in some cases, and fixes an assertion failure. Fixes <rdar://problem/12472249>. llvm-svn: 167353
* remove duplicate data arraySeth Cantrell2012-10-301-14/+1
| | | | llvm-svn: 167007
* fix calculation of end pointerSeth Cantrell2012-10-301-1/+1
| | | | llvm-svn: 167006
* Use a .def file for most of the diagnostic options.Douglas Gregor2012-10-231-3/+3
| | | | llvm-svn: 166520
* Make DiagnosticOptions intrusively reference-counted, and make sureDouglas Gregor2012-10-231-30/+30
| | | | | | | the various stakeholders bump up the reference count. In particular, the diagnostics engine now keeps the DiagnosticOptions object alive. llvm-svn: 166508
* Emit diagnostics in chunks even when we're trying to print colored template ↵Benjamin Kramer2012-10-181-12/+15
| | | | | | | | diffs. char-by-char is really slow on an unbuffered stream. llvm-svn: 166218
* Revert 'Fix a typo 'iff' => 'if''. iff is an abreviation of if and only if. ↵Sylvestre Ledru2012-09-271-1/+1
| | | | | | See: http://en.wikipedia.org/wiki/If_and_only_if Commit 164766 llvm-svn: 164769
* Fix a typo 'iff' => 'if'Sylvestre Ledru2012-09-271-1/+1
| | | | llvm-svn: 164766
* Make TextDiagnostic more robust against SourceLocations which point into theRichard Smith2012-09-131-25/+54
| | | | | | | middle of UTF-8 characters, and avoid walking to such positions when adjusting column ranges for display. Fixes a couple of hangs when rendering diagnostics. llvm-svn: 163820
* Add missing cctype includes.Joerg Sonnenberger2012-08-101-0/+1
| | | | llvm-svn: 161660
* Remove unused variables.Benjamin Kramer2012-08-081-7/+0
| | | | llvm-svn: 161483
* Fix a typo (the the => the)Sylvestre Ledru2012-07-231-1/+1
| | | | llvm-svn: 160622
* Re-apply r160319 "Don't crash when emitting fixits following Unicode chars"Jordan Rose2012-07-201-29/+29
| | | | | | | | | This time, make sure we don't try to print fixits with newline characters, since they don't have a valid column width, and they don't look good anyway. PR13417 (and originally <rdar://problem/11877454>) llvm-svn: 160561
* Revert r160319, it caused PR13417. Add a test for PR13417.Nico Weber2012-07-201-26/+27
| | | | llvm-svn: 160542
* Don't crash when emitting fixits following Unicode characters.Jordan Rose2012-07-161-27/+26
| | | | | | | | | | | | | | | This code is very sensitive to the difference between "columns" as printed and "bytes" (SourceManager columns). All variables are now named explicitly and our assumptions are (hopefully) documented as both comment and assertion. Whether parseable fixits should use byte offsets or Unicode character counts is pending discussion on the mailing list; currently the implementation uses bytes (and has no problems on lines containing multibyte characters). This has been added to the user manual. <rdar://problem/11877454> llvm-svn: 160319
* PR13312: Don't crash when printing a fixit that ends in a unicode character.Benjamin Kramer2012-07-121-1/+6
| | | | llvm-svn: 160112
* When applying a template diff highlighting to a diagnostic message, rememberRichard Trieu2012-06-281-10/+19
| | | | | | to reapply the bold formatting when needed. llvm-svn: 159386
* Fix template type diffing coloring (r159216) when forcing color output to a ↵David Blaikie2012-06-281-2/+5
| | | | | | | | file (not a terminal) Reviewed (over the shoulder) by Richard Trieu. llvm-svn: 159381
* Add template type diffing to Clang. This feature will provide a betterRichard Trieu2012-06-261-3/+25
| | | | | | | | | | | | comparison between two templated types when they both appear in a diagnostic. Type elision will remove indentical template arguments, which can be disabled with -fno-elide-type. Cyan highlighting is applied to the differing types. For more formatting, -fdiagnostic-show-template-tree will output the template type as an indented text tree, with differences appearing inline. Template tree works with or without type elision. llvm-svn: 159216
* Documentation cleanup: escape \ characters in Doxygen comments as needed.James Dennett2012-06-221-2/+2
| | | | llvm-svn: 158968
* If fixits appear to overlap, move the second one over in the output.Jordan Rose2012-06-081-6/+14
| | | | | | | | This occurs when you have two insertions and the first one is so long that the second fixit's column is before the first fixit ends. The edits themselves don't actually overlap, but our command-line preview does. llvm-svn: 158229
* ensure value passed to is space is representable as unsigned charSeth Cantrell2012-05-251-8/+12
| | | | | | | if the value isn't an unsigned char or EOF behavior is undefined (and on Windows there's an assertion) llvm-svn: 157445
* fix Bug 12924Seth Cantrell2012-05-241-0/+16
| | | | | | | | | | | | | http://llvm.org/bugs/show_bug.cgi?id=12924 This issue was that the source location was pointing to a non-printable character and so CaretEnd was pointing one _column_ past the caret but not one _character_ past the caret. So the conversion between column and byte locations wasn't working (because the conversion is only valid from the first column or byte of a character). llvm-svn: 157372
* Fix an assertion hit when the serialized diagnostics writer receive a diagnosticArgyrios Kyrtzidis2012-05-101-12/+19
| | | | | | | | | | | | | | from the frontend when the location is invalid and the SourceManager null. Instead of keeping the SourceManager object in DiagnosticRenderer, propagate it to the calls accordingly (as reference when it is expected to not be null, or pointer when it may be null). This effectively makes DiagnosticRenderer not tied to a specific SourceManager, removing a hack from TextDiagnosticPrinter. rdar://11386874 llvm-svn: 156536
* Make some helper functions static.Benjamin Kramer2012-05-011-8/+7
| | | | llvm-svn: 155914
* Revert r154981, because it caused PR12674.Nico Weber2012-04-261-8/+4
| | | | | | Add a test for PR12674. llvm-svn: 155666
* Suppress -Wunused-variable warning in -Asserts buildMatt Beaumont-Gay2012-04-181-1/+1
| | | | llvm-svn: 155011
* fix display of source lines with null charactersSeth Cantrell2012-04-181-2/+5
| | | | llvm-svn: 154981
* Nicer display of unprintable source, and fix caret display for non-ascii textSeth Cantrell2012-04-181-159/+439
| | | | | | | | | | | | | Unprintable source in diagnostics is transformed to a printable form and then displayed with reversed colors if possible. Unprintable characters are displayed as <U+NNNN> while bytes that do not represent valid characters are shown as <XX>. Column adjustments to diagnostic carets, highlighted ranges, and fixups are made both for characters escaped as above and for characters which are printable but take up more than a single column. llvm-svn: 154980
* Revert "Nicer display of unprintable source, and fix caret display for ↵Seth Cantrell2012-04-171-440/+160
| | | | | | | | | | | | non-ascii text" This reverts commit e9a3b76ba589a8a884e978273beaed0d97cf9861. Revert "fix display of source lines with null characters" This reverts commit 70712b276e40bbe11e5063dfc7e82ce3209929cd. llvm-svn: 154950
* fix display of source lines with null charactersSeth Cantrell2012-04-171-2/+5
| | | | llvm-svn: 154947
* Nicer display of unprintable source, and fix caret display for non-ascii textSeth Cantrell2012-04-171-158/+435
| | | | | | | | | | | | | Unprintable source in diagnostics is transformed to a printable form and then displayed with reversed colors if possible. Unprintable characters are displayed as <U+NNNN> while bytes that do not represent valid characters are shown as <XX>. Column adjustments to diagnostic carets, highlighted ranges, and fixups are made both for characters escaped as above and for characters which are printable but take up more than a single column. llvm-svn: 154946
* Refactor DiagnosticRenderer and SDiagsRenderer to have some functionalityTed Kremenek2012-02-141-1/+1
| | | | | | | | | pulled into DiagnosticNoteRenderer, and common DiagnosticRenderer that assumes that all custom diagnostic messages are notes. Also extend DiagnosticRenderer to work with StoredDiagnostics in preparation for subsequent changes. llvm-svn: 150455
* Basic: import SmallString<> into clang namespaceDylan Noblesmith2012-02-051-2/+2
| | | | | | | (I was going to fix the TODO about DenseMap too, but that would break self-host right now. See PR11922.) llvm-svn: 149799
* Refactor 'TextDiagnostic' to have a parent class 'DiagnosticRenderer' which ↵Ted Kremenek2011-12-171-260/+24
| | | | | | | | | | | | handles the policy of how diagnostics are lowered/rendered, while TextDiagnostic handles the actual pretty-printing. This is a first part of reworking SerializedDiagnosticPrinter to use the same inclusion-stack/macro-expansion logic as TextDiagnostic. llvm-svn: 146819
* Switch to a more natural formatting of the macro name printing.Chandler Carruth2011-10-241-2/+2
| | | | | | Suggested by John McCall. llvm-svn: 142836
* Hoist the logic I added to compute the macro name into a helperChandler Carruth2011-10-161-16/+30
| | | | | | function. No functionality changed. llvm-svn: 142128
* Now that macro expansion notes are real notes and go through the sameChandler Carruth2011-10-161-2/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | formatting as any other diagnostic, they will be properly line wrapped and otherwise pretty printed. Let's take advantage of that and the new factoring to add some helpful information to them (much like template backtrace notes and other notes): the name of the macro whose expansion is being noted. This makes a world of difference if caret diagnostics are disabled, making the expansion notes actually useful in this case. It also helps ensure that in edge cases the information the user needs is present. Consider: % nl -ba t5.cc 1 #define M(x, y, z) \ 2 y 3 4 M( 5 1, 6 2, 7 3); We now produce: % ./bin/clang -fsyntax-only t5.cc t5.cc:6:3: error: expected unqualified-id 2, ^ t5.cc:2:3: note: expanded from macro: M y ^ 1 error generated. Without the added information in the note, the name of the macro being expanded would never be shown. This also deletes a FIXME to use the diagnostic formatting. It's not yet clear to me that we *can* do this reasonably, and the production of this message was my primary goal here anyways. I'd love any comments or suggestions on improving these notes, their wording, etc. Currently, I need to make them provide more helpful information in the presence of a token-pasting buffer, and I'm pondering adding something along the lines of "expanded from argument N of macro: ...". llvm-svn: 142127
* Fix the original bug in our diagnostic printing that got me started onChandler Carruth2011-10-161-29/+12
| | | | | | | | | | | | | this long quest: actually use the note printing machinery for each macro expansion note rather than a hacky version of it. This will colorize and format the notes the same as any other. There is still some stuff to fix here, but it's one step closer. No test case changes because currently we don't do anything differently that I can FileCheck for -- I don't really want to try matching the color escape codes... Suggestions for how to test this are welcome. =] llvm-svn: 142121
* Now that the structure of this is more reasonably laid out, fix a longChandler Carruth2011-10-161-27/+35
| | | | | | | | | | | | | | | standing deficiency: we were providing no macro backtrace information whenever caret diagnostics were turned off. This sinks the logic for suppressing the code snippet and caret to the code that actually prints tho code snippet and caret. Along the way, clean up the naming of functions, remove some now fixed FIXMEs, and generally improve the wording and logic of this process. Add a test case exerecising this functionality. It is notable that the resulting messages are extremely low quality. I'm working on a follow-up patch that should address this and have left a FIXME in the test case. llvm-svn: 142120
* Add proper doxyments to the entry point routine, and remove a dead parameter.Chandler Carruth2011-10-161-2/+1
| | | | llvm-svn: 142109
* Persist the TextDiagnostic object across multiple diagnostics as long asChandler Carruth2011-10-161-11/+3
| | | | | | | | | 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. llvm-svn: 142104
* Clean up the names of all the TextDiagnostic methods (and even a staticChandler Carruth2011-10-151-23/+25
| | | | | | | function) to agree with the coding conventions, and in one case have a bit more information in it. llvm-svn: 142088
* Move two functions out of the public interface that shouldn't have everChandler Carruth2011-10-151-206/+206
| | | | | | | | | | been there. Also delete their redundant doxyments in favor of those in the source file. I'm putting the doxyments for private and static helpers into the implementation file, and only the public interface doxyments into the header. If folks have strong opinions about this type of split, feel free to chime in, I'm happy to re-organize. llvm-svn: 142087
* Graduate the TextDiagnostic interface to its own header and source file,Chandler Carruth2011-10-151-0/+1098
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. llvm-svn: 142086
OpenPOWER on IntegriCloud