llvm-project/clang/utils
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
..
ABITest Add back the ABITest makefiles 2016-02-03 17:16:01 +00:00
CIndex
ClangVisualizers Improved Visual Studio visualization of OpaquePtr 2016-06-13 04:02:35 +00:00
TableGen [Clang Tablegen][RFC] Allow Early Textual Substitutions in `Diagnostic` messages. 2018-05-19 03:12:04 +00:00
TestUtils
VtableTest Remove autoconf support 2016-01-26 21:30:40 +00:00
analyzer [analyzer] [testing] Be less verbose by default in integration testing. 2018-03-29 01:23:54 +00:00
check_cfc Fix typos in clang 2018-04-06 15:14:32 +00:00
perf-training [clang] Enable clang build with LLVM_BUILD_INSTRUMENTED without setting LLVM_PROFTDATA 2017-10-13 03:21:39 +00:00
valgrind
CaptureCmd
ClangDataFormat.py
CmpDriver
FindSpecRefs
FuzzTest
bash-autocomplete.sh Fix typos in clang 2018-04-06 15:14:32 +00:00
builtin-defines.c
clangdiag.py Fix typos in clang 2018-04-06 15:14:32 +00:00
find-unused-diagnostics.sh Unused diagnostics can occur in tblgen. 2018-01-25 15:57:22 +00:00
modfuzz.py Add simple, stupid, pattern-based fuzzer / reducer for modules bugs. I've 2016-06-27 19:43:46 +00:00
token-delta.py