summaryrefslogtreecommitdiffstats
path: root/clang/utils/TableGen/ClangDiagnosticsEmitter.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix uninitialized variable warnings. NFCI.Simon Pilgrim2019-11-021-3/+3
|
* Use scope qualifiers in Clang's tblgen backends to get usefulJohn McCall2019-10-011-12/+6
| | | | | | redeclaration checking. NFC. llvm-svn: 373406
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* Use the container form llvm::sort(C, ...)Fangrui Song2018-09-301-1/+1
| | | | | | | | | There are a few leftovers of rC343147 that are not (\w+)\.begin but in the form of ([-[:alnum:]>.]+)\.begin or spanning two lines. Change them to use the container form in this commit. The 12 occurrences have been inspected manually for safety. llvm-svn: 343425
* llvm::sort(C.begin(), C.end(), ...) -> llvm::sort(C, ...)Fangrui Song2018-09-261-9/+7
| | | | | | | | | | | | | | Summary: The convenience wrapper in STLExtras is available since rL342102. Reviewers: rsmith, #clang, dblaikie Reviewed By: rsmith, #clang Subscribers: mgrang, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D52576 llvm-svn: 343147
* [ClangDiagnostics] Silence warning about fallthrough after PrintFatalErrorDavid Bolvansky2018-05-261-1/+1
| | | | | | | | | | | | | | | | | | | | Summary: ClangDiagnosticsEmitter.cpp:1047:57: warning: this statement may fall through [-Wimplicit-fallthrough=] Builder.PrintFatalError("Unknown modifier type: " + Modifier); ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~ ClangDiagnosticsEmitter.cpp:1048:5: note: here case MT_Select: { ^ Reviewers: rsmith, rtrieu Reviewed By: rtrieu Subscribers: rtrieu, ilya-biryukov, ioeric, MaskRay, jkorous, cfe-commits Differential Revision: https://reviews.llvm.org/D47340 llvm-svn: 333340
* [Clang Tablegen] Add llvm_unreachable() to getModifierName()Mark Searles2018-05-211-0/+2
| | | | | | | | | | | | | | | | | Fix internal build failure: ../../../ClangDiagnosticsEmitter.cpp -o ClangDiagnosticsEmitter.o ../../../ClangDiagnosticsEmitter.cpp: In function 'llvm::StringRef {anonymous}::getModifierName({anonymous}::ModifierType)': ../../../ClangDiagnosticsEmitter.cpp:495:1: error: control reaches end of non-void function [-Werror=return-type] } ^ Build failure triggered by git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@332799 91177308-0d34-0410-b5e6-96231b3b80d8 Differential Revision: https://reviews.llvm.org/D47150 llvm-svn: 332854
* [Clang Tablegen][RFC] Allow Early Textual Substitutions in `Diagnostic` ↵Eric Fiselier2018-05-191-263/+743
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | messages. Summary: There are cases where the same string or select is repeated verbatim in a lot of diagnostics. This can be a pain to maintain and update. Tablegen provides no way stash the common text somewhere and reuse it in the diagnostics, until now! This patch allows diagnostic texts to contain `%sub{<definition-name>}`, where `<definition-name>` names a Tablegen record of type `TextSubstitution`. These substitutions are done early, before the diagnostic string is otherwise processed. All `%sub` modifiers will be replaced before the diagnostic definitions are emitted. The substitution must specify all arguments used by the substitution, and modifier indexes in the substitution are re-numbered accordingly. For example: ``` def select_ovl_candidate : TextSubstitution<"%select{function|constructor}0%select{| template| %2}1">; ``` when used as ``` "candidate `%sub{select_ovl_candidate}3,2,1 not viable" ``` will act as if we wrote: ``` "candidate %select{function|constructor}3%select{| template| %1}2 not viable" ``` Reviewers: rsmith, rjmccall, aaron.ballman, a.sidorin Reviewed By: rjmccall Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D46740 llvm-svn: 332799
* Remove \brief commands from doxygen comments.Adrian Prantl2018-05-091-7/+7
| | | | | | | | | | | | | | | | | | | This is similar to the LLVM change https://reviews.llvm.org/D46290. We've been running doxygen with the autobrief option for a couple of years now. This makes the \brief markers into our comments redundant. Since they are a visual distraction and we don't want to encourage more \brief markers in new code either, this patch removes them all. Patch produced by for i in $(git grep -l '\@brief'); do perl -pi -e 's/\@brief //g' $i & done for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done Differential Revision: https://reviews.llvm.org/D46320 llvm-svn: 331834
* [clang] Change std::sort to llvm::sort in response to r327219Mandeep Singh Grang2018-03-271-11/+12
| | | | | | | | | | | r327219 added wrappers to std::sort which randomly shuffle the container before sorting. This will help in uncovering non-determinism caused due to undefined sorting order of objects having the same key. To make use of that infrastructure we need to invoke llvm::sort instead of std::sort. llvm-svn: 328636
* TableGen: Give up on exact fixits for diagnostic groupsNicolai Haehnle2018-03-061-32/+6
| | | | | | | | | | | With recent changes in the TableGen frontend, we no longer have usable location information for anonymous defs. Fixes test breakage caused by r326788. The normal, non-error TableGen output is not affected by this change. llvm-svn: 326822
* [TableGen] Clang changes to support Record::getValueAsString and ↵Craig Topper2017-05-311-2/+2
| | | | | | | | | | getValueAsListOfStrings returning StringRef instead of std::string This is the clang version of D33710. Differential Revision: https://reviews.llvm.org/D33711 llvm-svn: 304326
* Use noexcept instead of LLVM_NOEXCEPT now that all compilers support itReid Kleckner2016-10-191-3/+2
| | | | llvm-svn: 284667
* [docs] Order diagnostic cross-references alphabetically rather than based onRichard Smith2016-09-141-0/+1
| | | | | | order in the .td file. llvm-svn: 281434
* Update DiagnosticsReference and fix emitter to emit -Wpedantic diagnostics ↵Richard Smith2016-09-141-3/+12
| | | | | | and groups in a deterministic order. llvm-svn: 281433
* Fix a FIXME about MSVC 2013 in the diagnostic doc generation codeReid Kleckner2016-09-131-5/+7
| | | | | | Ultimately it boiled down to adding a move constructor. llvm-svn: 281408
* Work around MSVC 2013's inability to default move special members.Richard Smith2016-09-131-3/+3
| | | | llvm-svn: 281382
* Work around a GCC 4.7-specific issue: due to implementing older rules forRichard Smith2016-09-131-0/+5
| | | | | | | | | | | implicit declarations of move operations, GCC 4.7 would find that SelectPiece has neither a move constructor nor a copy constructor. The copy constructor was (correctly) deleted because the class has a member of move-only type, and the move constructor was (incorrectly, per current C++ rules) not provided because the class has a copy-only base class (in turn because it explicitly declares a destructor). llvm-svn: 281363
* Add virtual destructor (necessary due to the switch to shared_ptr).Richard Smith2016-09-121-0/+1
| | | | llvm-svn: 281198
* Attempt #3 to placate MSVC.Richard Smith2016-09-121-4/+6
| | | | llvm-svn: 281197
* Attempt #2 to placate MSVCRichard Smith2016-09-121-0/+2
| | | | llvm-svn: 281195
* Attempt to placate MSVC.Richard Smith2016-09-121-1/+3
| | | | llvm-svn: 281194
* Add a mode to clang-tblgen to generate reference documentation for warning andRichard Smith2016-09-121-0/+424
| | | | | | | | remark flags. For now I'm checking in a copy of the built documentation, but we can replace this with a placeholder (as we do for the attributes reference documentation) once we enable building this server-side. llvm-svn: 281192
* [NFC] Header cleanupMehdi Amini2016-07-181-4/+0
| | | | | | | | | | Summary: Removed unused headers, replaced some headers with forward class declarations Patch by: Eugene <claprix@yandex.ru> Differential Revision: https://reviews.llvm.org/D20100 llvm-svn: 275882
* [TableGen] Merge the SuperClass Record and SMRange vector a single vector. ↵Craig Topper2016-01-181-7/+6
| | | | | | This removes the state needed to manage the extract vector. NFC llvm-svn: 258066
* Remove many superfluous SmallString::str() calls.Yaron Keren2015-03-181-1/+1
| | | | | | | | | | | | | | | Now that SmallString is a first-class citizen, most SmallString::str() calls are not required. This patch removes a whole bunch of them, yet there are lots more. There are two use cases where str() is really needed: 1) To use one of StringRef member functions which is not available in SmallString. 2) To convert to std::string, as StringRef implicitly converts while SmallString do not. We may wish to change this, but it may introduce ambiguity. llvm-svn: 232622
* Use the ShowInSystemHeader bit consistently for all diagnosticsAlp Toker2014-06-161-2/+1
| | | | | | | | | | | | 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
* Complete the switch from mappings to declarative diagnostic severitiesAlp Toker2014-06-121-3/+5
| | | | | | | | | 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
* [C++11] Use 'nullptr'.Craig Topper2014-05-071-3/+4
| | | | llvm-svn: 208163
* tblgen: Modularize the diagnostic emitterTobias Grosser2014-05-061-88/+198
| | | | | | | | | | | | | | | | | | | Replace a large monolitic function, with per-table functions which all nicely fit on my screen. I also added documentation to each function that describes what kind of tables are generated and which information is contained and switched to range based for loops. Finally, I run clang-format over the moved code. I spent a significant amount of time to understand this code when reasoning about possible extensions to the diagnostic interface to support 'remark' diagnostics. This change will definitely help such an implementation, but already by itself it will save other people a lot of time when trying to understand this functionality. Even though the patch touches the full function, it is mostly mechanical. No functional change intended. The generated tblgen files are identical. llvm-svn: 208136
* [C++11] Replace verbose functors with succinct lambdasBenjamin Kramer2014-03-011-12/+3
| | | | | | No functionality change. llvm-svn: 202590
* Add 'remark' diagnostic type in 'clang'Tobias Grosser2014-02-281-0/+13
| | | | | | | | | | | | | | | | | | | | | | | 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
* 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
* Move individual group name strings from the OptionTable into one big char ↵Craig Topper2013-08-291-10/+22
| | | | | | 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-1/+3
| | | | | | ~4K from clang binary. llvm-svn: 189445
* Merge diagnostic group tables to reduce data size and relocation entries.Craig Topper2013-08-281-14/+37
| | | | | | | | 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
* Const-correct some iterators. No functional change.Craig Topper2013-07-211-9/+9
| | | | llvm-svn: 186797
* Remove trailing whitespaceCraig Topper2013-07-191-28/+28
| | | | llvm-svn: 186722
* ArrayRef<T>() -> None cleanupDmitri Gribenko2013-05-051-1/+1
| | | | llvm-svn: 181140
* Strip 'llvm' from 'llvm::Optional' uses.Ted Kremenek2013-02-211-1/+1
| | | | llvm-svn: 175701
* Error if an anonymous DiagGroup is referenced multiple times.Jordan Rose2013-01-101-2/+119
| | | | | | | | | | | Not only is this inefficient for TableGen, it's annoying for maintenance when renaming warning flags (unusual) or adding those flags to a group (more likely). This uses the new fix-it infrastructure for LLVM's SourceMgr/SMDiagnostic, as well as a few changes to TableGen to track more source information. llvm-svn: 172087
* Sort the #include lines under utils/...Chandler Carruth2012-12-041-2/+2
| | | | llvm-svn: 169245
* Don't throw exceptions in clang-tblgen by switching to PrintFatalError.Joerg Sonnenberger2012-10-251-3/+5
| | | | | | Add locations in a number of places, where they are available for free. llvm-svn: 166691
* tblgen: Use LLVM-style RTTI in clang-tblgenSean Silva2012-10-101-6/+6
| | | | llvm-svn: 165649
* Fix horrible regression in control of warnings caused by introduction of ↵Ted Kremenek2012-08-101-4/+12
| | | | | | | | | | | | | | | -Wpedantic. While -Wpedantic was reasonable, -Wno-pedantic would turn off a bunch of warnings that are on by default. This counters the intention of this warning flag. To fix this, -Wpedantic now includes extentions that are not on by default. The remaining warnings will manifest anyway, and won't accidentally get turned off by -Wno-pedantic. Fixes <rdar://problem/12076105> llvm-svn: 161695
* Add missing cctype includes.Joerg Sonnenberger2012-08-101-0/+1
| | | | llvm-svn: 161660
* Enhance ClangDiagnosticsEmitter to reject diagnostics that are errors that ↵Ted Kremenek2012-08-071-0/+17
| | | | | | | | | | | | | | are also included in warning groups. Warning groups can only contain warnings, because only warnings can be mapped to errors or ignored. This caught a few diagnostics that were incorrectly in diagnostic groups, and could have resulted in a compiler crash when those diagnostic groups were mapped. Fixes <rdar://problem/12044436> llvm-svn: 161389
* Re-apply r159875 with fixes.Ted Kremenek2012-07-071-10/+229
| | | | | | | - Split pedantic driver flag test into separate test file, and XFAIL on cygwin,mingw32 - Fix bug in tablegen logic where a missing '{' caused errors to be included in -Wpedantic. llvm-svn: 159892
* Revert rr159875, "Implement -Wpedantic and --no-pedantic to complement ↵NAKAMURA Takumi2012-07-071-228/+10
| | | | | | | | | | -Weverything." It broke several builds. I suspect FileCheck might match assertion failure, even if clang/test/Misc/warning-flags.c passed the test. > 0. Program arguments: bin/./clang -### -pedantic -Wpedantic clang/test/Driver/warning-options.cpp llvm-svn: 159886
* Implement -Wpedantic and --no-pedantic to complement -Weverything.Ted Kremenek2012-07-061-10/+228
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch introduces some magic in tablegen to create a "Pedantic" diagnostic group which automagically includes all warnings that are extensions. This allows a user to suppress specific warnings traditionally under -pedantic used an ordinary warning flag. This also allows users to use #pragma to silence specific -pedantic warnings, or promote them to errors, within blocks of text (just like any other warning). -Wpedantic is NOT an alias for -pedantic. Instead, it provides another way to (a) activate -pedantic warnings and (b) disable them. Where they differ is that -pedantic changes the behavior of the preprocessor slightly, whereas -Wpedantic does not (it just turns on the warnings). The magic in the tablegen diagnostic emitter has to do with computing the minimal set of diagnostic groups and diagnostics that should go into -Wpedantic, as those diagnostics that already members of groups that themselves are (transitively) members of -Wpedantic do not need to be included in the Pedantic group directly. I went back and forth on whether or not to magically generate this group, and the invariant was that we always wanted extension warnings to be included in -Wpedantic "some how", but the bookkeeping would be very onerous to manage by hand. -no-pedantic (and --no-pedantic) is included for completeness, and matches many of the same kind of flags the compiler already supports. It does what it says: cancels out -pedantic. One discrepancy is that if one specifies --no-pedantic and -Weverything or -Wpedantic the pedantic warnings are still enabled (essentially the -W flags win). We can debate the correct behavior here. Along the way, this patch nukes some code in TextDiagnosticPrinter.cpp and CXStoredDiagnostic.cpp that determine whether to include the "-pedantic" flag in the warning output. This is no longer needed, as all extensions now have a -W flag. This patch also significantly reduces the number of warnings not under flags from 229 to 158 (all extension warnings). That's a 31% reduction. llvm-svn: 159875
OpenPOWER on IntegriCloud