зеркало из https://github.com/microsoft/clang-1.git
Parse the exception-specification throw(...), a Microsoft extension
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60359 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
ac72d40340
Коммит
a4745616eb
|
@ -587,6 +587,8 @@ DIAG(warn_parens_disambiguated_as_function_decl, WARNING,
|
||||||
"parentheses were disambiguated as a function declarator")
|
"parentheses were disambiguated as a function declarator")
|
||||||
DIAG(err_expected_member_or_base_name, ERROR,
|
DIAG(err_expected_member_or_base_name, ERROR,
|
||||||
"expected class member or base class name")
|
"expected class member or base class name")
|
||||||
|
DIAG(ext_ellipsis_exception_spec, EXTENSION,
|
||||||
|
"exception specification of '...' is a Microsoft extension")
|
||||||
|
|
||||||
// Language specific pragmas
|
// Language specific pragmas
|
||||||
|
|
||||||
|
|
|
@ -763,12 +763,13 @@ Parser::MemInitResult Parser::ParseMemInitializer(DeclTy *ConstructorDecl) {
|
||||||
/// ParseExceptionSpecification - Parse a C++ exception-specification
|
/// ParseExceptionSpecification - Parse a C++ exception-specification
|
||||||
/// (C++ [except.spec]).
|
/// (C++ [except.spec]).
|
||||||
///
|
///
|
||||||
/// exception-specification:
|
/// exception-specification:
|
||||||
/// 'throw' '(' type-id-list [opt] ')'
|
/// 'throw' '(' type-id-list [opt] ')'
|
||||||
|
/// [MS] 'throw' '(' '...' ')'
|
||||||
///
|
///
|
||||||
/// type-id-list:
|
/// type-id-list:
|
||||||
/// type-id
|
/// type-id
|
||||||
/// type-id-list ',' type-id
|
/// type-id-list ',' type-id
|
||||||
///
|
///
|
||||||
bool Parser::ParseExceptionSpecification() {
|
bool Parser::ParseExceptionSpecification() {
|
||||||
assert(Tok.is(tok::kw_throw) && "expected throw");
|
assert(Tok.is(tok::kw_throw) && "expected throw");
|
||||||
|
@ -780,6 +781,16 @@ bool Parser::ParseExceptionSpecification() {
|
||||||
}
|
}
|
||||||
SourceLocation LParenLoc = ConsumeParen();
|
SourceLocation LParenLoc = ConsumeParen();
|
||||||
|
|
||||||
|
// Parse throw(...), a Microsoft extension that means "this function
|
||||||
|
// can throw anything".
|
||||||
|
if (Tok.is(tok::ellipsis)) {
|
||||||
|
SourceLocation EllipsisLoc = ConsumeToken();
|
||||||
|
if (!getLang().Microsoft)
|
||||||
|
Diag(EllipsisLoc, diag::ext_ellipsis_exception_spec);
|
||||||
|
SourceLocation RParenLoc = MatchRHSPunctuation(tok::r_paren, LParenLoc);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Parse the sequence of type-ids.
|
// Parse the sequence of type-ids.
|
||||||
while (Tok.isNot(tok::r_paren)) {
|
while (Tok.isNot(tok::r_paren)) {
|
||||||
ParseTypeName();
|
ParseTypeName();
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
// RUN: clang %s -fsyntax-only -verify -fms-extensions
|
||||||
|
|
||||||
|
void f() throw(...) { }
|
Загрузка…
Ссылка в новой задаче