Parse the exception-specification throw(...), a Microsoft extension

llvm-svn: 60359
This commit is contained in:
Douglas Gregor 2008-12-01 18:00:20 +00:00
parent 08a4e2045d
commit 356513d7d0
3 changed files with 21 additions and 5 deletions

View File

@ -587,6 +587,8 @@ DIAG(warn_parens_disambiguated_as_function_decl, WARNING,
"parentheses were disambiguated as a function declarator")
DIAG(err_expected_member_or_base_name, ERROR,
"expected class member or base class name")
DIAG(ext_ellipsis_exception_spec, EXTENSION,
"exception specification of '...' is a Microsoft extension")
// Language specific pragmas

View File

@ -765,6 +765,7 @@ Parser::MemInitResult Parser::ParseMemInitializer(DeclTy *ConstructorDecl) {
///
/// exception-specification:
/// 'throw' '(' type-id-list [opt] ')'
/// [MS] 'throw' '(' '...' ')'
///
/// type-id-list:
/// type-id
@ -780,6 +781,16 @@ bool Parser::ParseExceptionSpecification() {
}
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.
while (Tok.isNot(tok::r_paren)) {
ParseTypeName();

View File

@ -0,0 +1,3 @@
// RUN: clang %s -fsyntax-only -verify -fms-extensions
void f() throw(...) { }