summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/TextDiagnosticPrinter.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Rename DiagnosticInfo to Diagnostic as per issue 5397David Blaikie2011-09-261-4/+4
| | | | llvm-svn: 140493
* Delete an extraneous line I missed.Chandler Carruth2011-09-261-1/+0
| | | | llvm-svn: 140491
* A direct extraction of the rest of the option printing into a helper.Chandler Carruth2011-09-261-51/+57
| | | | | | This needs to be cleaned up to better use the ostream object, WIP. llvm-svn: 140490
* Start a more correct pattern for factoring out the name printing. SlowlyChandler Carruth2011-09-261-7/+10
| | | | | | | I'm planning to switch a bunch of these over to use a raw_ostream instead of += on a string object. llvm-svn: 140488
* Revert r140484. That was *not* ready to be committed! Only halfway done,Chandler Carruth2011-09-261-39/+34
| | | | | | | | and completely broken at that. Sorry, must remember to stash rather than commit. =] llvm-svn: 140487
* Fix a formatting goof.Chandler Carruth2011-09-261-1/+1
| | | | llvm-svn: 140486
* Extract the diagnostic message formatting into a helper routine.Chandler Carruth2011-09-261-34/+39
| | | | llvm-svn: 140484
* Extract the logic for printing a colorful level name into a helperChandler Carruth2011-09-251-21/+28
| | | | | | function. llvm-svn: 140481
* Rename DiagnosticClient to DiagnosticConsumer as per issue 5397David Blaikie2011-09-251-1/+1
| | | | llvm-svn: 140479
* Rename Diagnostic to DiagnosticsEngine as per issue 5397David Blaikie2011-09-251-21/+22
| | | | llvm-svn: 140478
* Inline this method now that its completely trivial, and prepare forChandler Carruth2011-09-251-18/+9
| | | | | | hoisting parts of the text diagnostic. llvm-svn: 140477
* Shuffle some names around. 'CaretDiagnostic' is inaccurate as this needsChandler Carruth2011-09-251-18/+21
| | | | | | | 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. llvm-svn: 140476
* Actually remove the members of CaretDiagnostic no longer in use forChandler Carruth2011-09-251-10/+6
| | | | | | | | 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. llvm-svn: 140475
* Sink the logic for suppressing some macro expansion notes from theChandler Carruth2011-09-251-41/+29
| | | | | | | | | | | | | | | | 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. llvm-svn: 140474
* Split the recursive macro expansion walk out from the routine whichChandler Carruth2011-09-251-58/+71
| | | | | | emits a source snippet and caret line. llvm-svn: 140467
* More missing header inclusions from llvm_unreachable migration.David Blaikie2011-09-231-0/+1
| | | | llvm-svn: 140369
* Switch assert(0/false) llvm_unreachable.David Blaikie2011-09-231-2/+2
| | | | llvm-svn: 140367
* Extract the emission of the diagnostic's location into a separateChandler Carruth2011-09-071-103/+118
| | | | | | | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 139228
* Move the HilightRange method from TextDiagnosticPrinter down toChandler Carruth2011-09-071-81/+79
| | | | | | | CaretDiagnostic. It's completely generic, with nothing to do with the diagnostic client or info APIs. llvm-svn: 139227
* Hoist the tab expansion into a helper function.Chandler Carruth2011-09-071-21/+25
| | | | llvm-svn: 139226
* Don't compute the same line number in two places, once inside a loop.Chandler Carruth2011-09-071-12/+8
| | | | llvm-svn: 139225
* Switch the CharSourceRange array to a small vector. The array wasChandler Carruth2011-09-071-39/+34
| | | | | | | | | | | | 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. llvm-svn: 139217
* Remove the doxyment for this now defunct parameter.Chandler Carruth2011-09-061-1/+0
| | | | llvm-svn: 139197
* Don't recompute the presumed loc twice in 5 lines of code... Spotted byChandler Carruth2011-09-061-1/+1
| | | | | | inspection. llvm-svn: 139196
* Use ArrayRef for the fixit hint array rather than a pointer and a size.Chandler Carruth2011-09-061-35/+34
| | | | | | | Clean up loops over the hints to use the more idiomatic iterator form in LLVM and Clang. llvm-svn: 139195
* Hoist the construction of the FixItHint line into a member function withChandler Carruth2011-09-061-64/+79
| | | | | | | | | | | | 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. llvm-svn: 139190
* Hoist the emission of parseable fixits into a helper method, simplifyingChandler Carruth2011-09-021-38/+38
| | | | | | and reducing indentation through the clever use of early exits. ;] llvm-svn: 139001
* Create a CaretDiagnostic class to hold the logic for emittingChandler Carruth2011-08-311-263/+331
| | | | | | | | | | | | | | (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. llvm-svn: 138921
* Sink all of the include stack printing logic into its member function.Chandler Carruth2011-08-311-18/+39
| | | | llvm-svn: 138920
* Rename SourceManager (and InstantiationInfo) isMacroArgInstantiation APIChandler Carruth2011-07-261-3/+3
| | | | | | to isMacroArgExpansion. llvm-svn: 136053
* Rename getInstantiationLineNumber to getExpansionLineNumber in bothChandler Carruth2011-07-251-2/+2
| | | | | | SourceManager and FullSourceLoc. llvm-svn: 135969
* Rename getInstantiationColumnNumber to getExpansionColumnNumber in bothChandler Carruth2011-07-251-2/+2
| | | | | | SourceManager and FullSourceLoc. llvm-svn: 135965
* Rename getDecomposedInstantiationLoc to getDecomposedExpansionLoc.Chandler Carruth2011-07-251-1/+1
| | | | llvm-svn: 135962
* Rename SourceManager::getImmediateInstantiationRange toChandler Carruth2011-07-251-2/+2
| | | | | | getImmediateExpansionRange. llvm-svn: 135960
* Rename SourceManager::getInstantiationRange to getExpansionRange.Chandler Carruth2011-07-251-2/+2
| | | | llvm-svn: 135915
* Mechanically rename SourceManager::getInstantiationLoc andChandler Carruth2011-07-251-5/+5
| | | | | | | | FullSourceLoc::getInstantiationLoc to ...::getExpansionLoc. This is part of the API and documentation update from 'instantiation' as the term for macros to 'expansion'. llvm-svn: 135914
* remove unneeded llvm:: namespace qualifiers on some core types now that ↵Chris Lattner2011-07-231-18/+18
| | | | | | | | LLVM.h imports them into the clang namespace. llvm-svn: 135852
* Switch all local code and comments from '[Ii]nstantiat(ion|ed)' toChandler Carruth2011-07-141-14/+14
| | | | | | | | '[Ee]xpan(sion|ded)' in the TextDiagnosticPrinter. No functionality changed. llvm-svn: 135136
* Switch the diagnostic messages about macros to use the terms 'expanded'Chandler Carruth2011-07-141-2/+2
| | | | | | | | | and 'expansions' rather than 'instantiated' and 'contexts'. This is the first of several patches migrating Clang's terminology surrounding macros from 'instantiation' to 'expansion'. llvm-svn: 135135
* Keep track of which source locations are part of a macro argumentChandler Carruth2011-07-071-13/+83
| | | | | | | | | | | | | | | | | | | | 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. llvm-svn: 134660
* Fix PR9279 - Macro expansion stack trace seriously broken with ↵Chris Lattner2011-06-281-7/+9
| | | | | | | | | | | | | | 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. llvm-svn: 133993
* In TextDiagnosticPrinter::EmitCaretDiagnostic, don't always drop fixits if ↵Argyrios Kyrtzidis2011-06-241-2/+3
| | | | | | | | the caret location points to a macro instantiation. llvm-svn: 133802
* Change the include stack of "instantiated from" notes to fall under the ↵Richard Trieu2011-05-261-1/+1
| | | | | | control of f/fno-diagnostics-show-note-include-stack flags. This should help with reducing diagnostic spew from macros instantiations. llvm-svn: 132143
* A StringRef-ication of the DiagnosticIDs API and internals.Argyrios Kyrtzidis2011-05-251-2/+2
| | | | | | | | | 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. llvm-svn: 132047
* Introduce the -fdiagnostics-format=xxx option to control how ClangDouglas Gregor2011-05-211-9/+21
| | | | | | | | | | | | 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! llvm-svn: 131794
* Initial work to improve documentation for Clang's diagnostics, from Matthieu ↵Douglas Gregor2011-04-151-0/+7
| | | | | | Monrocq llvm-svn: 129614
* Remove a redundant isValid() checkMatt Beaumont-Gay2011-03-311-1/+1
| | | | llvm-svn: 128606
* Add an option to suppress include stack printing on note diagnostics.Chandler Carruth2011-03-271-10/+15
| | | | | | | | | | | | | | | | | | 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. llvm-svn: 128371
* Teach TextDiagnosticPrinter to print out '-Werror' in addition to the ↵Ted Kremenek2011-02-251-1/+13
| | | | | | | | | | 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] llvm-svn: 126466
* TextDiagnosticPrinter.cpp: Show diagnostics as far as possible even with ↵Axel Naumann2011-01-271-71/+89
| | | | | | | | | | | | | | 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. llvm-svn: 124374
OpenPOWER on IntegriCloud