diff options
author | Eric Fiselier <eric@efcs.ca> | 2018-05-19 03:12:04 +0000 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2018-05-19 03:12:04 +0000 |
commit | b87be18d8e82505014e272b0535e7250073cbc8c (patch) | |
tree | 1ef86183adf22730e0af9b3698a1e961850db5d7 /clang/test/SemaCXX/anonymous-struct.cpp | |
parent | 926b0b2bf53c41dc9928611d6878981d361e55d9 (diff) | |
download | bcm5719-llvm-b87be18d8e82505014e272b0535e7250073cbc8c.tar.gz bcm5719-llvm-b87be18d8e82505014e272b0535e7250073cbc8c.zip |
[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
Diffstat (limited to 'clang/test/SemaCXX/anonymous-struct.cpp')
-rw-r--r-- | clang/test/SemaCXX/anonymous-struct.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/test/SemaCXX/anonymous-struct.cpp b/clang/test/SemaCXX/anonymous-struct.cpp index bb7e6eb92da..f89d19959b8 100644 --- a/clang/test/SemaCXX/anonymous-struct.cpp +++ b/clang/test/SemaCXX/anonymous-struct.cpp @@ -16,7 +16,7 @@ struct E { struct { S x; #if __cplusplus <= 199711L - // expected-error@-2 {{anonymous struct member 'x' has a non-trivial constructor}} + // expected-error@-2 {{anonymous struct member 'x' has a non-trivial default constructor}} #endif }; static struct { |