summaryrefslogtreecommitdiffstats
path: root/clang/lib/Basic/Diagnostic.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Update the %diff modifer to have an alternate string print when a template treeRichard Trieu2012-06-291-7/+11
| | | | | | | | | | is selected. This will allow more flexibility when converting diagnostics to use template type diffing. Also updated the internal manual and test cases for correctly keeping the bold attribute and for tree printing. llvm-svn: 159463
* Add template type diffing to Clang. This feature will provide a betterRichard Trieu2012-06-261-1/+78
| | | | | | | | | | | | 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: delete doc comments from source files where they areJames Dennett2012-06-151-6/+0
| | | | | | broken duplicates of comments that are in the corresponding header files. llvm-svn: 158550
* [Basic] Fix up DiagnosticBuilder::{FlushCounts,Emit} to be inline.Daniel Dunbar2012-03-131-23/+6
| | | | | | | | | | | | | | | | - This is much more important than it appears at first glance... The intended design of DiagnosticBuilder was that it never escape and that all its members would get lowered to registers by the compiler. By fixing Emit here, the compiler can completely eliminate the DiagnosticBuilder object and never need to push those registers back into it. Unfortunately, Sema has broken DiagnosticBuilder in other ways (by introducing SemaDiagnosticBuilder), so we don't get the fill impact of this, but it is still good for 30k reduction in code size. I'll work on fixing the SemaDiagnosticBuilder problems next. llvm-svn: 152669
* [Basic] Stop using a SmallVector<> for Diagnostic. This drops Clang binary sizeDaniel Dunbar2012-03-131-3/+6
| | | | | | | | | | by ~%.3/~100k in my build -- simply by eliminating the horrible code bloat coming from the .clear() of the SmallVector<FixItHint>, which does a std::~string, etc. - My understanding is we don't ever emit arbitrary numbers of fixits, so I just moved us to using a statically sized array like we do for arguments and ranges. llvm-svn: 152639
* More ArrayRef-ification of methods.Bill Wendling2012-02-221-1/+1
| | | | llvm-svn: 151152
* Basic: import IntrusiveRefCntPtr<> into clang namespaceDylan Noblesmith2012-02-201-1/+1
| | | | | | | The class name is long enough without the llvm:: added. Also bring in RefCountedBase and RefCountedBaseVPTR. llvm-svn: 150958
* Fix indentation and an 80-column violation.Chad Rosier2012-02-071-5/+7
| | | | llvm-svn: 150010
* Revert my patches which removed Diagnostic.h includes by moving some ↵Benjamin Kramer2012-02-071-2/+2
| | | | | | | | | | | | | | | | | | operator overloads out of line. This seems to negatively affect compile time onsome ObjC tests (which use a lot of partial diagnostics I assume). I have to come up with a way to keep them inline without including Diagnostic.h everywhere. Now adding a new diagnostic requires a full rebuild of e.g. the static analyzer which doesn't even use those diagnostics. This reverts commit 6496bd10dc3a6d5e3266348f08b6e35f8184bc99. This reverts commit 7af19b817ba964ac560b50c1ed6183235f699789. This reverts commit fdd15602a42bbe26185978ef1e17019f6d969aa7. This reverts commit 00bd44d5677783527d7517c1ffe45e4d75a0f56f. This reverts commit ef9b60ffed980864a8db26ad30344be429e58ff5. llvm-svn: 150006
* In r149662, setDiagnosticMapping was modified to not allow warnings mapped to Chad Rosier2012-02-071-0/+35
| | | | | | | | MAP_ERROR to be remapped to MAP_WARNING. These new APIs are being added to allow the diagnostic mapping's "no Werror" bit to be set, and potentially downgrade anything already mapped to be a warning. llvm-svn: 150001
* Basic: import SmallString<> into clang namespaceDylan Noblesmith2012-02-051-1/+1
| | | | | | | (I was going to fix the TODO about DenseMap too, but that would break self-host right now. See PR11922.) llvm-svn: 149799
* Move a method from IdentifierTable.h out of line and remove the SmallString ↵Benjamin Kramer2012-02-041-1/+1
| | | | | | | | include. Fix all the transitive include users. llvm-svn: 149783
* Move Storage and StorageAllocator out of the PartialDiagnostic class so we ↵Benjamin Kramer2012-02-041-2/+2
| | | | | | | | | can forward declare them. Let ASTContext allocate the storage in its BumpPtrAllocator. This will help us remove ASTContext's depedency on PartialDiagnostic.h soon. llvm-svn: 149780
* Change the fixed array of FixitHints to a SmallVector to lift offArgyrios Kyrtzidis2012-02-031-6/+2
| | | | | | the limit on the number of fixits. llvm-svn: 149676
* [frontend] Don't allow a mapping to a warning override an error/fatal mapping.Chad Rosier2012-02-031-0/+7
| | | | | | rdar://10736625 llvm-svn: 149662
* DiagnosticsEngine::setMappingToAllDiagnostics() does not need to return bool,Argyrios Kyrtzidis2012-01-281-3/+1
| | | | | | caught by Chad. llvm-svn: 149173
* Due to a bug, -Wno-everything works like -Weverything. Fix the bug by havingArgyrios Kyrtzidis2012-01-271-0/+14
| | | | | | | | | -Wno-everything remap all warnings to ignored. We can now use "-Wno-everything -W<warning>" to ignore all warnings except specific ones. llvm-svn: 149121
* Unweaken vtables as per ↵David Blaikie2011-12-201-0/+2
| | | | | | http://llvm.org/docs/CodingStandards.html#ll_virtual_anch llvm-svn: 146959
* C++11 constexpr: Add note stacks containing backtraces if constant evaluationRichard Smith2011-12-161-0/+1
| | | | | | | | | | fails within a call to a constexpr function. Add -fconstexpr-backtrace-limit argument to driver and frontend, to control the maximum number of notes so produced (default 10). Fix APValue printing to be able to pretty-print all APValue types, and move the testing for this functionality from a unittest to a -verify test now that it's visible in clang's output. llvm-svn: 146749
* [PCH] Fix reading from PCH of diagnostic pragmas.Argyrios Kyrtzidis2011-11-091-10/+1
| | | | | | | | | | | In certain cases ASTReader would call the normal DiagnosticsEngine API to initialize the state of diagnostic pragmas but DiagnosticsEngine would try to compare source locations leading to crash because the main FileID was not yet initialized. Yet another case of the ASTReader trying to use the normal APIs and inadvertently breaking invariants. Fix this by having the ASTReader set up the internal state directly. llvm-svn: 144153
* 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
OpenPOWER on IntegriCloud