aboutsummaryrefslogtreecommitdiff
path: root/lib/Parse/ParseDecl.cpp
diff options
context:
space:
mode:
authorSteve Naroff <snaroff@apple.com>2008-12-25 14:16:32 +0000
committerSteve Naroff <snaroff@apple.com>2008-12-25 14:16:32 +0000
commit239f07384fe5e7194e780d98a17553084efeeb44 (patch)
tree26e5876ad3a736211068655aaf7fb7840e0e4b94 /lib/Parse/ParseDecl.cpp
parent776caefc70360a00ee860f63d7f76288d5f41d87 (diff)
Add parser support for __cdecl, __stdcall, and __fastcall.
Change preprocessor implementation of _cdecl to reference __cdecl. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61430 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseDecl.cpp')
-rw-r--r--lib/Parse/ParseDecl.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp
index a8052dc290..bf75ab0e93 100644
--- a/lib/Parse/ParseDecl.cpp
+++ b/lib/Parse/ParseDecl.cpp
@@ -560,6 +560,15 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
FuzzyParseMicrosoftDeclSpec();
continue;
+ // Microsoft single token adornments.
+ case tok::kw___cdecl:
+ case tok::kw___stdcall:
+ case tok::kw___fastcall:
+ if (!PP.getLangOptions().Microsoft)
+ goto DoneWithDeclSpec;
+ // Just ignore it.
+ break;
+
// storage-class-specifier
case tok::kw_typedef:
isInvalid = DS.SetStorageClassSpec(DeclSpec::SCS_typedef, Loc, PrevSpec);
@@ -798,6 +807,11 @@ bool Parser::MaybeParseTypeSpecifier(DeclSpec &DS, int& isInvalid,
ParseTypeofSpecifier(DS);
return true;
+ case tok::kw___cdecl:
+ case tok::kw___stdcall:
+ case tok::kw___fastcall:
+ return PP.getLangOptions().Microsoft;
+
default:
// Not a type-specifier; do nothing.
return false;
@@ -1199,6 +1213,11 @@ bool Parser::isTypeSpecifierQualifier() {
// GNU ObjC bizarre protocol extension: <proto1,proto2> with implicit 'id'.
case tok::less:
return getLang().ObjC1;
+
+ case tok::kw___cdecl:
+ case tok::kw___stdcall:
+ case tok::kw___fastcall:
+ return PP.getLangOptions().Microsoft;
}
}
@@ -1268,6 +1287,11 @@ bool Parser::isDeclarationSpecifier() {
// GNU ObjC bizarre protocol extension: <proto1,proto2> with implicit 'id'.
case tok::less:
return getLang().ObjC1;
+
+ case tok::kw___cdecl:
+ case tok::kw___stdcall:
+ case tok::kw___fastcall:
+ return PP.getLangOptions().Microsoft;
}
}
@@ -1298,6 +1322,13 @@ void Parser::ParseTypeQualifierListOpt(DeclSpec &DS, bool AttributesAllowed) {
isInvalid = DS.SetTypeQual(DeclSpec::TQ_restrict, Loc, PrevSpec,
getLang())*2;
break;
+ case tok::kw___cdecl:
+ case tok::kw___stdcall:
+ case tok::kw___fastcall:
+ if (!PP.getLangOptions().Microsoft)
+ goto DoneWithTypeQuals;
+ // Just ignore it.
+ break;
case tok::kw___attribute:
if (AttributesAllowed) {
DS.AddAttributes(ParseAttributes());
@@ -1305,6 +1336,7 @@ void Parser::ParseTypeQualifierListOpt(DeclSpec &DS, bool AttributesAllowed) {
}
// otherwise, FALL THROUGH!
default:
+ DoneWithTypeQuals:
// If this is not a type-qualifier token, we're done reading type
// qualifiers. First verify that DeclSpec's are consistent.
DS.Finish(Diags, PP.getSourceManager(), getLang());
@@ -1632,6 +1664,10 @@ void Parser::ParseParenDeclarator(Declarator &D) {
// present even if the attribute list was empty.
RequiresArg = true;
}
+ // Eat any Microsoft extensions.
+ if ((Tok.is(tok::kw___cdecl) || Tok.is(tok::kw___stdcall) ||
+ (Tok.is(tok::kw___fastcall))) && PP.getLangOptions().Microsoft)
+ ConsumeToken();
// If we haven't past the identifier yet (or where the identifier would be
// stored, if this is an abstract declarator), then this is probably just