summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/PathDiagnostic.cpp
Commit message (Collapse)AuthorAgeFilesLines
* PathDiagnosticPiece now automatically strips off trailing periods in ↵Ted Kremenek2009-02-261-0/+27
| | | | | | diagnostic messages. llvm-svn: 65574
* Introduce code modification hints into the diagnostics system. When weDouglas Gregor2009-02-261-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | know how to recover from an error, we can attach a hint to the diagnostic that states how to modify the code, which can be one of: - Insert some new code (a text string) at a particular source location - Remove the code within a given range - Replace the code within a given range with some new code (a text string) Right now, we use these hints to annotate diagnostic information. For example, if one uses the '>>' in a template argument in C++98, as in this code: template<int I> class B { }; B<1000 >> 2> *b1; we'll warn that the behavior will change in C++0x. The fix is to insert parenthese, so we use code insertion annotations to illustrate where the parentheses go: test.cpp:10:10: warning: use of right-shift operator ('>>') in template argument will require parentheses in C++0x B<1000 >> 2> *b1; ^ ( ) Use of these annotations is partially implemented for HTML diagnostics, but it's not (yet) producing valid HTML, which may be related to PR2386, so it has been #if 0'd out. In this future, we could consider hooking this mechanism up to the rewriter to actually try to fix these problems during compilation (or, after a compilation whose only errors have fixes). For now, however, I suggest that we use these code modification hints whenever we can, so that we get better diagnostics now and will have better coverage when we find better ways to use this information. This also fixes PR3410 by placing the complaint about missing tokens just after the previous token (rather than at the location of the next token). llvm-svn: 65570
* Ensure that we assert if given an unhandled value.Mike Stump2009-02-071-0/+1
| | | | llvm-svn: 64004
* handle fatal errors, rely on warnings to point out missing cases.Chris Lattner2009-02-061-1/+2
| | | | llvm-svn: 63913
* remove a dead enumChris Lattner2008-11-221-1/+0
| | | | llvm-svn: 59879
* rewrite FormatDiagnostic to be less gross and a lot more efficient.Chris Lattner2008-11-191-3/+6
| | | | | | | This also makes it illegal to have bare '%'s in diagnostics. If you want a % in a diagnostic, use %%. llvm-svn: 59596
* This reworks some of the Diagnostic interfaces a bit to change how diagnosticsChris Lattner2008-11-181-16/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | are formed. In particular, a diagnostic with all its strings and ranges is now packaged up and sent to DiagnosticClients as a DiagnosticInfo instead of as a ton of random stuff. This has the benefit of simplifying the interface, making it more extensible, and allowing us to do more checking for things like access past the end of the various arrays passed in. In addition to introducing DiagnosticInfo, this also substantially changes how Diagnostic::Report works. Instead of being passed in all of the info required to issue a diagnostic, Report now takes only the required info (a location and ID) and returns a fresh DiagnosticInfo *by value*. The caller is then free to stuff strings and ranges into the DiagnosticInfo with the << operator. When the dtor runs on the DiagnosticInfo object (which should happen at the end of the statement), the diagnostic is actually emitted with all of the accumulated information. This is a somewhat tricky dance, but it means that the accumulated DiagnosticInfo is allowed to keep pointers to other expression temporaries without those pointers getting invalidated. This is just the minimal change to get this stuff working, but this will allow us to eliminate the zillions of variant "Diag" methods scattered throughout (e.g.) sema. For example, instead of calling: Diag(BuiltinLoc, diag::err_overload_no_match, typeNames, SourceRange(BuiltinLoc, RParenLoc)); We will soon be able to just do: Diag(BuiltinLoc, diag::err_overload_no_match) << typeNames << SourceRange(BuiltinLoc, RParenLoc)); This scales better to support arbitrary types being passed in (not just strings) in a type-safe way. Go operator overloading?! llvm-svn: 59502
* Change the diagnostics interface to take an array of pointers to Chris Lattner2008-11-181-1/+1
| | | | | | | | strings instead of array of strings. This reduces string copying in some not-very-important cases, but paves the way for future improvements. llvm-svn: 59494
* cleanups and simplifications.Chris Lattner2008-11-181-11/+7
| | | | llvm-svn: 59491
* * Remove isInSystemHeader() from DiagClient, move it to SourceManagerNico Weber2008-08-101-13/+1
| | | | | | | | | | | | | | | | * Move FormatError() from TextDiagnostic up to DiagClient, remove now empty class TextDiagnostic * Make DiagClient optional for Diagnostic This fixes the following problems: * -html-diags (and probably others) does now output the same set of warnings as console clang does * nothing crashes if one forgets to call setHeaderSearch() on TextDiagnostic * some code duplication is removed llvm-svn: 54620
* PathDiagnosticClients now retain ownership of passed PathDiagnostics, requiringTed Kremenek2008-04-221-2/+2
| | | | | | | | | | them to not be stack-allocated. HTMLDiagnostics now batches PathDiagnostics before emitting HTML in its dtor. This is a workaround for a problem when we trampled the Preprocessor state when highlighting macros (sometimes resulting in an assertion failure). llvm-svn: 50102
* PathDiagnosticPiece no longer contains a vector of strings; just one string.Ted Kremenek2008-03-271-7/+29
| | | | | | PathDiagnostic no longer contains a diagnostic ID or diagnostic level. llvm-svn: 48864
* Added classes "PathDiagnosticPiece", "PathDiagnostic", and ↵Ted Kremenek2008-03-271-0/+52
"PathDiagnosticClient", which encapsulate diagnostic reporting for paths. llvm-svn: 48861
OpenPOWER on IntegriCloud