summaryrefslogtreecommitdiffstats
path: root/clang/lib/Basic/Diagnostic.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Move some IntrusiveRefCntPtrs instead of copying.Benjamin Kramer2016-07-211-4/+6
| | | | | | No functionality change intended. llvm-svn: 276292
* Optionally demote fatal errors to non-fatal errors.Manuel Klimek2016-03-011-0/+1
| | | | | | | | | | | | | | | | | | This behavior is enabled when the new CXTranslationUnit_KeepGoing option is passed to clang_parseTranslationUnit{,2}. It is geared towards use by IDEs and similar consumers of the clang-c API where fatal errors may arise when parsing incomplete code mid-edit, or when include paths are not properly configured yet. In such situations one still wants to get as much information as possible about a TU. Previously, the semantic analysis would not instantiate templates or report additional fatal errors after the first fatal error was encountered. Fixes PR24268. Patch by Milian Wolff. llvm-svn: 262318
* [Diagnostics] Call setMapping on the correct diagnostic states in a few ↵Craig Topper2015-11-261-3/+3
| | | | | | | | | | | | places. GetCurDiagState() was being used when it shouldn't be. I spotted this by inspection in the for loop that wasn't using its iterator and was just acting on the current state repeatedly. This appears to have been introduced as a copy and paste bug in r140763 over 4 years ago. I have no idea how to test this. I just went back to the original commit and tried to use the variables it was using before that. llvm-svn: 254134
* Use range-based for loops. NFCCraig Topper2015-11-261-7/+7
| | | | llvm-svn: 254133
* Roll-back r250822.Angel Garcia Gomez2015-10-201-2/+2
| | | | | | | | | | Summary: It breaks the build for the ASTMatchers Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D13893 llvm-svn: 250827
* Apply modernize-use-default to clang.Angel Garcia Gomez2015-10-201-2/+2
| | | | | | | | | | | | Summary: Replace empty bodies of default constructors and destructors with '= default'. Reviewers: bkramer, klimek Subscribers: klimek, alexfh, cfe-commits Differential Revision: http://reviews.llvm.org/D13890 llvm-svn: 250822
* Wdeprecated: StoredDiagnostics are stored in a SmallVector, so make sure ↵David Blaikie2015-08-131-4/+0
| | | | | | | | | | | they're copy/movable Removing the no-op dtor makes these objects safely implicitly copyable/movable/etc. (& tidy up the ctor, while I'm here) llvm-svn: 244971
* Replace __double_underscored type nullability qualifiers with ↵Douglas Gregor2015-06-241-0/+21
| | | | | | | | | | | | | | | | _Uppercase_underscored Addresses a conflict with glibc's __nonnull macro by renaming the type nullability qualifiers as follows: __nonnull -> _Nonnull __nullable -> _Nullable __null_unspecified -> _Null_unspecified This is the major part of rdar://problem/21530726, but does not yet provide the Darwin-specific behavior for the old names. llvm-svn: 240596
* push_back() loop -> append() for random access iterators.Benjamin Kramer2015-06-121-10/+2
| | | | | | | append will resize the vector to the optimal size. No functional change intended. llvm-svn: 239607
* Replace push_back(Constructor(foo)) with emplace_back(foo) for non-trivial typesBenjamin Kramer2015-05-291-1/+1
| | | | | | | | | | | | | | | | | | | | If the type isn't trivially moveable emplace can skip a potentially expensive move. It also saves a couple of characters. Call sites were found with the ASTMatcher + some semi-automated cleanup. memberCallExpr( argumentCountIs(1), callee(methodDecl(hasName("push_back"))), on(hasType(recordDecl(has(namedDecl(hasName("emplace_back")))))), hasArgument(0, bindTemporaryExpr( hasType(recordDecl(hasNonTrivialDestructor())), has(constructExpr()))), unless(isInTemplateInstantiation())) No functional change intended. llvm-svn: 238601
* Prefer SmallVector::append/insert over push_back loops. Clang edition.Benjamin Kramer2015-02-171-8/+2
| | | | | | Same functionality, but hoists the vector growth out of the loop. llvm-svn: 229508
* Clean up a string comparison with StringRef. Suggestion by David Majnemer.Richard Trieu2015-01-171-1/+2
| | | | llvm-svn: 226359
* When the diagnostic text is simply "%0", sanitize the string for anyRichard Trieu2015-01-081-0/+15
| | | | | | unprintable characters. Fixes PR22048. llvm-svn: 225423
* Destroy the diagnostic client first in ~DiagnosticEngineReid Kleckner2014-12-171-0/+6
| | | | | | | | | | | | Add a comment and a test to ~DiagnosticEngine about the ordering requirements on the teardown of DiagnosticConsumer. This could also be accomplished by rearranging the fields of ~DiagnosticEngine, but I felt that this was a better, more explicit solution. This fixes PR21911, an issue that occurred after the unique_ptr migration in r222193. llvm-svn: 224454
* Make DiagnosticsEngine::takeClient return std::unique_ptr<>Alexander Kornienko2014-11-171-15/+5
| | | | | | | | | | | | | | | | | | Summary: Make DiagnosticsEngine::takeClient return std::unique_ptr<>. Updated callers to store conditional ownership using a pair of pointer and unique_ptr instead of a pointer + bool. Updated code that temporarily registers clients to use the non-owning registration (+ removed extra calls to takeClient). Reviewers: dblaikie Reviewed By: dblaikie Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D6294 llvm-svn: 222193
* Remove unused DiagnosticsEngine::NumErrorsSuppressed member.Rafael Espindola2014-10-221-1/+0
| | | | | | Patch by Brad King! llvm-svn: 220413
* Increase SmallVector<> size in DiagnosticsEngine::setSeverityForGroupHans Wennborg2014-08-111-3/+3
| | | | | | | | In a Clang bootstrap, this vector always held 129 elements. Also switch to a range-based for loop. llvm-svn: 215360
* Use -Rblah, not -Wblah, to control remark diagnostics. This was always theRichard Smith2014-08-071-8/+14
| | | | | | | | | | | | | | | | | | | | | | intent when we added remark support, but was never implemented in the general case, because the first -R flags didn't need it. (-Rpass= had special handling to accomodate its argument.) -Rno-foo, -Reverything, and -Rno-everything can be used to turn off a remark, or to turn on or off all remarks. Per discussion on cfe-commits, -Weverything does not affect remarks, and -Reverything does not affect warnings or errors. The only "real" -R flag we have right now is -Rmodule-build; that flag is effectively renamed from -Wmodule-build to -Rmodule-build by this change. -Wpass and -Wno-pass (and their friends) are also renamed to -Rpass and -Rno-pass by this change; it's not completely clear whether we intended to have a -Rpass (with no =pattern), but that is unchanged by this commit, other than the flag name. The default pattern is effectively one which matches no passes. In future, we may want to make the default pattern be .*, so that -Reverything works for -Rpass properly. llvm-svn: 215046
* DiagnosticIDs: use diagnostic severities to simplify extension handlingAlp Toker2014-06-221-1/+1
| | | | llvm-svn: 211479
* DiagnosticsEngine: update severity setters to new terminologyAlp Toker2014-06-121-12/+10
| | | | llvm-svn: 210764
* Complete the switch from mappings to declarative diagnostic severitiesAlp Toker2014-06-121-11/+11
| | | | | | | | | This begins to address cognitive dissonance caused by treating the Note diagnostic level as a severity in the diagnostic engine. No change in functionality. llvm-svn: 210758
* Use StringRef to simplify code. No functional change.Craig Topper2014-06-121-10/+9
| | | | llvm-svn: 210751
* Use ArrayRef in some function parameters instead of a pointer and count. No ↵Craig Topper2014-06-121-14/+12
| | | | | | functional change. llvm-svn: 210750
* Improve diagnostic mapping terminologyAlp Toker2014-06-101-25/+24
| | | | | | | | | | | | Diagnostic mappings are used to calculate the final severity of diagnostic instances. Detangle the implementation to reflect the terminology used in documentation and bindings. No change in functionality. llvm-svn: 210518
* Remove limits on the number of fix-it hints and ranges in the DiagnosticsEngine.Alexander Kornienko2014-05-221-9/+6
| | | | | | | | | | | | | | | | | | | Summary: The limits on the number of fix-it hints and ranges attached to a diagnostic are arbitrary and don't apply universally to all users of the DiagnosticsEngine. The way the limits are enforced may lead to diagnostics generating invalid sets of fixes. I suggest removing the limits, which will also simplify the implementation. Reviewers: rsmith Reviewed By: rsmith Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D3879 llvm-svn: 209468
* [C++11] Use 'nullptr'.Craig Topper2014-05-081-5/+5
| | | | llvm-svn: 208280
* Fix -Wreturn-type build failure on ASTMatchers, plus an intended assertAlp Toker2014-01-261-1/+1
| | | | llvm-svn: 200140
* Remove flawed diagnostic mapping functionsAlp Toker2014-01-261-35/+0
| | | | | | | These haven't been usable since the early return was accidentally removed some years ago causing all cases to fall through to the !Enabled condition. llvm-svn: 200123
* Bring back magic constants in the digraph diagnosticAlp Toker2014-01-071-2/+0
| | | | | | | | This backs out changes in commit r198605 and part of r198604, replacing the original tok::kw_template with a slightly more obvious placeholder tok::unknown. llvm-svn: 198666
* Support diagnostic formatting of keyword tokensAlp Toker2014-01-061-7/+13
| | | | | | | | | Implemented with a new getKeywordSpelling() accessor. Unlike getTokenName() the result of this function is stable and may be used in diagnostic output. Uses of this feature are split out into the subsequent commit. llvm-svn: 198604
* Rename getTokenSimpleSpelling() to getPunctuatorSpelling()Alp Toker2014-01-061-1/+1
| | | | | | | That's what it does, what the documentation says it does and what callers expect it to do. llvm-svn: 198603
* Teach the diagnostics engine about the Attr type to make reporting on ↵Aaron Ballman2013-12-261-0/+1
| | | | | | semantic attributes easier (and not require hard-coded strings). This requires a getSpelling() function on the Attr class, which is table-driven. Updates a handful of cases where a hard-coded string was being used to test the functionality out. Updating associated test cases for the improved quoting. llvm-svn: 198055
* Support and use token kinds as diagnostic argumentsAlp Toker2013-12-241-0/+29
| | | | | | | | | | | | | | | | | | | Introduce proper facilities to render token spellings using the diagnostic formatter. Replaces most of the hard-coded diagnostic messages related to expected tokens, which all shared the same semantics but had to be multiply defined due to variations in token order or quote marks. The associated parser changes are largely mechanical but they expose commonality in whole chunks of the parser that can now be factored away. This commit uses C++11 typed enums along with a speculative legacy fallback until the transition is complete. Requires corresponding changes in LLVM r197895. llvm-svn: 197972
* Revert r177218.Argyrios Kyrtzidis2013-05-031-1/+0
| | | | | | Per discussion in cfe-commits, asserting may be a better way than introducing a special test flag. llvm-svn: 181073
* Remove DiagnosticConsumer::clone(), a bad idea that is now unused.Douglas Gregor2013-05-031-5/+0
| | | | llvm-svn: 181070
* When building a module, forward diagnostics to the outer diagnostic consumer.Douglas Gregor2013-05-031-0/+22
| | | | | | | | | | | | | | | Previously, we would clone the current diagnostic consumer to produce a new diagnostic consumer to use when building a module. The problem here is that we end up losing diagnostics for important diagnostic consumers, such as serialized diagnostics (where we'd end up with two diagnostic consumers writing the same output file). With forwarding, the diagnostics from all of the different modules being built get forwarded to the one serialized-diagnostic consumer and are emitted in a sane way. Fixes <rdar://problem/13663996>. llvm-svn: 181067
* Initialize WarnOnSpellCheck.Rafael Espindola2013-05-031-0/+1
| | | | | | | | | Clang always calls setWarnOnSpellCheck, but we shouldn't require every client to do so. Issue noticed by Enea Zaffanella. llvm-svn: 181021
* Moving initialization into the initializer list and correcting ↵Aaron Ballman2013-02-241-4/+3
| | | | | | capitalization, as suggested by Chandler. llvm-svn: 176001
* Fixing a typo where FixIts was accidentally self-assigning instead of ↵Aaron Ballman2013-02-191-1/+1
| | | | | | assigning in the parameter Fixits. This fixes several failed assertions with MSVC debug builds. llvm-svn: 175483
* Excise <cctype> from Clang (except clang-tblgen) in favor of CharInfo.h.Jordan Rose2013-02-081-7/+7
| | | | | | | Nearly all of these changes are one-to-one replacements; the few that aren't have to do with custom identifier validation. llvm-svn: 174768
* Changed to static_cast, due to post-commit review.Filipe Cabecinhas2013-01-301-2/+2
| | | | llvm-svn: 173980
* Cast to remove the narrowing conversion error in c++11.Filipe Cabecinhas2013-01-301-2/+2
| | | | llvm-svn: 173978
* Handle passing non-Qualtypes to %diff better. Instead of asserting, fall backRichard Trieu2013-01-301-5/+23
| | | | | | to printing the default case. This is a fix for PR15023. llvm-svn: 173965
* Remove useless 'llvm::' qualifier from names like StringRef and others that areDmitri Gribenko2013-01-121-4/+4
| | | | | | brought into 'clang' namespace by clang/Basic/LLVM.h llvm-svn: 172323
* Fix code that attempted to produce a diagnostic with one DiagnosticEngine, thenRichard Smith2012-12-201-5/+1
| | | | | | | | produce a note for that diagnostic either with a different DiagnosticEngine or after calling DiagnosticEngine::Reset(). That didn't make any sense, and did the wrong thing if the original diagnostic was suppressed. llvm-svn: 170636
* Fix analysis based warnings so that all warnings are emitted when compilingDeLesley Hutchins2012-12-071-0/+1
| | | | | | | | | with -Werror. Previously, compiling with -Werror would emit only the first warning in a compilation unit, because clang assumes that once an error occurs, further analysis is unlikely to return valid results. However, warnings that have been upgraded to errors should not be treated as "errors" in this sense. llvm-svn: 169649
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-041-1/+1
| | | | | | | | | | | | | uncovered. This required manually correcting all of the incorrect main-module headers I could find, and running the new llvm/utils/sort_includes.py script over the files. I also manually added quite a few missing headers that were uncovered by shuffling the order or moving headers up to be main-module-headers. llvm-svn: 169237
* Make DiagnosticOptions intrusively reference-counted, and make sureDouglas Gregor2012-10-231-2/+4
| | | | | | | the various stakeholders bump up the reference count. In particular, the diagnostics engine now keeps the DiagnosticOptions object alive. llvm-svn: 166508
* Use llvm::getOrdinalSuffix to print ordinal numbers in diagnostics.Jordan Rose2012-09-221-17/+2
| | | | | | Just a refactoring of common infrastructure. No intended functionality change. llvm-svn: 164443
* Avoid binding a reference to a dereferenced null pointer, if we try to emit aRichard Smith2012-08-171-0/+3
| | | | | | diagnostic before we have a source manager. llvm-svn: 162070
OpenPOWER on IntegriCloud