diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-01-29 01:24:26 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-01-29 01:24:26 +0000 |
commit | 5cd532ca0bc1cb8110e24586d064f72332d8b767 (patch) | |
tree | fda31159ec2c469b75d54fca5e6c98a0a96733e4 /lib | |
parent | a438b2d277fae00a4fa467ffcf382246e0a201e9 (diff) |
Replace AS_MSTypespec with AS_Keyword, for representing any attribute spelled
as a keyword. Rationalize existing attributes to use it as appropriate, and to
not lie about some __declspec attributes being GNU attributes. In passing,
remove a gross hack which was discarding attributes which we could handle. This
results in us actually respecting the __pascal keyword again.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173746 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Parse/ParseDecl.cpp | 12 | ||||
-rw-r--r-- | lib/Sema/SemaDeclAttr.cpp | 10 | ||||
-rw-r--r-- | lib/Sema/SemaType.cpp | 7 |
3 files changed, 12 insertions, 17 deletions
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp index a851e2cb85..e6e010bd9c 100644 --- a/lib/Parse/ParseDecl.cpp +++ b/lib/Parse/ParseDecl.cpp @@ -462,7 +462,7 @@ void Parser::ParseMicrosoftTypeAttributes(ParsedAttributes &attrs) { IdentifierInfo *AttrName = Tok.getIdentifierInfo(); SourceLocation AttrNameLoc = ConsumeToken(); attrs.addNew(AttrName, AttrNameLoc, 0, AttrNameLoc, 0, - SourceLocation(), 0, 0, AttributeList::AS_MSTypespec); + SourceLocation(), 0, 0, AttributeList::AS_Keyword); } } @@ -472,21 +472,23 @@ void Parser::ParseBorlandTypeAttributes(ParsedAttributes &attrs) { IdentifierInfo *AttrName = Tok.getIdentifierInfo(); SourceLocation AttrNameLoc = ConsumeToken(); attrs.addNew(AttrName, AttrNameLoc, 0, AttrNameLoc, 0, - SourceLocation(), 0, 0, AttributeList::AS_MSTypespec); + SourceLocation(), 0, 0, AttributeList::AS_Keyword); } } void Parser::ParseOpenCLAttributes(ParsedAttributes &attrs) { // Treat these like attributes while (Tok.is(tok::kw___kernel)) { + IdentifierInfo *AttrName = Tok.getIdentifierInfo(); SourceLocation AttrNameLoc = ConsumeToken(); - attrs.addNew(PP.getIdentifierInfo("opencl_kernel_function"), - AttrNameLoc, 0, AttrNameLoc, 0, - SourceLocation(), 0, 0, AttributeList::AS_GNU); + attrs.addNew(AttrName, AttrNameLoc, 0, AttrNameLoc, 0, + SourceLocation(), 0, 0, AttributeList::AS_Keyword); } } void Parser::ParseOpenCLQualifiers(DeclSpec &DS) { + // FIXME: The mapping from attribute spelling to semantics should be + // performed in Sema, not here. SourceLocation Loc = Tok.getLocation(); switch(Tok.getKind()) { // OpenCL qualifiers: diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp index adeb8e690f..12483a34e0 100644 --- a/lib/Sema/SemaDeclAttr.cpp +++ b/lib/Sema/SemaDeclAttr.cpp @@ -4759,11 +4759,11 @@ static void ProcessDeclAttribute(Sema &S, Scope *scope, Decl *D, if (Attr.isInvalid()) return; - // Type attributes are still treated as declaration attributes by - // ParseMicrosoftTypeAttributes and ParseBorlandTypeAttributes. We don't - // want to process them, however, because we will simply warn about ignoring - // them. So instead, we will bail out early. - if (Attr.isMSTypespecAttribute()) + // FIXME: Ignore unknown keyword attributes for now. We see this in the case + // of some Borland attributes, like __pascal. + // FIXME: Add these attributes to Attr.td and mark as ignored! + if (Attr.isKeywordAttribute() && + Attr.getKind() == AttributeList::UnknownAttribute) return; // Ignore C++11 attributes on declarator chunks: they appertain to the type diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp index 4819363f27..c101de844b 100644 --- a/lib/Sema/SemaType.cpp +++ b/lib/Sema/SemaType.cpp @@ -4336,13 +4336,6 @@ static void processTypeAttrs(TypeProcessingState &state, QualType &type, attr.setUsedAsTypeAttr(); break; - case AttributeList::AT_Win64: - case AttributeList::AT_Ptr32: - case AttributeList::AT_Ptr64: - // FIXME: don't ignore these - attr.setUsedAsTypeAttr(); - break; - case AttributeList::AT_NSReturnsRetained: if (!state.getSema().getLangOpts().ObjCAutoRefCount) break; |