Commit 51fbf969 authored by Erik Verbruggen's avatar Erik Verbruggen
Browse files

Added support for the GCC "unavailable" attribute.

parent 9e89f36c
......@@ -439,8 +439,12 @@ bool CheckSpecifier::visit(TypeofSpecifierAST *ast)
bool CheckSpecifier::visit(AttributeAST *ast)
{
if (ast->identifier_token) {
if (identifier(ast->identifier_token) == control()->deprecatedId())
const Identifier *id = identifier(ast->identifier_token);
if (id == control()->deprecatedId())
_fullySpecifiedType.setDeprecated(true);
else if (id == control()->unavailableId())
_fullySpecifiedType.setUnavailable(true);
}
return false;
}
......@@ -516,6 +516,7 @@ public:
std::vector<Symbol *> symbols;
const Identifier *deprecatedId;
const Identifier *unavailableId;
// ObjC context keywords:
const Identifier *objcGetterId;
const Identifier *objcSetterId;
......@@ -532,6 +533,7 @@ Control::Control()
d = new Data(this);
d->deprecatedId = findOrInsertIdentifier("deprecated");
d->unavailableId = findOrInsertIdentifier("unavailable");
d->objcGetterId = findOrInsertIdentifier("getter");
d->objcSetterId = findOrInsertIdentifier("setter");
......@@ -736,6 +738,9 @@ ObjCPropertyDeclaration *Control::newObjCPropertyDeclaration(unsigned sourceLoca
const Identifier *Control::deprecatedId() const
{ return d->deprecatedId; }
const Identifier *Control::unavailableId() const
{ return d->unavailableId; }
const Identifier *Control::objcGetterId() const
{ return d->objcGetterId; }
......
......@@ -177,6 +177,7 @@ public:
ObjCPropertyDeclaration *newObjCPropertyDeclaration(unsigned sourceLocation, const Name *name);
const Identifier *deprecatedId() const;
const Identifier *unavailableId() const;
// Objective-C specific context keywords.
const Identifier *objcGetterId() const;
const Identifier *objcSetterId() const;
......
......@@ -87,6 +87,7 @@ FullySpecifiedType FullySpecifiedType::qualifiedType() const
ty.setExplicit(false);
ty.setDeprecated(false);
ty.setUnavailable(false);
return ty;
}
......@@ -180,6 +181,12 @@ bool FullySpecifiedType::isDeprecated() const
void FullySpecifiedType::setDeprecated(bool isDeprecated)
{ f._isDeprecated = isDeprecated; }
bool FullySpecifiedType::isUnavailable() const
{ return f._isUnavailable; }
void FullySpecifiedType::setUnavailable(bool isUnavailable)
{ f._isUnavailable = isUnavailable; }
bool FullySpecifiedType::isEqualTo(const FullySpecifiedType &other) const
{
if (_flags != other._flags)
......
......@@ -113,6 +113,9 @@ public:
bool isDeprecated() const;
void setDeprecated(bool isDeprecated);
bool isUnavailable() const;
void setUnavailable(bool isUnavailable);
bool isEqualTo(const FullySpecifiedType &other) const;
Type &operator*();
......@@ -158,6 +161,7 @@ private:
// speficiers from attributes
unsigned _isDeprecated: 1;
unsigned _isUnavailable: 1;
};
union {
unsigned _flags;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment