llvm-project/clang/utils/TableGen
Eric Fiselier b87be18d8e [Clang Tablegen][RFC] Allow Early Textual Substitutions in `Diagnostic` 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
2018-05-19 03:12:04 +00:00
..
CMakeLists.txt Move the clang-tblgen project into the Clang tablegenning folder on IDEs like Visual Studio rather than leave it in the root directory. NFC. 2017-11-04 20:06:22 +00:00
ClangASTNodesEmitter.cpp TableGen: Adapt to llvm r288612 2016-12-04 05:55:09 +00:00
ClangAttrEmitter.cpp Remove \brief commands from doxygen comments. 2018-05-09 01:00:01 +00:00
ClangCommentCommandInfoEmitter.cpp Fix Clang-tidy modernize-use-nullptr warnings in headers and generated files; other minor cleanups. 2015-09-29 20:56:43 +00:00
ClangCommentHTMLNamedCharacterReferenceEmitter.cpp Remove \brief commands from doxygen comments. 2018-05-09 01:00:01 +00:00
ClangCommentHTMLTagsEmitter.cpp Replace push_back(Constructor(foo)) with emplace_back(foo) for non-trivial types 2015-05-29 19:42:19 +00:00
ClangDataCollectorsEmitter.cpp Add '\n' in ClangDataCollectorsEmitter 2017-09-08 16:17:16 +00:00
ClangDiagnosticsEmitter.cpp [Clang Tablegen][RFC] Allow Early Textual Substitutions in `Diagnostic` messages. 2018-05-19 03:12:04 +00:00
ClangOptionDocEmitter.cpp [clang] Change std::sort to llvm::sort in response to r327219 2018-03-27 16:50:00 +00:00
ClangSACheckersEmitter.cpp Remove \brief commands from doxygen comments. 2018-05-09 01:00:01 +00:00
NeonEmitter.cpp [ARM,AArch64] Add intrinsics for dot product instructions 2018-04-27 14:03:32 +00:00
TableGen.cpp [AArch64] Add ARMv8.2-A FP16 scalar intrinsics 2018-01-19 23:11:18 +00:00
TableGenBackends.h [AArch64] Add ARMv8.2-A FP16 scalar intrinsics 2018-01-19 23:11:18 +00:00