summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/TextDiagnostic.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix buffer underrun (invalid read) triggered during diagnostic rendering. ↵Ted Kremenek2013-03-151-1/+1
| | | | | | | | | | | | | The test would overflow when computing '0 - 1'. I don't have a good testcase for this that does not depend on system headers. It did not trigger with preprocessed output, and I had trouble reducing the example. Fixes <rdar://problem/13324594>. Thanks to Michael Greiner for reporting this issue. llvm-svn: 177201
* Excise <cctype> from Clang (except clang-tblgen) in favor of CharInfo.h.Jordan Rose2013-02-081-15/+12
| | | | | | | Nearly all of these changes are one-to-one replacements; the few that aren't have to do with custom identifier validation. llvm-svn: 174768
* TextDiagnostic.cpp: Suppress a warning to use ptrdiff_t on i686-clang. ↵NAKAMURA Takumi2013-02-051-1/+1
| | | | | | [-Wsign-compare] llvm-svn: 174353
* Diagnostics: Clarify name of line-length-limiting constant in r173976.Jordan Rose2013-01-301-3/+3
| | | | | | Thanks, Sean. llvm-svn: 173981
* Diagnostics: if a line is longer than 4096 characters, don't print it.Jordan Rose2013-01-301-1/+9
| | | | | | | | | | | | | Specifically, don't print snippets, caret diagnostics, or ranges for lines over 4096 characters. We copy the line around a few times in our diagnostics machinery, and we have to print a caret line that's just as long. This uses a lot of memory just to create a poor user experience as we print out a line much too long for anyone to read...or spend extra energy trying to fit it to -fmessage-length. <rdar://problem/13106850> llvm-svn: 173976
* Move UTF conversion routines from clang/lib/Basic to llvm/lib/SupportDmitri Gribenko2013-01-301-1/+1
| | | | | | This is required to use them in TableGen. llvm-svn: 173924
* Be defensive when printing module import locations; the diagnostic printer ↵Douglas Gregor2012-12-181-1/+1
| | | | | | needs to be robust llvm-svn: 170466
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-041-6/+6
| | | | | | | | | | | | | uncovered. This required manually correcting all of the incorrect main-module headers I could find, and running the new llvm/utils/sort_includes.py script over the files. I also manually added quite a few missing headers that were uncovered by shuffling the order or moving headers up to be main-module-headers. llvm-svn: 169237
* Make helper classes anonymous. Make helper functions static instead of ↵Benjamin Kramer2012-12-011-155/+156
| | | | | | | | private members so the anonymous class doesn't leak out. No functionality change. llvm-svn: 169099
* When we're emitting a diagnostic with a source location in an importedDouglas Gregor2012-11-301-0/+10
| | | | | | | | | | | | | | module, provide a module import stack similar to what we would get for an include stack, e.g., In module 'DependsOnModule' imported from build-fail-notes.m:4: In module 'Module' imported from DependsOnModule.framework/Headers/DependsOnModule.h:1: Inputs/Module.framework/Headers/Module.h:15:12: note: previous definition is here @interface Module <rdar://problem/12696425> llvm-svn: 169042
* 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
OpenPOWER on IntegriCloud