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) ...@@ -439,8 +439,12 @@ bool CheckSpecifier::visit(TypeofSpecifierAST *ast)
bool CheckSpecifier::visit(AttributeAST *ast) bool CheckSpecifier::visit(AttributeAST *ast)
{ {
if (ast->identifier_token) { 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); _fullySpecifiedType.setDeprecated(true);
else if (id == control()->unavailableId())
_fullySpecifiedType.setUnavailable(true);
} }
return false; return false;
} }
...@@ -516,6 +516,7 @@ public: ...@@ -516,6 +516,7 @@ public:
std::vector<Symbol *> symbols; std::vector<Symbol *> symbols;
const Identifier *deprecatedId; const Identifier *deprecatedId;
const Identifier *unavailableId;
// ObjC context keywords: // ObjC context keywords:
const Identifier *objcGetterId; const Identifier *objcGetterId;
const Identifier *objcSetterId; const Identifier *objcSetterId;
...@@ -532,6 +533,7 @@ Control::Control() ...@@ -532,6 +533,7 @@ Control::Control()
d = new Data(this); d = new Data(this);
d->deprecatedId = findOrInsertIdentifier("deprecated"); d->deprecatedId = findOrInsertIdentifier("deprecated");
d->unavailableId = findOrInsertIdentifier("unavailable");
d->objcGetterId = findOrInsertIdentifier("getter"); d->objcGetterId = findOrInsertIdentifier("getter");
d->objcSetterId = findOrInsertIdentifier("setter"); d->objcSetterId = findOrInsertIdentifier("setter");
...@@ -736,6 +738,9 @@ ObjCPropertyDeclaration *Control::newObjCPropertyDeclaration(unsigned sourceLoca ...@@ -736,6 +738,9 @@ ObjCPropertyDeclaration *Control::newObjCPropertyDeclaration(unsigned sourceLoca
const Identifier *Control::deprecatedId() const const Identifier *Control::deprecatedId() const
{ return d->deprecatedId; } { return d->deprecatedId; }
const Identifier *Control::unavailableId() const
{ return d->unavailableId; }
const Identifier *Control::objcGetterId() const const Identifier *Control::objcGetterId() const
{ return d->objcGetterId; } { return d->objcGetterId; }
......
...@@ -177,6 +177,7 @@ public: ...@@ -177,6 +177,7 @@ public:
ObjCPropertyDeclaration *newObjCPropertyDeclaration(unsigned sourceLocation, const Name *name); ObjCPropertyDeclaration *newObjCPropertyDeclaration(unsigned sourceLocation, const Name *name);
const Identifier *deprecatedId() const; const Identifier *deprecatedId() const;
const Identifier *unavailableId() const;
// Objective-C specific context keywords. // Objective-C specific context keywords.
const Identifier *objcGetterId() const; const Identifier *objcGetterId() const;
const Identifier *objcSetterId() const; const Identifier *objcSetterId() const;
......
...@@ -87,6 +87,7 @@ FullySpecifiedType FullySpecifiedType::qualifiedType() const ...@@ -87,6 +87,7 @@ FullySpecifiedType FullySpecifiedType::qualifiedType() const
ty.setExplicit(false); ty.setExplicit(false);
ty.setDeprecated(false); ty.setDeprecated(false);
ty.setUnavailable(false);
return ty; return ty;
} }
...@@ -180,6 +181,12 @@ bool FullySpecifiedType::isDeprecated() const ...@@ -180,6 +181,12 @@ bool FullySpecifiedType::isDeprecated() const
void FullySpecifiedType::setDeprecated(bool isDeprecated) void FullySpecifiedType::setDeprecated(bool isDeprecated)
{ f._isDeprecated = 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 bool FullySpecifiedType::isEqualTo(const FullySpecifiedType &other) const
{ {
if (_flags != other._flags) if (_flags != other._flags)
......
...@@ -113,6 +113,9 @@ public: ...@@ -113,6 +113,9 @@ public:
bool isDeprecated() const; bool isDeprecated() const;
void setDeprecated(bool isDeprecated); void setDeprecated(bool isDeprecated);
bool isUnavailable() const;
void setUnavailable(bool isUnavailable);
bool isEqualTo(const FullySpecifiedType &other) const; bool isEqualTo(const FullySpecifiedType &other) const;
Type &operator*(); Type &operator*();
...@@ -158,6 +161,7 @@ private: ...@@ -158,6 +161,7 @@ private:
// speficiers from attributes // speficiers from attributes
unsigned _isDeprecated: 1; unsigned _isDeprecated: 1;
unsigned _isUnavailable: 1;
}; };
union { union {
unsigned _flags; 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