diff options
| author | Erik Verbruggen <erik.verbruggen@nokia.com> | 2009-09-28 11:46:00 +0200 |
|---|---|---|
| committer | Erik Verbruggen <erik.verbruggen@nokia.com> | 2009-09-28 11:46:00 +0200 |
| commit | 478e94748ffd269b6a8025251fb017ee6a1c9011 (patch) | |
| tree | 7112a43c583b990c15f0efde446ef6a82dbe5797 /src/shared/cplusplus/Symbols.cpp | |
| parent | 77fc7441af3228fc7b5fc97aa81849c43458f996 (diff) | |
| download | qt-creator-478e94748ffd269b6a8025251fb017ee6a1c9011.tar.gz | |
Added type declarations for forward declared ObjC protocols and classes.
Diffstat (limited to 'src/shared/cplusplus/Symbols.cpp')
| -rw-r--r-- | src/shared/cplusplus/Symbols.cpp | 45 |
1 files changed, 42 insertions, 3 deletions
diff --git a/src/shared/cplusplus/Symbols.cpp b/src/shared/cplusplus/Symbols.cpp index 27b33e6217..2496454d04 100644 --- a/src/shared/cplusplus/Symbols.cpp +++ b/src/shared/cplusplus/Symbols.cpp @@ -557,7 +557,8 @@ void Class::visitSymbol0(SymbolVisitor *visitor) ObjCClass::ObjCClass(TranslationUnit *translationUnit, unsigned sourceLocation, Name *name): ScopedSymbol(translationUnit, sourceLocation, name), - _categoryName(0) + _categoryName(0), + _baseClass(0) { } @@ -584,10 +585,14 @@ bool ObjCClass::isEqualTo(const Type *other) const void ObjCClass::visitSymbol0(SymbolVisitor *visitor) { if (visitor->visit(this)) { - for (unsigned i = 0; i < _baseClasses.size(); ++i) - visitSymbol(_baseClasses.at(i), visitor); + if (_baseClass) + visitSymbol(_baseClass, visitor); + for (unsigned i = 0; i < _protocols.size(); ++i) visitSymbol(_protocols.at(i), visitor); + + for (unsigned i = 0; i < memberCount(); ++i) + visitSymbol(memberAt(i), visitor); } } @@ -641,9 +646,26 @@ ObjCForwardClassDeclaration::~ObjCForwardClassDeclaration() FullySpecifiedType ObjCForwardClassDeclaration::type() const { return FullySpecifiedType(); } +bool ObjCForwardClassDeclaration::isEqualTo(const Type *other) const +{ + if (const ObjCForwardClassDeclaration *otherFwdClass = other->asObjCForwardClassDeclarationType()) { + if (name() == otherFwdClass->name()) + return true; + else if (name() && otherFwdClass->name()) + return name()->isEqualTo(otherFwdClass->name()); + else + return false; + } + + return false; +} + void ObjCForwardClassDeclaration::visitSymbol0(SymbolVisitor *visitor) { visitor->visit(this); } +void ObjCForwardClassDeclaration::accept0(TypeVisitor *visitor) +{ visitor->visit(this); } + ObjCForwardProtocolDeclaration::ObjCForwardProtocolDeclaration(TranslationUnit *translationUnit, unsigned sourceLocation, Name *name): Symbol(translationUnit, sourceLocation, name) { @@ -655,9 +677,26 @@ ObjCForwardProtocolDeclaration::~ObjCForwardProtocolDeclaration() FullySpecifiedType ObjCForwardProtocolDeclaration::type() const { return FullySpecifiedType(); } +bool ObjCForwardProtocolDeclaration::isEqualTo(const Type *other) const +{ + if (const ObjCForwardProtocolDeclaration *otherFwdProtocol = other->asObjCForwardProtocolDeclarationType()) { + if (name() == otherFwdProtocol->name()) + return true; + else if (name() && otherFwdProtocol->name()) + return name()->isEqualTo(otherFwdProtocol->name()); + else + return false; + } + + return false; +} + void ObjCForwardProtocolDeclaration::visitSymbol0(SymbolVisitor *visitor) { visitor->visit(this); } +void ObjCForwardProtocolDeclaration::accept0(TypeVisitor *visitor) +{ visitor->visit(this); } + ObjCMethod::ObjCMethod(TranslationUnit *translationUnit, unsigned sourceLocation, Name *name) : ScopedSymbol(translationUnit, sourceLocation, name), _flags(0) |
