r228121 - Parse: Handle __declspec in a lambda definition
David Majnemer
david.majnemer at gmail.com
Wed Feb 4 00:22:47 PST 2015
Author: majnemer
Date: Wed Feb 4 02:22:46 2015
New Revision: 228121
URL: http://llvm.org/viewvc/llvm-project?rev=228121&view=rev
Log:
Parse: Handle __declspec in a lambda definition
Modified:
cfe/trunk/lib/Parse/ParseExprCXX.cpp
cfe/trunk/test/SemaCXX/ms-novtable.cpp
Modified: cfe/trunk/lib/Parse/ParseExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExprCXX.cpp?rev=228121&r1=228120&r2=228121&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseExprCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseExprCXX.cpp Wed Feb 4 02:22:46 2015
@@ -1085,6 +1085,11 @@ ExprResult Parser::ParseLambdaExpression
// compatible with GCC.
MaybeParseGNUAttributes(Attr, &DeclEndLoc);
+ // MSVC-style attributes must be parsed before the mutable specifier to be
+ // compatible with MSVC.
+ while (Tok.is(tok::kw___declspec))
+ ParseMicrosoftDeclSpec(Attr);
+
// Parse 'mutable'[opt].
SourceLocation MutableLoc;
if (TryConsumeToken(tok::kw_mutable, MutableLoc))
Modified: cfe/trunk/test/SemaCXX/ms-novtable.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/ms-novtable.cpp?rev=228121&r1=228120&r2=228121&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/ms-novtable.cpp (original)
+++ cfe/trunk/test/SemaCXX/ms-novtable.cpp Wed Feb 4 02:22:46 2015
@@ -4,3 +4,4 @@ struct __declspec(novtable) S {};
enum __declspec(novtable) E {}; // expected-warning{{'novtable' attribute only applies to classes}}
int __declspec(novtable) I; // expected-warning{{'novtable' attribute only applies to classes}}
typedef struct T __declspec(novtable) U; // expected-warning{{'novtable' attribute only applies to classes}}
+auto z = []() __declspec(novtable) { return nullptr; }; // expected-warning{{'novtable' attribute only applies to classes}}
More information about the cfe-commits
mailing list