summaryrefslogtreecommitdiffstats
path: root/clang/lib/Basic/Diagnostic.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* add clang -cc1 level support for "-ferror-limit 42"Chris Lattner2010-04-071-2/+2
| | | | llvm-svn: 100687
* add capabilities to stop emitting errors after some limit.Chris Lattner2010-04-071-0/+7
| | | | | | Right now the limit is 0 (aka disabled) llvm-svn: 100684
* Instead of counting totally diagnostics, split the count into a countChris Lattner2010-04-071-2/+5
| | | | | | | | | | | | | | | of errors and warnings. This allows us to emit something like this: 2 warnings and 1 error generated. instead of: 3 diagnostics generated. This also stops counting 'notes' because they are just follow-on information about the previous diag, not a diagnostic in themselves. llvm-svn: 100675
* Reinstate my CodeModificationHint -> FixItHint renaming patch, withoutDouglas Gregor2010-03-311-5/+5
| | | | | | the C-only "optimization". llvm-svn: 100022
* Revert r100008, which inexplicably breaks the clang-i686-darwin10 builderDouglas Gregor2010-03-311-5/+5
| | | | llvm-svn: 100018
* Rename CodeModificationHint to FixItHint, since we've been using theDouglas Gregor2010-03-311-5/+5
| | | | | | | term "fix-it" everywhere and even *I* get tired of long names sometimes. No functionality change. llvm-svn: 100008
* Optimize PartialDiagnostic's memory-allocation behavior by placing aDouglas Gregor2010-03-291-0/+11
| | | | | | | | | | | | | | cache of PartialDiagnostic::Storage objects into an allocator within the ASTContext. This eliminates a significant amount of malloc traffic, for a 10% performance improvement in -fsyntax-only wall-clock time with 403.gcc's combine.c. Also, eliminate the RequireNonAbstractType hack I put in earlier, which was but a symptom of this larger problem. Fixes <rdar://problem/7806091>. llvm-svn: 99849
* Teach the diagnostic engine to provide more detailed information aboutDouglas Gregor2010-03-251-4/+14
| | | | | | | | | how to handle a diagnostic during template argument deduction, which may be "substitution failure", "suppress", or "report". This keeps us from, e.g., emitting warnings while performing template argument deduction. llvm-svn: 99560
* Fix a thinko and a typo in the delayed-diagnostic code.Douglas Gregor2010-03-221-3/+4
| | | | llvm-svn: 99178
* Introduce the notion of a single "delayed" diagnostic into theDouglas Gregor2010-03-221-0/+47
| | | | | | | | | | | | Diagnostic subsystem, which is used in the rare case where we find a serious problem (i.e., an inconsistency in the file system) while we're busy formatting another diagnostic. In this case, the delayed diagnostic will be emitted after we're done with the other diagnostic. This is only to be used for fatal conditions detected at very inconvenient times, where we can neither stop the current diagnostic in flight nor can we suppress the second error. llvm-svn: 99175
* Use a little binary header in serialized diagnostics to help the ↵Douglas Gregor2010-02-191-3/+26
| | | | | | deserializer skip over noise in the stream llvm-svn: 96641
* Re-apply my diagnostics-capture patch for CIndex, with some tweaks toDouglas Gregor2010-02-181-1/+1
| | | | | | try to address the msvc failures. llvm-svn: 96624
* Rework how CIndex handles diagnostics. Rather than using a callback,Douglas Gregor2010-02-181-142/+168
| | | | | | | | | | | | | | | | | | we attach diagnostics to translation units and code-completion results, so they can be queried at any time. To facilitate this, the new StoredDiagnostic class stores a diagnostic in a serializable/deserializable form, and ASTUnit knows how to capture diagnostics in this stored form. CIndex's CXDiagnostic is a thin wrapper around StoredDiagnostic, providing a C interface to stored or de-serialized diagnostics. I've XFAIL'd one test case temporarily, because currently we end up storing diagnostics in an ASTUnit that's never returned to the user (because it contains errors). I'll introduce a temporary fix for this soon; the real fix will be to allow us to return and query invalid ASTs. llvm-svn: 96592
* Suppress warnings if their instantiation location is in a system header, notJohn McCall2010-02-111-1/+1
| | | | | | | | | | | | | their spelling location. This prevents warnings from being swallowed just because the caret is on the first parenthesis in, say, NULL. This is an experiment; the risk is that there might be a substantial number of system headers which #define symbols to expressions which inherently cause warnings. My theory is that that's rare enough that it can be worked around case-by-case, and that producing useful warnings around NULL is worth it. But I'm willing to accept that I might be empirically wrong. llvm-svn: 95870
* Introduce serialization and deserialization of diagnostic informationDouglas Gregor2010-01-281-0/+217
| | | | | | | | | | | | | | | | | so that CIndex can report diagnostics through the normal mechanisms even when executing Clang in a separate process. This applies both when performing code completion and when using ASTs as an intermediary for clang_createTranslationUnitFromSourceFile(). The serialized format is not perfect at the moment, because it does not encapsulate macro-instantiation information. Instead, it maps all source locations back to the instantiation location. However, it does maintain source-range and fix-it information. To get perfect fidelity from the serialized format would require serializing a large chunk of the source manager; at present, it isn't clear if this code will live long enough for that to matter. llvm-svn: 94740
* Pre-emptive bugfixes in the diagnostics code: allow arbitrary punctuationJohn McCall2010-01-141-8/+35
| | | | | | | characters to be escaped and implement a scan-forward function which properly respects brace nesting. llvm-svn: 93447
* Add the %ordinal format modifier for turning '1' into '1st'. Hard-coded forJohn McCall2010-01-141-0/+35
| | | | | | | English right now; would not be impossible to grab a special format string from the diagnostic pool and localize that way. llvm-svn: 93390
* Perform format-expansion on %select results.John McCall2010-01-131-5/+13
| | | | llvm-svn: 93377
* implement -W[no-]fatal-errors, patch by Christian Adåker!Chris Lattner2009-12-221-0/+13
| | | | llvm-svn: 91938
* Remove 'LangOpts' from Diagnostic (added in ↵Steve Naroff2009-12-051-1/+0
| | | | | | | | | | http://llvm.org/viewvc/llvm-project?view=rev&revision=90642). Simply use the 'LangOpts' member already present in TextDiagnosticPrinter. Sorry for the confusion! llvm-svn: 90664
* Integrate the following from the 'objective-rewrite' branch:Steve Naroff2009-12-051-1/+2
| | | | | | | | | | | | http://llvm.org/viewvc/llvm-project?view=rev&revision=71086 Note - This commit only includes the fix for: <rdar://problem/6309338> slightly different error message format for Visual Studio. The fix for <rdar://problem/6845623> from protocol to template. is separate/forthcoming. llvm-svn: 90642
* Convert Diagnostic::getCustomDiagID to take a StringRef.Daniel Dunbar2009-12-011-2/+2
| | | | llvm-svn: 90244
* Fixed undefined behavior in pushMappings when the stack has to resize.John Thompson2009-10-231-0/+2
| | | | llvm-svn: 84924
* teach FormatDiagnostic to aggregate previously formatted arguments andChris Lattner2009-10-201-3/+25
| | | | | | | | | pass them down into the ArgToStringFn implementation. This allows redundancy across operands to a diagnostic to be eliminated. This isn't used yet, so no functionality change. llvm-svn: 84602
* PR5218: Replace IdentifierInfo::getName with StringRef version, now that clientsDaniel Dunbar2009-10-181-1/+1
| | | | | | are updated. llvm-svn: 84447
* Use raw_ostream for formatting integers, and use IdentifierInfo::getNameStrDaniel Dunbar2009-10-171-10/+4
| | | | | | | instead of getName. - -2 FIXMEs. llvm-svn: 84337
* increase helpfulness of assert message.Chris Lattner2009-10-161-1/+6
| | | | llvm-svn: 84240
* Unify our diagnostic printing for errors of the form, "we didn't likeDouglas Gregor2009-10-131-0/+1
| | | | | | | | | | what we found when we looked into <blah>", where <blah> is a DeclContext*. We can now format DeclContext*'s in nice ways, e.g., "namespace N", "the global namespace", "'class Foo'". This is part of PR3990, but we're not quite there yet. llvm-svn: 84028
* Initial implementation of a code-completion interface in Clang. InDouglas Gregor2009-09-171-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | essence, code completion is triggered by a magic "code completion" token produced by the lexer [*], which the parser recognizes at certain points in the grammar. The parser then calls into the Action object with the appropriate CodeCompletionXXX action. Sema implements the CodeCompletionXXX callbacks by performing minimal translation, then forwarding them to a CodeCompletionConsumer subclass, which uses the results of semantic analysis to provide code-completion results. At present, only a single, "printing" code completion consumer is available, for regression testing and debugging. However, the design is meant to permit other code-completion consumers. This initial commit contains two code-completion actions: one for member access, e.g., "x." or "p->", and one for nested-name-specifiers, e.g., "std::". More code-completion actions will follow, along with improved gathering of code-completion results for the various contexts. [*] In the current -code-completion-dump testing/debugging mode, the file is truncated at the completion point and EOF is translated into "code completion". llvm-svn: 82166
* Remove tabs, and whitespace cleanups.Mike Stump2009-09-091-49/+49
| | | | llvm-svn: 81346
OpenPOWER on IntegriCloud