Commit dfadb0d0 authored by Erik Verbruggen's avatar Erik Verbruggen
Browse files

Added support for the GCC "unavailable" attribute.

parent 49c75444
......@@ -177,6 +177,8 @@ bool CheckDeclaration::visit(SimpleDeclarationAST *ast)
if (ty.isDeprecated())
symbol->setDeprecated(true);
if (ty.isUnavailable())
symbol->setUnavailable(true);
if (ty.isFriend())
symbol->setStorage(Symbol::Friend);
......@@ -213,6 +215,8 @@ bool CheckDeclaration::visit(SimpleDeclarationAST *ast)
fun->setVirtual(ty.isVirtual());
if (ty.isDeprecated())
fun->setDeprecated(true);
if (ty.isUnavailable())
fun->setUnavailable(true);
if (isQ_SIGNAL)
fun->setMethodKey(Function::SignalMethod);
else if (isQ_SLOT)
......@@ -232,6 +236,8 @@ bool CheckDeclaration::visit(SimpleDeclarationAST *ast)
symbol->setType(declTy);
if (declTy.isDeprecated())
symbol->setDeprecated(true);
if (declTy.isUnavailable())
symbol->setUnavailable(true);
if (_templateParameters && it == ast->declarator_list) {
symbol->setTemplateParameters(_templateParameters);
......@@ -257,6 +263,8 @@ bool CheckDeclaration::visit(SimpleDeclarationAST *ast)
if (ty.isDeprecated())
symbol->setDeprecated(true);
if (ty.isUnavailable())
symbol->setUnavailable(true);
if (it->value && it->value->initializer) {
FullySpecifiedType initTy = semantic()->check(it->value->initializer, _scope);
......@@ -338,6 +346,8 @@ bool CheckDeclaration::visit(FunctionDefinitionAST *ast)
fun->setVirtual(ty.isVirtual());
if (ty.isDeprecated())
fun->setDeprecated(true);
if (ty.isUnavailable())
fun->setUnavailable(true);
fun->setStartOffset(tokenAt(ast->firstToken()).offset);
fun->setEndOffset(tokenAt(ast->lastToken()).offset);
if (ast->declarator)
......@@ -727,6 +737,8 @@ bool CheckDeclaration::visit(ObjCMethodDeclarationAST *ast)
symbol->setVisibility(semantic()->currentObjCVisibility());
if (ty.isDeprecated())
symbol->setDeprecated(true);
if (ty.isUnavailable())
symbol->setUnavailable(true);
_scope->enterSymbol(symbol);
......
......@@ -346,6 +346,8 @@ bool CheckSpecifier::visit(ClassSpecifierAST *ast)
if (_fullySpecifiedType.isDeprecated())
klass->setDeprecated(true);
if (_fullySpecifiedType.isUnavailable())
klass->setUnavailable(true);
for (BaseSpecifierListAST *it = ast->base_clause_list; it; it = it->next) {
BaseSpecifierAST *base = it->value;
......
......@@ -170,7 +170,9 @@ Symbol::Symbol(TranslationUnit *translationUnit, unsigned sourceLocation, const
_scope(0),
_index(0),
_next(0),
_isGenerated(false)
_isGenerated(false),
_isDeprecated(false),
_isUnavailable(false)
{
setSourceLocation(sourceLocation, translationUnit);
setName(name);
......@@ -206,6 +208,12 @@ bool Symbol::isDeprecated() const
void Symbol::setDeprecated(bool isDeprecated)
{ _isDeprecated = isDeprecated; }
bool Symbol::isUnavailable() const
{ return _isUnavailable; }
void Symbol::setUnavailable(bool isUnavailable)
{ _isUnavailable = isUnavailable; }
void Symbol::setSourceLocation(unsigned sourceLocation, TranslationUnit *translationUnit)
{
_sourceLocation = sourceLocation;
......
......@@ -287,6 +287,9 @@ public:
bool isDeprecated() const;
void setDeprecated(bool isDeprecated);
bool isUnavailable() const;
void setUnavailable(bool isUnavailable);
Symbol *enclosingSymbol() const;
/// Returns the eclosing namespace scope.
......@@ -332,6 +335,7 @@ private:
bool _isGenerated: 1;
bool _isDeprecated: 1;
bool _isUnavailable: 1;
class IdentityForName;
class HashCode;
......
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