mirror of
https://github.com/Gericom/teak-llvm.git
synced 2025-06-25 14:28:54 -04:00

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
42 lines
1.1 KiB
C++
42 lines
1.1 KiB
C++
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
|
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
|
|
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
|
|
|
|
struct S {
|
|
S();
|
|
#if __cplusplus <= 199711L
|
|
// expected-note@-2 {{because type 'S' has a user-provided default constructor}}
|
|
#endif
|
|
};
|
|
|
|
struct { // expected-error {{anonymous structs and classes must be class members}}
|
|
};
|
|
|
|
struct E {
|
|
struct {
|
|
S x;
|
|
#if __cplusplus <= 199711L
|
|
// expected-error@-2 {{anonymous struct member 'x' has a non-trivial default constructor}}
|
|
#endif
|
|
};
|
|
static struct {
|
|
};
|
|
class {
|
|
int anon_priv_field; // expected-error {{anonymous struct cannot contain a private data member}}
|
|
};
|
|
};
|
|
|
|
template <class T> void foo(T);
|
|
typedef struct { // expected-note {{use a tag name here to establish linkage prior to definition}}
|
|
#if __cplusplus <= 199711L
|
|
// expected-note@-2 {{declared here}}
|
|
#endif
|
|
|
|
void test() {
|
|
foo(this);
|
|
#if __cplusplus <= 199711L
|
|
// expected-warning@-2 {{template argument uses unnamed type}}
|
|
#endif
|
|
}
|
|
} A; // expected-error {{unsupported: typedef changes linkage of anonymous type, but linkage was already computed}}
|