diff options
author | Francois Pichet <pichet2000@gmail.com> | 2010-10-11 12:59:39 +0000 |
---|---|---|
committer | Francois Pichet <pichet2000@gmail.com> | 2010-10-11 12:59:39 +0000 |
commit | c2bc5ac1494c9160593ccbfe512a0bc3b1eb7888 (patch) | |
tree | dc564a750d0d77669ec23e375d868df8285023a3 /clang/lib/Parse/ParseDeclCXX.cpp | |
parent | d61f192b1ad0530c671f6036742ab0291475c69c (diff) | |
download | bcm5719-llvm-c2bc5ac1494c9160593ccbfe512a0bc3b1eb7888.tar.gz bcm5719-llvm-c2bc5ac1494c9160593ccbfe512a0bc3b1eb7888.zip |
Add parsing support for Microsoft attributes. MS attributes will just be skipped and not inserted into the AST for now.
llvm-svn: 116203
Diffstat (limited to 'clang/lib/Parse/ParseDeclCXX.cpp')
-rw-r--r-- | clang/lib/Parse/ParseDeclCXX.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp index e1a97da9c2e..c02f41a2681 100644 --- a/clang/lib/Parse/ParseDeclCXX.cpp +++ b/clang/lib/Parse/ParseDeclCXX.cpp @@ -121,6 +121,8 @@ Decl *Parser::ParseNamespace(unsigned Context, CXX0XAttributeList Attr; if (getLang().CPlusPlus0x && isCXX0XAttributeSpecifier()) Attr = ParseCXX0XAttributes(); + if (getLang().Microsoft && Tok.is(tok::l_square)) + ParseMicrosoftAttributes(); ParseExternalDeclaration(Attr); } @@ -205,6 +207,8 @@ Decl *Parser::ParseLinkage(ParsingDeclSpec &DS, if (getLang().CPlusPlus0x && isCXX0XAttributeSpecifier()) { Attr = ParseCXX0XAttributes(); } + if (getLang().Microsoft && Tok.is(tok::l_square)) + ParseMicrosoftAttributes(); if (Tok.isNot(tok::l_brace)) { DS.setExternInLinkageSpec(true); @@ -224,6 +228,8 @@ Decl *Parser::ParseLinkage(ParsingDeclSpec &DS, CXX0XAttributeList Attr; if (getLang().CPlusPlus0x && isCXX0XAttributeSpecifier()) Attr = ParseCXX0XAttributes(); + if (getLang().Microsoft && Tok.is(tok::l_square)) + ParseMicrosoftAttributes(); ParseExternalDeclaration(Attr); } @@ -1321,6 +1327,8 @@ void Parser::ParseCXXClassMemberDeclaration(AccessSpecifier AS, // Optional C++0x attribute-specifier if (getLang().CPlusPlus0x && isCXX0XAttributeSpecifier()) AttrList = ParseCXX0XAttributes(); + if (getLang().Microsoft && Tok.is(tok::l_square)) + ParseMicrosoftAttributes(); if (Tok.is(tok::kw_using)) { // FIXME: Check for template aliases @@ -2116,3 +2124,21 @@ ExprResult Parser::ParseCXX0XAlignArgument(SourceLocation Start) { } else return ParseConstantExpression(); } + +/// ParseMicrosoftAttributes - Parse a Microsoft attribute [Attr] +/// +/// [MS] ms-attribute: +/// '[' token-seq ']' +/// +/// [MS] ms-attribute-seq: +/// ms-attribute[opt] +/// ms-attribute ms-attribute-seq +void Parser::ParseMicrosoftAttributes() { + assert(Tok.is(tok::l_square) && "Not a Microsoft attribute list"); + + while (Tok.is(tok::l_square)) { + ConsumeBracket(); + SkipUntil(tok::r_square, true, true); + ExpectAndConsume(tok::r_square, diag::err_expected_rsquare); + } +} |