[cfe-commits] r60359 - in /cfe/trunk: include/clang/Basic/DiagnosticKinds.def lib/Parse/ParseDeclCXX.cpp test/SemaCXX/ms-exception-spec.cpp
Douglas Gregor
doug.gregor at gmail.com
Mon Dec 1 10:00:31 PST 2008
Author: dgregor
Date: Mon Dec 1 12:00:20 2008
New Revision: 60359
URL: http://llvm.org/viewvc/llvm-project?rev=60359&view=rev
Log:
Parse the exception-specification throw(...), a Microsoft extension
Added:
cfe/trunk/test/SemaCXX/ms-exception-spec.cpp
Modified:
cfe/trunk/include/clang/Basic/DiagnosticKinds.def
cfe/trunk/lib/Parse/ParseDeclCXX.cpp
Modified: cfe/trunk/include/clang/Basic/DiagnosticKinds.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticKinds.def?rev=60359&r1=60358&r2=60359&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticKinds.def (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticKinds.def Mon Dec 1 12:00:20 2008
@@ -587,6 +587,8 @@
"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
Modified: cfe/trunk/lib/Parse/ParseDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDeclCXX.cpp?rev=60359&r1=60358&r2=60359&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDeclCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDeclCXX.cpp Mon Dec 1 12:00:20 2008
@@ -763,12 +763,13 @@
/// ParseExceptionSpecification - Parse a C++ exception-specification
/// (C++ [except.spec]).
///
-/// exception-specification:
-/// 'throw' '(' type-id-list [opt] ')'
+/// exception-specification:
+/// 'throw' '(' type-id-list [opt] ')'
+/// [MS] 'throw' '(' '...' ')'
///
-/// type-id-list:
-/// type-id
-/// type-id-list ',' type-id
+/// type-id-list:
+/// type-id
+/// type-id-list ',' type-id
///
bool Parser::ParseExceptionSpecification() {
assert(Tok.is(tok::kw_throw) && "expected throw");
@@ -780,6 +781,16 @@
}
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();
Added: cfe/trunk/test/SemaCXX/ms-exception-spec.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/ms-exception-spec.cpp?rev=60359&view=auto
==============================================================================
--- cfe/trunk/test/SemaCXX/ms-exception-spec.cpp (added)
+++ cfe/trunk/test/SemaCXX/ms-exception-spec.cpp Mon Dec 1 12:00:20 2008
@@ -0,0 +1,3 @@
+// RUN: clang %s -fsyntax-only -verify -fms-extensions
+
+void f() throw(...) { }
More information about the cfe-commits
mailing list