diff options
author | Erik Verbruggen <erik.verbruggen@nokia.com> | 2009-08-05 18:30:18 +0200 |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@nokia.com> | 2009-08-05 18:30:18 +0200 |
commit | 86a7b26fcd09c5c0510410631421956b877db840 (patch) | |
tree | 8b116f47776c64b60d182c246f9ddeab534403a7 /src/shared/cplusplus/Symbols.h | |
parent | ca34b0ca1c57a0ec0f8f61ad1b0dd4f8bfc9b554 (diff) |
Fixed semantic checks for Objective-C methods and fast-enumeration.
Diffstat (limited to 'src/shared/cplusplus/Symbols.h')
-rw-r--r-- | src/shared/cplusplus/Symbols.h | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/src/shared/cplusplus/Symbols.h b/src/shared/cplusplus/Symbols.h index 3f621cde60..c55dce4d76 100644 --- a/src/shared/cplusplus/Symbols.h +++ b/src/shared/cplusplus/Symbols.h @@ -543,6 +543,13 @@ public: ObjCClass(TranslationUnit *translationUnit, unsigned sourceLocation, Name *name); virtual ~ObjCClass(); + bool isInterface() const { return _isInterface; } + void setInterface(bool isInterface) { _isInterface = isInterface; } + + bool isCategory() const { return _categoryName != 0; } + Name *categoryName() const { return _categoryName; } + void setCategoryName(Name *categoryName) { _categoryName = categoryName; } + // Symbol's interface virtual FullySpecifiedType type() const; @@ -566,10 +573,68 @@ protected: virtual void accept0(TypeVisitor *visitor); private: + bool _isInterface; + Name *_categoryName; Array<ObjCClass *> _baseClasses; Array<ObjCProtocol *> _protocols; }; +class CPLUSPLUS_EXPORT ObjCMethod: public ScopedSymbol, public Type +{ +public: + ObjCMethod(TranslationUnit *translationUnit, unsigned sourceLocation, Name *name); + virtual ~ObjCMethod(); + + FullySpecifiedType returnType() const; + void setReturnType(FullySpecifiedType returnType); + + /** Convenience function that returns whether the function returns something (including void). */ + bool hasReturnType() const; + + unsigned argumentCount() const; + Symbol *argumentAt(unsigned index) const; + Scope *arguments() const; + + /** Convenience function that returns whether the function receives any arguments. */ + bool hasArguments() const; + + bool isVariadic() const; + void setVariadic(bool isVariadic); + + // Symbol's interface + virtual FullySpecifiedType type() const; + + // Type's interface + virtual bool isEqualTo(const Type *other) const; + + virtual const ObjCMethod *asObjCMethod() const + { return this; } + + virtual ObjCMethod *asObjCMethod() + { return this; } + + virtual const ObjCMethod *asObjCMethodType() const + { return this; } + + virtual ObjCMethod *asObjCMethodType() + { return this; } + +protected: + virtual void visitSymbol0(SymbolVisitor *visitor); + virtual void accept0(TypeVisitor *visitor); + +private: + FullySpecifiedType _returnType; + struct Flags { + unsigned _isVariadic: 1; + }; + union { + unsigned _flags; + Flags f; + }; + Scope *_arguments; +}; + CPLUSPLUS_END_NAMESPACE CPLUSPLUS_END_HEADER |