summaryrefslogtreecommitdiffstats
path: root/clang/lib/Basic/DiagnosticIDs.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Change Diagnostic Category size error from runtime to compiletimeErich Keane2017-08-281-12/+23
| | | | | | | | | | Diagnostic Categories are fairly annoying, and are only enforced by a runtime-debug-only assert. This puts in a touch more work to get this all done at compile-time with static asserts Differential Revision: https://reviews.llvm.org/D37122 llvm-svn: 311905
* [Bash-autocompletion] Fixed typo and add '-' after -WnoYuka Takahashi2017-07-221-1/+1
| | | | | | | | Summary: -Wno-<warning> was autocompleted as -Wno<warning>, so fixed this typo. Differential Revision: https://reviews.llvm.org/D35762 llvm-svn: 308824
* [Bash-autocompletion] Add support for -W<warning> and -Wno<warning>Yuka Takahashi2017-07-161-0/+12
| | | | | | | | | | Summary: `-W[tab]` will autocomplete warnings defined in this link: https://clang.llvm.org/docs/DiagnosticsReference.html#wweak-vtables Differential Revision: https://reviews.llvm.org/D35447 llvm-svn: 308139
* DiagnosticsEngine should clear DelayedDiagID before reporting theAlex Lorenz2017-05-041-0/+4
| | | | | | | | | | | | | | | | | | | | | delayed diagnostic This fix avoids an infinite recursion that was uncovered in one of our internal tests by r301992. The testcase is the most reduced version of that auto-generated test. This is an improved version of the reverted commit r302037. The previous fix actually managed to expose another subtle bug whereby `fatal_too_many_errors` error was reported twice, with the second report setting the `FatalErrorOccurred` flag. That prevented the notes that followed the diagnostic the caused `fatal_too_many_errors` to be emitted. This commit ensures that notes that follow `fatal_too_many_errors` but that belong to the diagnostic that caused `fatal_too_many_errors` won't be emitted by setting the `FatalErrorOccurred` when emitting `fatal_too_many_errors`. rdar://31962618 llvm-svn: 302151
* [modules] Round-trip -Werror flag through explicit module build.Richard Smith2017-05-031-13/+9
| | | | | | | | | | | | | | | The intent for an explicit module build is that the diagnostics produced within the module are those that were configured when the module was built, not those that are enabled within a user of the module. This includes diagnostics that don't actually show up until the module is used (for instance, diagnostics produced during template instantiation and weird cases like -Wpadded). We serialized and restored the diagnostic state for individual warning groups, but previously did not track the state for flags like -Werror and -Weverything, which are implemented as separate bits rather than as part of the diagnostics mapping information. llvm-svn: 301992
* Remove and replace DiagStatePoint tracking and lookup data structure.Richard Smith2017-01-261-4/+1
| | | | | | | | | | | | | | | | | | | | | | | Rather than storing a single flat list of SourceLocations where the diagnostic state changes (in source order), we now store a separate list for each FileID in which there is a diagnostic state transition. (State for other files is built and cached lazily, on demand.) This has two consequences: 1) We can now sensibly support modules, and properly track the diagnostic state for modular headers (this matters when, for instance, triggering instantiation of a template defined within a module triggers diagnostics). 2) It's much faster than the old approach, since we can now just do a binary search on the offsets within the FileID rather than needing to call isBeforeInTranslationUnit to determine source order (which is surprisingly slow). For some pathological (but real world) files, this reduces total compilation time by more than 10%. For now, the diagnostic state points for modules are loaded eagerly. It seems feasible to defer this until diagnostic state information for one of the module's files is needed, but that's not part of this patch. llvm-svn: 293123
* [PCH/preamble] Make sure that if the preamble/PCH was serialized with errors ↵Argyrios Kyrtzidis2016-07-131-1/+1
| | | | | | | | | | that we set diagnostic engine state appropriately. Otherwise there can be a crash with CFG analysis warnings doing work on invalid AST. Fixes crash of rdar://26224134 llvm-svn: 275313
* Optionally demote fatal errors to non-fatal errors.Manuel Klimek2016-03-011-0/+6
| | | | | | | | | | | | | | | | | | 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
* Add an unnecessary makeArrayRef I add earlier. I didn't realize range-based ↵Craig Topper2015-10-181-1/+1
| | | | | | for loops worked with arrays. llvm-svn: 250646
* Use std::is_sorted instead of a manual loop.Craig Topper2015-10-181-5/+4
| | | | llvm-svn: 250645
* Replace a static compare function with a lambda. NFCCraig Topper2015-10-171-7/+5
| | | | llvm-svn: 250621
* Use a range-based for loop. Use std::end instead of pointer+array_lengthof. NFCCraig Topper2015-10-171-11/+9
| | | | llvm-svn: 250617
* Further increase helfulness of assert messageRichard Barton2015-10-161-4/+1
| | | | | | | | | If you increase the number of diags of a particular type by one more than the number available you get the nice assert message. If you do it by two more than available you get the old non-helpful message. Combining the two makes sense I think. llvm-svn: 250546
* Revert r240270 ("Fixed/added namespace ending comments using clang-tidy").Alexander Kornienko2015-06-221-5/+5
| | | | llvm-svn: 240353
* Fixed/added namespace ending comments using clang-tidy. NFCAlexander Kornienko2015-06-221-5/+5
| | | | | | | | | | | | The patch is generated using this command: $ tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \ -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \ work/llvm/tools/clang To reduce churn, not touching namespaces spanning less than 10 lines. llvm-svn: 240270
* Simplify boolean expressions in clang with clang-tidyDavid Blaikie2015-03-091-1/+1
| | | | | | | | Patch by Richard (legalize at xmission dot com). Differential Revision: http://reviews.llvm.org/D8155 llvm-svn: 231619
* Make DiagnosticErrorTrap work even if SuppressAllDiagnostics is enabled.Richard Smith2014-12-051-10/+11
| | | | | | Patch by Brad King! llvm-svn: 223525
* Remove unused DiagnosticsEngine::NumErrorsSuppressed member.Rafael Espindola2014-10-221-1/+0
| | | | | | Patch by Brad King! llvm-svn: 220413
* Simplify this logic now that -W can't be applied to remarks. No ↵Richard Smith2014-08-211-8/+1
| | | | | | functionality change. llvm-svn: 216222
* Use -Rblah, not -Wblah, to control remark diagnostics. This was always theRichard Smith2014-08-071-16/+46
| | | | | | | | | | | | | | | | | | | | | | 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
* Remove this pointer that is converted to bool. In well-defined contexts, theRichard Trieu2014-08-011-3/+7
| | | | | | | | this pointer is always non-null. If the this pointer is null, it is undefined and the compiler may optimize it away by assuming it is non-null. The null checks are pushed into the callers. llvm-svn: 214471
* DiagnosticIDs: use diagnostic severities to simplify extension handlingAlp Toker2014-06-221-17/+2
| | | | llvm-svn: 211479
* TextDiagnosticPrinter: use the mapped level for remark flag computationAlp Toker2014-06-221-5/+0
| | | | | | | | | Custom diagnostics don't have a builtin class so this wouldn't have worked. Reduces surface area of remark-related changes. No test coverage. llvm-svn: 211462
* Use the ShowInSystemHeader bit consistently for all diagnosticsAlp Toker2014-06-161-7/+7
| | | | | | | | | | | | By describing system header suppressions directly in tablegen we eliminate special cases in getDiagnosticSeverity(). Dropping the reliance on builtin diagnostic classes when mapping also gets us closer to the goal of reusing the diagnostic machinery for custom diagnostics. No change in functionality. llvm-svn: 211023
* Permit -Wswitch coverage for enumerations.Saleem Abdulrasool2014-06-121-1/+1
| | | | | | | | Thanks to David Blakie and Richard Smith for pointing out that we can retain the -Wswitch coverage while avoiding the warning from GCC by pushing the unreachable outside of the switch! llvm-svn: 210812
* Basic: fix warnings from GCCSaleem Abdulrasool2014-06-121-0/+1
| | | | | | | | | | | | tools/clang/lib/Basic/DiagnosticIDs.cpp: In function ‘clang::DiagnosticIDs::Level toLevel(clang::diag::Severity)’: tools/clang/lib/Basic/DiagnosticIDs.cpp:382:1: warning: control reaches end of non-void function [-Wreturn-type] tools/clang/lib/Format/Format.cpp: In member function ‘virtual std::string clang::format::ParseErrorCategory::message(int) const’: tools/clang/lib/Format/Format.cpp:282:1: warning: control reaches end of non-void function [-Wreturn-type] Add a default cases that asserts that we handle the severity, parse error. llvm-svn: 210804
* Complete the switch from mappings to declarative diagnostic severitiesAlp Toker2014-06-121-45/+49
| | | | | | | | | 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
* Improve diagnostic mapping terminologyAlp Toker2014-06-101-28/+27
| | | | | | | | | | | | 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
* Show -Wdate-time in system headersAlp Toker2014-06-101-13/+6
| | | | | | | | | | Anyone enabling this warning would expect to hear about all occurrences including those in system headers that can cause non-reproducible builds. To achieve this, rework ShowInSystemHeader to remove broken unused mapping code that didn't make sense with a simpler and correct scheme. llvm-svn: 210512
* [C++11] Use 'nullptr'.Craig Topper2014-05-081-8/+6
| | | | llvm-svn: 208280
* Add support for optimization reports.Diego Novillo2014-04-161-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch adds a new flag -Rpass=. The flag indicates the name of the optimization pass that should emit remarks stating when it made a transformation to the code. This implements the design I proposed in: https://docs.google.com/document/d/1FYUatSjZZO-zmFBxjOiuOzAy9mhHA8hqdvklZv68WuQ/edit?usp=sharing Other changes: - Add DiagnosticIDs::isRemark(). Use it in printDiagnosticOptions to print "-R" instead of "-W" in the diagnostic message. - In BackendConsumer::OptimizationRemarkHandler, get a SourceLocation object out of the file name, line and column number. Use that location in the call to Diags.Report(). - When -Rpass is used without debug info a note is emitted alerting the user that they need to use -gline-tables-only -gcolumn-info to get this information. CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D3226 llvm-svn: 206401
* Add 'remark' diagnostic type in 'clang'Tobias Grosser2014-02-281-3/+12
| | | | | | | | | | | | | | | | | | | | | | | A 'remark' is information that is not an error or a warning, but rather some additional information provided to the user. In contrast to a 'note' a 'remark' is an independent diagnostic, whereas a 'note' always depends on another diagnostic. A typical use case for remark nodes is information provided to the user, e.g. information provided by the vectorizer about loops that have been vectorized. This patch provides the initial implementation of 'remarks'. It includes the actual definiton of the remark nodes, their printing as well as basic parameter handling. We are reusing the existing diagnostic parameters which means a remark can be enabled with normal '-Wdiagnostic-name' flags and can be upgraded to an error using '-Werror=diagnostic-name'. '-Werror' alone does not upgrade remarks. This patch is by intention minimal in terms of parameter handling. More experience and more discussions will most likely lead to further enhancements in the parameter handling. llvm-svn: 202475
* Update docstrings following the param name change in r200132Alp Toker2014-01-261-3/+3
| | | | llvm-svn: 200137
* Sort all the #include lines with LLVM's utils/sort_includes.py whichChandler Carruth2014-01-071-1/+1
| | | | | | | encodes the canonical rules for LLVM's style. I noticed this had drifted quite a bit when cleaning up LLVM, so wanted to clean up Clang as well. llvm-svn: 198686
* Document the Message parameter of getCustomDiagID()Alp Toker2013-12-231-0/+3
| | | | | | A lot of callers have been using this facility incorrectly. llvm-svn: 197920
* Fix a tranche of comment, test and doc typosAlp Toker2013-12-051-1/+1
| | | | llvm-svn: 196510
* Remove C++11ism.Richard Smith2013-11-121-1/+1
| | | | llvm-svn: 194446
* Rather than duplicating extension diagnostics to allow them to cause aRichard Smith2013-11-121-20/+7
| | | | | | | | | | substitution failure, allow a flag to be set on the Diagnostic object, to mark it as 'causes substitution failure'. Refactor Diagnostic.td and the tablegen to use an enum for SFINAE behavior rather than a bunch of flags. llvm-svn: 194444
* Make getDiagnosticsInGroup helper method a static function in the cpp file ↵Craig Topper2013-08-291-15/+16
| | | | | | and move the WarningOption struct into an anonymous namespace instead of clang namespace since it no longer needs to be forward declared in the header. llvm-svn: 189569
* Move individual group name strings from the OptionTable into one big char ↵Craig Topper2013-08-291-14/+11
| | | | | | array. Then only store offsets into it in the OptionTable. Saves about 4K from the clang binary and removes 400 relocation entries from DiagnosticIDs.o. llvm-svn: 189568
* Reorder and shrink size of NameLen field in diagnostic group table. Shaves ↵Craig Topper2013-08-281-5/+4
| | | | | | ~4K from clang binary. llvm-svn: 189445
* Merge diagnostic group tables to reduce data size and relocation entries.Craig Topper2013-08-281-10/+8
| | | | | | | | The individual group and subgroups tables are now two large tables. The option table stores an index into these two tables instead of pointers. This reduces the size of the options tabe since it doesn't need to store pointers. It also reduces the number of relocations needed. My build shows this reducing DiagnosticsIDs.o and the clang binary by ~20.5K. It also removes ~400 relocation entries from DiagnosticIDs.o. llvm-svn: 189438
* Replace 'unsigned short' with 'uint16_t' in a packed data structure for ↵Craig Topper2013-07-211-1/+1
| | | | | | consistency with other fields and to be explicit about bit count. llvm-svn: 186796
* Revert r186649 because it wasn't unnecessary and add a comment.Craig Topper2013-07-211-7/+11
| | | | llvm-svn: 186795
* DiagnosticIDs: Forbid Diag ID from being validDavid Majnemer2013-07-201-8/+4
| | | | | | | | | | Diag ID is used throughout clang as a sentinel id meaning "this is an invalid diagnostic id." Confusingly, Diag ID maps to a valid, usable, diagnostic id. Instead, start diagnostic ids at ID one. Incidently, remove an unused element from StaticDiagInfo. llvm-svn: 186760
* Remove unnecessary IsFirst variable from debug codde in GetDiagInfo.Craig Topper2013-07-191-11/+7
| | | | llvm-svn: 186649
* Use llvm::array_lengthof to replace sizeof(array)/sizeof(array[0]).Craig Topper2013-07-151-4/+4
| | | | llvm-svn: 186300
* Fix typos: [Dd]iagnosic -> [Dd]iagnosticStefanus Du Toit2013-03-011-3/+3
| | | | | | These all appear in comments or (ironically) diagnostics output. llvm-svn: 176383
* Remove useless 'llvm::' qualifier from names like StringRef and others that areDmitri Gribenko2013-01-121-7/+5
| | | | | | brought into 'clang' namespace by clang/Basic/LLVM.h llvm-svn: 172323
* DiagnosticIds: Fix offset/ID calculation, no impact outside this code.Argyrios Kyrtzidis2013-01-021-2/+4
| | | | | | | | | | | | Patch by Will Dietz: Minor touchup so the values of Offset/ID reflect their intention. Previously, the sum (Offset+ID) was correct, but Offset/ID individually were wrong. Caught by investigating unsigned overflow reported by -fsanitize=integer. llvm-svn: 171421
OpenPOWER on IntegriCloud