clang/test/TableGen
Eric Fiselier a6a3cf5fce [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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@332799 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-19 03:12:04 +00:00
..
DiagnosticBase.inc [Clang Tablegen][RFC] Allow Early Textual Substitutions in `Diagnostic` messages. 2018-05-19 03:12:04 +00:00
DiagnosticDocs.inc [Clang Tablegen][RFC] Allow Early Textual Substitutions in `Diagnostic` messages. 2018-05-19 03:12:04 +00:00
anonymous-groups.td TableGen: Give up on exact fixits for diagnostic groups 2018-03-06 17:55:00 +00:00
emit-diag-docs.td [Clang Tablegen][RFC] Allow Early Textual Substitutions in `Diagnostic` messages. 2018-05-19 03:12:04 +00:00
lit.local.cfg
text-substitution.td [Clang Tablegen][RFC] Allow Early Textual Substitutions in `Diagnostic` messages. 2018-05-19 03:12:04 +00:00
tg-fixits.td TableGen: Give up on exact fixits for diagnostic groups 2018-03-06 17:55:00 +00:00