summaryrefslogtreecommitdiffstats
path: root/clang/lib/Basic/Diagnostic.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* implement framework for -fdiagnostics-show-option, but tblgen isn'tChris Lattner2009-04-161-0/+7
| | | | | | passing down the right info yet. llvm-svn: 69268
* move handling of -pedantic and -pedantic-errors into Diagnostics,Chris Lattner2009-04-161-3/+20
| | | | | | | out of Warnings.cpp. This simplifies warnings.cpp and makes it more efficient. llvm-svn: 69266
* arrange for -Wno-error=foo warnings to be immune to -Werror as Chris Lattner2009-04-161-1/+14
| | | | | | they are supposed to be. llvm-svn: 69265
* change mappings to distinguish between "unset", "set by the user" and Chris Lattner2009-04-161-7/+23
| | | | | | "set to the default value". llvm-svn: 69264
* fix some out of bounds array access problems, which manifest particularlyChris Lattner2009-04-151-18/+37
| | | | | | spectacularly when built for x86-64. llvm-svn: 69197
* move {'sChris Lattner2009-04-151-6/+3
| | | | llvm-svn: 69179
* Make diagnostic class explicit in the diag record instead ofChris Lattner2009-04-151-16/+14
| | | | | | | implicit from its parenting. Now that diag mapping is explicit, eliminate the fatal and extwarn classes. llvm-svn: 69177
* Tblgen now passes the default mapping explicitly, instead of having it Chris Lattner2009-04-151-20/+3
| | | | | | be tied to the diag class. This requires an LLVM tree update. llvm-svn: 69175
* Rejigger how -pedantic and -pedantic-errors work and their interactionChris Lattner2009-04-151-58/+107
| | | | | | | | | | | | | | | | with other diagnostic mapping. In the new scheme, -Wfoo or -Wno-foo or -Werror=foo all override the -pedantic options, and __extension__ robustly silences all extension diagnostics in their scope. An added bonus of this change is that MAP_DEFAULT goes away, meaning that per-diagnostic mapping information can now be stored in 2 bits, doubling the density of the Diagnostic::DiagMapping array. This also substantially simplifies Diagnostic::getDiagnosticLevel. OTOH, this temporarily introduces some "macro intensive" code in Diagnostic.cpp. This will be addressed in a later patch. llvm-svn: 69154
* Eliminate post-diagnostic hooks. Instead, implement a Sema-specificDouglas Gregor2009-03-201-10/+0
| | | | | | | variant of DiagnosticBuilder that emits the template instantiation backtrace when needed. llvm-svn: 67413
* Bindir and Win32 builds work, so switch to .inc files. Leave the .def files ↵Sebastian Redl2009-03-191-16/+16
| | | | | | in the tree for a day or so longer. llvm-svn: 67346
* Allow notes to be printed following a fatal error, then suppress anyDouglas Gregor2009-03-191-12/+17
| | | | | | | | | | diagnostics following those notes. Make exceeding the template instantiation depth a fatal error. Thanks to Daniel for pointing out the problem! llvm-svn: 67320
* Revert the switch to the tablegen diags. It fails for seperate objdir builds ↵Sebastian Redl2009-03-141-16/+16
| | | | | | and cmake builds, and I have no clue what to do about it. Revisit this after someone with a clue about the build systems has looked at it. llvm-svn: 67009
* Switch diagnostics from .def to tablegen files. Please validate the Windows ↵Sebastian Redl2009-03-141-16/+16
| | | | | | build. llvm-svn: 67007
* Add Diagnostic files for Frontend and move a couple errors over.Daniel Dunbar2009-03-121-2/+14
| | | | | | | - Notably, clang now exits with an error if it can't find a file. This flushed out a bug in the CGColorSpace.c test case. :) llvm-svn: 66789
* Driver: Use standard Diagnostic interface for diagnostics.Daniel Dunbar2009-03-121-2/+14
| | | | llvm-svn: 66786
* Add a notion of "post-diagnostic hooks", which are callbacks attachedDouglas Gregor2009-03-101-0/+18
| | | | | | | | | | | | | | | | | to a diagnostic that will be invoked after the diagnostic (if it is not suppressed). The hooks are allowed to produce additional diagnostics (typically notes) that provide more information. We should be able to use this to help diagnostic clients link notes back to the diagnostic they clarify. Comments welcome; I'll write up documentation and convert other clients (e.g., overload resolution failures) if there are no screams of protest. As the first client of post-diagnostic hooks, we now produce a template instantiation backtrace when a failure occurs during template instantiation. There's still more work to do to make this output pretty, if that's even possible. llvm-svn: 66557
* Revert my last couple patches until I can get them to not make the tests fail.Ted Kremenek2009-03-071-8/+0
| | | | llvm-svn: 66317
* Teach Diagnostic about Selector.Ted Kremenek2009-03-071-0/+8
| | | | llvm-svn: 66314
* replace a dirty hack with a clean solution. Too bad we can't Chris Lattner2009-02-191-1/+3
| | | | | | use Blocks for our callbacks ;-) llvm-svn: 65083
* Fix a long standard problem with clang retaining "too much" sugar Chris Lattner2009-02-191-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | information about types. We often print diagnostics where we say "foo_t" is bad, but the user doesn't know how foo_t is declared (because it is a typedef). Fix this by expanding sugar when present in a diagnostic (and not one of a few special cases, like vectors). Before: t.m:5:2: error: invalid operands to binary expression ('typeof(P)' and 'typeof(F)') MAX(P, F); ^~~~~~~~~ t.m:1:78: note: instantiated from: #define MAX(A,B) ({ __typeof__(A) __a = (A); __typeof__(B) __b = (B); __a < __b ? __b : __a; }) ^ After: t.m:5:2: error: invalid operands to binary expression ('typeof(P)' (aka 'struct mystruct') and 'typeof(F)' (aka 'float')) MAX(P, F); ^~~~~~~~~ t.m:1:78: note: instantiated from: #define MAX(A,B) ({ __typeof__(A) __a = (A); __typeof__(B) __b = (B); __a < __b ? __b : __a; }) ^ llvm-svn: 65081
* fix a minor bug with my previous patchChris Lattner2009-02-171-1/+3
| | | | llvm-svn: 64747
* fix notes so that they are always filtered with the same logic Chris Lattner2009-02-171-45/+79
| | | | | | | | | as the last non-note diagnostic that preceeded them. This ensures that diagnostics in main files which have notes with locations in system headers get all the bits and pieces emitted or not in a unit. This fixes PR3215. llvm-svn: 64746
* don't emit any diagnostics after a fatal one.Chris Lattner2009-02-061-1/+9
| | | | llvm-svn: 63914
* add support to the diagnostics machinery for mapping warnings andChris Lattner2009-02-051-0/+5
| | | | | | errors to 'fatal' error severity. llvm-svn: 63894
* Some name-lookup-related fixes, from Piotr Rak!Douglas Gregor2009-02-041-0/+1
| | | | | | | | | | | | | - Changes Lookup*Name functions to return NamedDecls, instead of Decls. Unfortunately my recent statement that it will simplify lot of code, was not quite right, but it simplifies some... - Makes MergeLookupResult SmallPtrSet instead of vector, following Douglas suggestions. - Adds %qN format for printing qualified names to Diagnostic. - Avoids searching for using-directives in Scopes, which are not DeclScope, during unqualified name lookup. llvm-svn: 63739
* next round of diagnostics cleanups, moving some Chris Lattner2009-01-291-26/+26
| | | | | | | diags around, eliminating #defines, etc. Patch by Anders Johnsen! llvm-svn: 63318
* Fix -Wimplicit-function-declaration, which required some refactoring andChris Lattner2009-01-291-27/+10
| | | | | | changes in various diagnostics code. llvm-svn: 63282
* Split the single monolithic DiagnosticKinds.def file into oneChris Lattner2009-01-271-8/+91
| | | | | | | | | .def file for each library. This means that adding a diagnostic to sema doesn't require all the other libraries to be rebuilt. Patch by Anders Johnsen! llvm-svn: 63111
* Added virtual method DiagnosticClient::IncludeInDiagnosticCounts(). This is ↵Ted Kremenek2009-01-231-1/+7
| | | | | | | | used by Diagnostics to determine if a diagnostic sent to a given DiagnosticClient should be included in the count of diagnostics. The default implementation of this method returns 'true'. Implemented DiagCollector::IncludeInDiagnosticCounts() to return 'false' so that the batching of diagnostics for use with BugReporter doesn't mess up the count of real diagnostics. llvm-svn: 62873
* Change some terminology in SourceLocation: instead of referring to Chris Lattner2009-01-161-1/+1
| | | | | | | the "physical" location of tokens, refer to the "spelling" location. This is more concrete and useful, tokens aren't really physical objects! llvm-svn: 62309
* Fix order of evaluation.Sebastian Redl2008-11-271-1/+1
| | | | llvm-svn: 60160
* Convert IdentifierInfo's to be printed the same as DeclarationNames Chris Lattner2008-11-231-6/+11
| | | | | | | | | | | | | | | | | | | | | with implicit quotes around them. This has a bunch of follow-on effects and requires tweaking to a whole lot of code. This causes a regression in two tests (xfailed) by causing it to emit things like: Line 10: duplicate interface declaration for category 'MyClass1' ('Category1') instead of: Line 10: duplicate interface declaration for category 'MyClass1(Category1)' I will fix this in a follow-up commit. As part of this, I had to start switching stuff to use ->getDeclName() instead of Decl::getName() for consistency. This is good, but I was planning to do this as an independent patch. There will be several follow-on patches to clean up some of the mess, but this patch is already too big. llvm-svn: 59917
* add support for inserting a DeclarationName into a diagnostic directlyChris Lattner2008-11-231-0/+1
| | | | | | | without calling getAsString(). This implicitly puts quotes around the name, so diagnostics need to be tweaked to accommodate this. llvm-svn: 59916
* Genericize the qualtype formating callback to support any diag argument.Chris Lattner2008-11-231-8/+9
| | | | | | No functionality change. llvm-svn: 59908
* Add support for sending QualType's directly into diags and convert twoChris Lattner2008-11-231-8/+25
| | | | | | | | | | diags over to use this. QualTypes implicitly print single quotes around them for uniformity and future extension. Doing this requires a little function pointer dance to prevent libbasic from depending on libast. llvm-svn: 59907
* Implement a %plural modifier for complex plural forms in diagnostics. Use it ↵Sebastian Redl2008-11-221-0/+126
| | | | | | in the overload diagnostics. llvm-svn: 59871
* Split the DiagnosticInfo class into two disjoint classes:Chris Lattner2008-11-221-7/+9
| | | | | | | | | | one for building up the diagnostic that is in flight (DiagnosticBuilder) and one for pulling structured information out of the diagnostic when formatting and presenting it. There is no functionality change with this patch. llvm-svn: 59849
* Add the concept of "modifiers" to the clang diagnostic format Chris Lattner2008-11-211-25/+121
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | strings. This allows us to have considerable flexibility in how these things are displayed and provides extra information that allows us to merge away diagnostics that are very similar. Diagnostic modifiers are a string of characters with the regex [-a-z]+ that occur between the % and digit. They may optionally have an argument that can parameterize them. For now, I've added two example modifiers. One is a very useful tool that allows you to factor commonality across diagnostics that need single words or phrases combined. Basically you can use %select{a|b|c}4 with with an integer argument that selects either a/b/c based on an integer value in the range [0..3). The second modifier is also an integer modifier, aimed to help English diagnostics handle plurality. "%s3" prints to 's' if integer argument #3 is not 1, otherwise it prints to nothing. I'm fully aware that 's' is an English concept and doesn't apply to all situations (mouse vs mice). However, this is very useful and we can add other crazy modifiers once we add support for polish! ;-) I converted a couple C++ diagnostics over to use this as an example, I'd appreciate it if others could merge the other likely candiates. If you have other modifiers that you want, lets talk on cfe-dev. llvm-svn: 59803
* Allow sending IdentifierInfo*'s into Diagnostics without turning them into ↵Chris Lattner2008-11-191-0/+6
| | | | | | | | strings first. This should allow removal of a bunch of II->getName() calls. llvm-svn: 59601
* add direct support for signed and unsigned integer arguments to diagnostics.Chris Lattner2008-11-191-0/+13
| | | | llvm-svn: 59598
* rewrite FormatDiagnostic to be less gross and a lot more efficient.Chris Lattner2008-11-191-14/+35
| | | | | | | This also makes it illegal to have bare '%'s in diagnostics. If you want a % in a diagnostic, use %%. llvm-svn: 59596
* implement a transparent optimization with the diagnostics stuff:Chris Lattner2008-11-191-1/+2
| | | | | | | | | | const char*'s are now not converted to std::strings when the diagnostic is formed, we just hold onto their pointer and format as needed. This commit makes DiagnosticClient::FormatDiagnostic even more of a mess, I'll fix it in the next commit. llvm-svn: 59593
* This reworks some of the Diagnostic interfaces a bit to change how diagnosticsChris Lattner2008-11-181-33/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-3/+3
| | | | | | | | 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
* Fix PR3077: tokens that come from macro expansions whose macro wasChris Lattner2008-11-161-1/+1
| | | | | | | defined in a system header should be treated as system header tokens even if they are instantiated in a different place. llvm-svn: 59418
* fix rdar://6288301: custom warnings don't respect -Werror.Chris Lattner2008-10-171-2/+8
| | | | llvm-svn: 57731
* Add --suppress-system-warnings (on by default, use =0 to disable)Daniel Dunbar2008-09-121-1/+3
| | | | | | | | | - For investigating warnings in system headers / builtins. - Currently also enables the behavior that allows silent redefinition of types in system headers. Conceptually these are separate but I didn't feel it was worth two options (or changing LangOptions). llvm-svn: 56163
* * Remove isInSystemHeader() from DiagClient, move it to SourceManagerNico Weber2008-08-101-17/+38
| | | | | | | | | | | | | | | | * 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
* Fix --html-diags in driver by delaying the construction of an ↵Ted Kremenek2008-08-071-5/+5
| | | | | | HTMLDiagnosticClient until after we have created the Preprocessor object. llvm-svn: 54472
OpenPOWER on IntegriCloud