forked from qt-creator/qt-creator
Changed ObjC context keyword comparison to use identifiers.
This commit is contained in:
@@ -700,26 +700,26 @@ bool CheckDeclaration::visit(ObjCPropertyDeclarationAST *ast)
|
||||
if (!attrAst)
|
||||
continue;
|
||||
|
||||
const char *attrName = spell(attrAst->attribute_identifier_token);
|
||||
if (!strcmp("getter", attrName)) {
|
||||
Identifier *attrId = identifier(attrAst->attribute_identifier_token);
|
||||
if (attrId == control()->objcGetterId()) {
|
||||
if (checkPropertyAttribute(attrAst, propAttrs, Getter)) {
|
||||
// TODO: find method declaration for getter
|
||||
}
|
||||
} else if (!strcmp("setter", attrName)) {
|
||||
} else if (attrId == control()->objcSetterId()) {
|
||||
if (checkPropertyAttribute(attrAst, propAttrs, Setter)) {
|
||||
// TODO: find method declaration for setter
|
||||
}
|
||||
} else if (!strcmp("readwrite", attrName)) {
|
||||
} else if (attrId == control()->objcReadwriteId()) {
|
||||
checkPropertyAttribute(attrAst, propAttrs, ReadWrite);
|
||||
} else if (!strcmp("readonly", attrName)) {
|
||||
} else if (attrId == control()->objcReadonlyId()) {
|
||||
checkPropertyAttribute(attrAst, propAttrs, ReadOnly);
|
||||
} else if (!strcmp("assign", attrName)) {
|
||||
} else if (attrId == control()->objcAssignId()) {
|
||||
checkPropertyAttribute(attrAst, propAttrs, Assign);
|
||||
} else if (!strcmp("retain", attrName)) {
|
||||
} else if (attrId == control()->objcRetainId()) {
|
||||
checkPropertyAttribute(attrAst, propAttrs, Retain);
|
||||
} else if (!strcmp("copy", attrName)) {
|
||||
} else if (attrId == control()->objcCopyId()) {
|
||||
checkPropertyAttribute(attrAst, propAttrs, Copy);
|
||||
} else if (!strcmp("nonatomic", attrName)) {
|
||||
} else if (attrId == control()->objcNonatomicId()) {
|
||||
checkPropertyAttribute(attrAst, propAttrs, NonAtomic);
|
||||
}
|
||||
}
|
||||
|
@@ -89,7 +89,16 @@ public:
|
||||
: control(control),
|
||||
translationUnit(0),
|
||||
diagnosticClient(0)
|
||||
{ }
|
||||
{
|
||||
objcGetterId = control->findOrInsertIdentifier("getter");
|
||||
objcSetterId = control->findOrInsertIdentifier("setter");
|
||||
objcReadwriteId = control->findOrInsertIdentifier("readwrite");
|
||||
objcReadonlyId = control->findOrInsertIdentifier("readonly");
|
||||
objcAssignId = control->findOrInsertIdentifier("assign");
|
||||
objcRetainId = control->findOrInsertIdentifier("retain");
|
||||
objcCopyId = control->findOrInsertIdentifier("copy");
|
||||
objcNonatomicId = control->findOrInsertIdentifier("nonatomic");
|
||||
}
|
||||
|
||||
~Data()
|
||||
{
|
||||
@@ -577,6 +586,16 @@ public:
|
||||
std::vector<ObjCForwardClassDeclaration *> objcForwardClassDeclarations;
|
||||
std::vector<ObjCForwardProtocolDeclaration *> objcForwardProtocolDeclarations;
|
||||
std::vector<ObjCMethod *> objcMethods;
|
||||
|
||||
// ObjC context keywords:
|
||||
Identifier *objcGetterId;
|
||||
Identifier *objcSetterId;
|
||||
Identifier *objcReadwriteId;
|
||||
Identifier *objcReadonlyId;
|
||||
Identifier *objcAssignId;
|
||||
Identifier *objcRetainId;
|
||||
Identifier *objcCopyId;
|
||||
Identifier *objcNonatomicId;
|
||||
};
|
||||
|
||||
Control::Control()
|
||||
@@ -766,4 +785,26 @@ ObjCForwardProtocolDeclaration *Control::newObjCForwardProtocolDeclaration(unsig
|
||||
ObjCMethod *Control::newObjCMethod(unsigned sourceLocation, Name *name)
|
||||
{ return d->newObjCMethod(sourceLocation, name); }
|
||||
|
||||
Identifier *Control::objcGetterId() const
|
||||
{ return d->objcGetterId; }
|
||||
|
||||
Identifier *Control::objcSetterId() const
|
||||
{ return d->objcSetterId; }
|
||||
|
||||
Identifier *Control::objcReadwriteId() const
|
||||
{ return d->objcReadwriteId; }
|
||||
|
||||
Identifier *Control::objcReadonlyId() const
|
||||
{ return d->objcReadonlyId; }
|
||||
|
||||
Identifier *Control::objcAssignId() const
|
||||
{ return d->objcAssignId; }
|
||||
|
||||
Identifier *Control::objcRetainId() const
|
||||
{ return d->objcRetainId; }
|
||||
|
||||
Identifier *Control::objcCopyId() const
|
||||
{ return d->objcCopyId; }
|
||||
|
||||
Identifier *Control::objcNonatomicId() const
|
||||
{ return d->objcNonatomicId; }
|
||||
|
@@ -169,6 +169,16 @@ public:
|
||||
/// Creates a new Objective-C method symbol.
|
||||
ObjCMethod *newObjCMethod(unsigned sourceLocation, Name *name = 0);
|
||||
|
||||
// Objective-C specific context keywords.
|
||||
Identifier *objcGetterId() const;
|
||||
Identifier *objcSetterId() const;
|
||||
Identifier *objcReadwriteId() const;
|
||||
Identifier *objcReadonlyId() const;
|
||||
Identifier *objcAssignId() const;
|
||||
Identifier *objcRetainId() const;
|
||||
Identifier *objcCopyId() const;
|
||||
Identifier *objcNonatomicId() const;
|
||||
|
||||
Identifier *findIdentifier(const char *chars, unsigned size) const;
|
||||
|
||||
Identifier *findOrInsertIdentifier(const char *chars, unsigned size);
|
||||
|
Reference in New Issue
Block a user