summaryrefslogtreecommitdiffstats
path: root/clang/lib/Basic/Diagnostic.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Basic/Diagnostics: Apparently, #pragma ... diagnostic is intended to overrideDaniel Dunbar2011-10-041-0/+7
| | | | | | | | the command line options (at least according to GCC's documentation). GCC 4.2 didn't appear to actually do this, but it seems like that has been fixed in later release, so we will follow the docs. llvm-svn: 141119
* Basic/Diagnostic: Kill off a few unnecessary functions now that refactoring ↵Daniel Dunbar2011-09-291-1/+1
| | | | | | is done, and add a note that the new setDiagnosticGroup{...} methods only operate on the current diagnostic state. llvm-svn: 140771
* Basic/Diagnostics: Rewrite DiagnosticIDs::getDiagnosticLevel completely to ↵Daniel Dunbar2011-09-291-2/+7
| | | | | | | | be straighter line code, use the new DiagnosticMappingInfo flags, and eliminate the odd MAP_WARNING_NO_WERROR and friend mappings. - This fixes a host of obscure bugs with regards to how warning mapping options composed with one another, and I believe makes the code substantially easier to read and reason about. llvm-svn: 140770
* Basic/Diagnostics: Add three explicit bits to DiagnosticMappingInfo to track ↵Daniel Dunbar2011-09-291-4/+46
| | | | | | | | "no-warning-as-error", "no-error-as-fatal", and "show-in-system-header", and update DiagnosticsEngine::setDiagnosticGroup{WarningAsError,ErrorAsFatal} and GetDefaultDiagMappingInfo to set them appropriately. - No actual functionality change for now, we still also use the diag::Mapping::{MAP_WARNING_NO_ERROR,MAP_ERROR_NO_FATAL,MAP_WARNING_SHOW_IN_SYSTEM_HEADER} for a little while longer. llvm-svn: 140768
* Basic/Diagnostics: Add a DiagnosticIDs::getDiagnosticsInGroup method, and useDaniel Dunbar2011-09-291-0/+15
| | | | | | | that in DiagnosticEngine instead of the convoluted calling into DiagnosticIDs which then calls back into the DiagnosticsEngine. llvm-svn: 140766
* Basic/Diagnostics: Move setDiagnosticMapping() to using DiagnosticMappingInfoDaniel Dunbar2011-09-291-5/+7
| | | | | | and eliminate setDiagnosticMappingInternal. llvm-svn: 140763
* Basic/Diagnostic: Factor outDaniel Dunbar2011-09-291-0/+12
| | | | | | | | | DiagnosticsEngine::setDiagnosticGroup{ErrorAsFatal,WarningAsError} methods which more accurately model the correct API -- no internal change to the diagnostics engine yet though. - Also, stop honoring -Werror=everything (etc.) as a valid (but oddly behaved) option. llvm-svn: 140747
* Rename DiagnosticInfo to Diagnostic as per issue 5397David Blaikie2011-09-261-7/+7
| | | | llvm-svn: 140493
* Rename DiagnosticClient to DiagnosticConsumer as per issue 5397David Blaikie2011-09-251-8/+8
| | | | llvm-svn: 140479
* Rename Diagnostic to DiagnosticsEngine as per issue 5397David Blaikie2011-09-251-41/+44
| | | | llvm-svn: 140478
* Implement '-Weverything', which enables all warnings except those explicitly ↵Ted Kremenek2011-08-181-0/+1
| | | | | | | | | | | | | | mapped to be ignored. Currently this includes -pedantic warnings as well; we'll need to consider whether these should be included. This works as expected with -Werror. Test cases were added to Sema/warn-unused-parameters.c, but they should probably be broken off into their own test file. llvm-svn: 137910
* Make DiagnosticErrorTrap keep a count of the errors that occurred so multipleArgyrios Kyrtzidis2011-07-291-0/+2
| | | | | | | | DiagnosticErrorTraps can be composed (e.g. a trap inside another trap). Fixes http://llvm.org/PR10462 & rdar://9852007. llvm-svn: 136447
* Move ArrayRef to LLVM.h and eliminate now-redundant qualifiers, patch by Jon ↵Chris Lattner2011-07-231-2/+2
| | | | | | Mulder! llvm-svn: 135855
* remove unneeded llvm:: namespace qualifiers on some core types now that ↵Chris Lattner2011-07-231-15/+15
| | | | | | | | LLVM.h imports them into the clang namespace. llvm-svn: 135852
* Revamp the SourceManager to separate the representation of parsedDouglas Gregor2011-07-191-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | source locations from source locations loaded from an AST/PCH file. Previously, loading an AST/PCH file involved carefully pre-allocating space at the beginning of the source manager for the source locations and FileIDs that correspond to the prefix, and then appending the source locations/FileIDs used for parsing the remaining translation unit. This design forced us into loading PCH files early, as a prefix, whic has become a rather significant limitation. This patch splits the SourceManager space into two parts: for source location "addresses", the lower values (growing upward) are used to describe parsed code, while upper values (growing downward) are used for source locations loaded from AST/PCH files. Similarly, positive FileIDs are used to describe parsed code while negative FileIDs are used to file/macro locations loaded from AST/PCH files. As a result, we can load PCH/AST files even during parsing, making various improvemnts in the future possible, e.g., teaching #include <foo.h> to look for and load <foo.h.gch> if it happens to be already available. This patch was originally written by Sebastian Redl, then brought forward to the modern age by Jonathan Turner, and finally polished/finished by me to be committed. llvm-svn: 135484
* Apply patch from Richard Trieu to fix PR9548:Chandler Carruth2011-07-111-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When two different types has the same text representation in the same diagnostic message, print an a.k.a. after the type if the a.k.a. gives extra information about the type. class versa_string; typedef versa_string string; namespace std {template <typename T> class vector;} using std::vector; void f(vector<string> v); namespace std { class basic_string; typedef basic_string string; template <typename T> class vector {}; void g() { vector<string> v; f(v); } } Old message: ---------------- test.cc:15:3: error: no matching function for call to 'f' f(&v); ^ test.cc:7:6: note: candidate function not viable: no known conversion from 'vector<string>' to 'vector<string>' for 1st argument void f(vector<string> v); ^ 1 error generated. New message: --------------- test.cc:15:3: error: no matching function for call to 'f' f(v); ^ test.cc:7:6: note: candidate function not viable: no known conversion from 'vector<string>' (aka 'std::vector<std::basic_string>') to 'vector<string>' (aka 'std::vector<versa_string>') for 1st argument void f(vector<string> v); ^ 1 error generated. llvm-svn: 134904
* Keep track of when "unrecoverable" errors occur, then allowDouglas Gregor2011-07-061-0/+2
| | | | | | | clang_saveTranslationUnit() to save a PCH file if the only errors it contains are recoverable errors. Fixes <rdar://problem/9727804>. llvm-svn: 134503
* A StringRef-ication of the DiagnosticIDs API and internals.Argyrios Kyrtzidis2011-05-251-3/+3
| | | | | | | | | 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 a Diagnostic::Report function that accepts and emits a ↵Argyrios Kyrtzidis2011-05-051-0/+41
| | | | | | StoredDiagnostic. llvm-svn: 130919
* fix a bunch of comment typos found by codespell. Patch byChris Lattner2011-04-151-1/+1
| | | | | | Luis Felipe Strano Moraes! llvm-svn: 129559
* For Diagnostic::Reset() also reset the state related to #pragma diagnostic. ↵Argyrios Kyrtzidis2011-03-261-5/+10
| | | | | | Fixes rdar://9170766. llvm-svn: 128346
* Relax assertion to fail during crash recovery cleanup.Ted Kremenek2011-03-211-3/+1
| | | | llvm-svn: 128010
* Use CrashRecoveryContextCleanup objects to reclaim resources from ↵Ted Kremenek2011-03-211-1/+7
| | | | | | CompilerInstance objects. llvm-svn: 128009
* Teach Diagnostic::setClient() to free the existing, ownedDouglas Gregor2011-01-311-0/+7
| | | | | | client. Fixes a libclang leak. llvm-svn: 124614
* Properly propagate #pragma diagnostic mappings from PCH but not command-line ↵Argyrios Kyrtzidis2011-01-141-5/+6
| | | | | | | | warning flags. Addresses rdar://8435969&8852495 llvm-svn: 123462
* Fix diagnostic pragmas.Argyrios Kyrtzidis2010-12-151-10/+98
| | | | | | | | | | | | Diagnostic pragmas are broken because we don't keep track of the diagnostic state changes and we only check the current/latest state. Problems manifest if a diagnostic is emitted for a source line that has different diagnostic state than the current state; this can affect a lot of places, like C++ inline methods, template instantiations, the lexer, etc. Fix the issue by having the Diagnostic object keep track of the source location of the pragmas so that it is able to know what is the diagnostic state at any given source location. Fixes rdar://8365684. llvm-svn: 121873
* Initialize StoredDiagnostic's members in order.Benjamin Kramer2010-11-191-1/+1
| | | | llvm-svn: 119808
* Extend the libclang diagnostic API to provide information about theDouglas Gregor2010-11-191-3/+4
| | | | | | option name, category ID, and category name corresponding to a diagnostic. llvm-svn: 119802
* Since multiple diagnostics can share one diagnostic client, have the client ↵Argyrios Kyrtzidis2010-11-181-0/+10
| | | | | | | | keeping track of the total number of warnings/errors reported. llvm-svn: 119731
* Refactoring of Diagnostic class.Argyrios Kyrtzidis2010-11-181-529/+17
| | | | | | | | | | | -Move the stuff of Diagnostic related to creating/querying diagnostic IDs into a new DiagnosticIDs class. -DiagnosticIDs can be shared among multiple Diagnostics for multiple translation units. -The rest of the state in Diagnostic object is considered related and tied to one translation unit. -Have Diagnostic point to the SourceManager that is related with. Diagnostic can now accept just a SourceLocation instead of a FullSourceLoc. -Reflect the changes to various interfaces. llvm-svn: 119730
* Teach Diagnostic to recursively expand inside %plural formats.John McCall2010-10-141-5/+11
| | | | llvm-svn: 116468
* Fix a silly bug in the suppression of non-error diagnostics in aDouglas Gregor2010-10-131-3/+7
| | | | | | | SFINAE context, where we weren't getting the right diagnostic argument count. I blame DiagnosticBuilder's weirdness. Fixes PR8372. llvm-svn: 116411
* Eliminate -fdiagnostics-binary and all of the infrastructure forDouglas Gregor2010-10-111-245/+0
| | | | | | | | emitting diagnostics in a binary form to be consumed by libclang, since libclang no longer does any of its work out-of-process, making this code dead. Besides, this stuff never worked at 100% anyway. llvm-svn: 116250
* Simplify FixItHint by eliminated the unnecessary InsertionLocDouglas Gregor2010-08-181-9/+1
| | | | | | location. Patch by Eelis van der Weegen! llvm-svn: 111362
* Check whether errors should be included in the diagnostic counts. Previously,Chandler Carruth2010-08-181-5/+7
| | | | | | only warnings did this check. llvm-svn: 111355
* Remove dead code, caught by unused function warnings.Argyrios Kyrtzidis2010-08-151-3/+0
| | | | llvm-svn: 111091
* PR7777: Set EnabledByDefault to something useful, instead of setting itEli Friedman2010-08-011-1/+1
| | | | | | | randomly. This makes us consistently show "-pedantic" as the warning option for a warning where appropriate. llvm-svn: 109987
* Implement dependency analysis for the precompiled preamble. If any ofDouglas Gregor2010-07-311-16/+17
| | | | | | | the files in the precompiled preamble have changed since it was build, force the preamble to be rebuilt. llvm-svn: 109937
* Fix namespace polution.Dan Gohman2010-07-261-0/+4
| | | | llvm-svn: 109440
* Wrap bit mangling logic for DiagMappings in its own class so it doesn't leakBenjamin Kramer2010-07-251-5/+2
| | | | | | into other code. Make it an array instead of a constant-length vector. llvm-svn: 109384
* Introduce a new libclang API, clang_reparseTranslationUnit(), whichDouglas Gregor2010-07-191-26/+31
| | | | | | | | reparses an already-parsed translation unit. At the moment it's just a convenience function, but we hope to use it for performance optimizations. llvm-svn: 108756
* introduce a new CharSourceRange class, and enhance the diagnostics routinesChris Lattner2010-06-181-6/+12
| | | | | | | | | | | | | | | to use them instead of SourceRange. CharSourceRange is just a SourceRange plus a bool that indicates whether the range has the end character resolved or whether the end location is the start of the end token. While most of the compiler wants to think of ranges that have ends that are the start of the end token, the printf diagnostic stuff wants to highlight ranges within tokens. This is transparent to the diagnostic stuff. To start taking advantage of the new capabilities, you can do something like this: Diag(..) << CharSourceRange::getCharRange(Begin,End) llvm-svn: 106338
* Add an option -fshow-overloads=best|all to limit the number of overloadJeffrey Yasskin2010-06-111-0/+1
| | | | | | | candidates printed. We default to 'all'. At the moment, 'best' prints only the first 4 overloads, but we'll improve that over time. llvm-svn: 105815
* Update the types for warning option subgroup arrays to 'short', we have moreChandler Carruth2010-05-131-4/+4
| | | | | | | than 127 groups so this was already failing given -fsigned-char. A subsequent to commit to TableGen will generate shorts for the arrays themselves. llvm-svn: 103703
* When -fdiagnostics-print-source-range-info is specified,Chris Lattner2010-05-041-0/+29
| | | | | | | | | | | | | | | | | | | | | | | print the diagnostic category number in the [] at the end of the line. For example: $ cat t.c #include <stdio.h> void foo() { printf("%s", 4); } $ clang t.c -fsyntax-only -fdiagnostics-print-source-range-info t.c:3:11:{3:10-3:12}{3:15-3:16}: warning: conversion specifies type 'char *' but the argument has type 'int' [-Wformat,1] printf("%s", 4); ~^ ~ 1 warning generated. Clients that want category information can now pick the number out of the output, rdar://7928231. More coming. llvm-svn: 103053
* add the ability to associate 'category' names with diagnosticsChris Lattner2010-05-041-4/+6
| | | | | | | | | and diagnostic groups. This allows the compiler to group diagnostics together (e.g. "Logic Warning", "Format String Warning", etc) like the static analyzer does. This is not exposed through anything in the compiler yet. llvm-svn: 103051
* Introduce a limit on the depth of the template instantiation backtraceDouglas Gregor2010-04-201-1/+2
| | | | | | | | | | | | | | | | we will print with each error that occurs during template instantiation. When the backtrace is longer than that, we will print N/2 of the innermost backtrace entries and N/2 of the outermost backtrace entries, then skip the middle entries with a note such as: note: suppressed 2 template instantiation contexts; use -ftemplate-backtrace-limit=N to change the number of template instantiation entries shown This should eliminate some excessively long backtraces that aren't providing any value. llvm-svn: 101882
* Once we've emitted a fatal diagnostic, keep counting errors but with aDouglas Gregor2010-04-141-1/+8
| | | | | | | | | | | | | | separate count of "suppressed" errors. This way, semantic analysis bits that depend on the error count to determine whether problems occured (e.g., some template argument deduction failures, jump-scope checking) will not get confused. The actual problem here is that a missing #include (which is a fatal error) could cause the jump-scope checker to run on invalid code, which it is not prepared to do. Trivial fix for both <rdar://problem/7775941> and <rdar://problem/7775709>. llvm-svn: 101297
* fix PR6814 - Only print [-pedantic] on a diagnostic if -pedantic Chris Lattner2010-04-121-4/+11
| | | | | | | | actually turned it on. If a diag is produced by a warning which is an extension but defaults to on, and has no warning group, don't print any option info. llvm-svn: 101071
* Fix null dereference in 'WriteSourceLocation' when the FileEntry is null.Ted Kremenek2010-04-121-11/+18
| | | | llvm-svn: 101060
OpenPOWER on IntegriCloud