From 79f3a8700759c33c6a4cb5b8ce9fd0ad0bf57bcf Mon Sep 17 00:00:00 2001 From: Francois Pichet Date: Mon, 31 Jan 2011 04:54:32 +0000 Subject: [PATCH] Allow Microsoft attributes in a constructor's parameter list. This fixes a few compile errors when parsing from MSVC 2008 with clang. llvm-svn: 124573 --- clang/lib/Parse/ParseDecl.cpp | 4 ++++ clang/test/Parser/MicrosoftExtensions.cpp | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index c4fce66b6577..24e41d073799 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/lib/Parse/ParseDecl.cpp @@ -2512,6 +2512,10 @@ bool Parser::isConstructorDeclarator() { if (SS.isSet() && Actions.ShouldEnterDeclaratorScope(getCurScope(), SS)) DeclScopeObj.EnterDeclaratorScope(); + // Optionally skip Microsoft attributes. + ParsedAttributes Attrs; + MaybeParseMicrosoftAttributes(Attrs); + // Check whether the next token(s) are part of a declaration // specifier, in which case we have the start of a parameter and, // therefore, we know that this is a constructor. diff --git a/clang/test/Parser/MicrosoftExtensions.cpp b/clang/test/Parser/MicrosoftExtensions.cpp index 1d5811496a76..fd0d7d50d0eb 100644 --- a/clang/test/Parser/MicrosoftExtensions.cpp +++ b/clang/test/Parser/MicrosoftExtensions.cpp @@ -22,6 +22,14 @@ extern "C" { int foo5([SA_Post(attr=1)] void *param); } +class class_attr { +public: + class_attr([SA_Pre(Null=SA_No,NullTerminated=SA_Yes)] int a) + { + } +}; + + void uuidof_test1() {