clean up iteration over propertydecls.

llvm-svn: 48435
This commit is contained in:
Chris Lattner 2008-03-17 01:24:41 +00:00
parent ed0e16404c
commit 5bb4ee20cd
2 changed files with 31 additions and 23 deletions

View File

@ -311,13 +311,14 @@ void DeclPrinter::PrintObjCInterfaceDecl(ObjCInterfaceDecl *OID) {
Out << " )";
}
ObjCIvarDecl *const *IDecl = PDecl->getPropertyDecls();
ObjCPropertyDecl::propdecl_iterator
I = PDecl->propdecl_begin(), E = PDecl->propdecl_end();
Out << ' ' << IDecl[0]->getType().getAsString()
<< ' ' << IDecl[0]->getName();
for (unsigned j = 1; j < PDecl->getNumPropertyDecls(); j++)
Out << ", " << IDecl[j]->getName();
Out << ' ' << (*I)->getType().getAsString()
<< ' ' << (*I)->getName();
for (++I; I != E; ++I)
Out << ", " << (*I)->getName();
Out << ";\n";
}

View File

@ -895,15 +895,17 @@ public:
class ObjCPropertyDecl : public Decl {
public:
enum PropertyAttributeKind { OBJC_PR_noattr = 0x0,
OBJC_PR_readonly = 0x01,
OBJC_PR_getter = 0x02,
OBJC_PR_assign = 0x04,
OBJC_PR_readwrite = 0x08,
OBJC_PR_retain = 0x10,
OBJC_PR_copy = 0x20,
OBJC_PR_nonatomic = 0x40,
OBJC_PR_setter = 0x80 };
enum PropertyAttributeKind {
OBJC_PR_noattr = 0x00,
OBJC_PR_readonly = 0x01,
OBJC_PR_getter = 0x02,
OBJC_PR_assign = 0x04,
OBJC_PR_readwrite = 0x08,
OBJC_PR_retain = 0x10,
OBJC_PR_copy = 0x20,
OBJC_PR_nonatomic = 0x40,
OBJC_PR_setter = 0x80
};
private:
// List of property name declarations
// FIXME: Property is not an ivar.
@ -920,24 +922,29 @@ private:
public:
static ObjCPropertyDecl *Create(ASTContext &C, SourceLocation L);
ObjCIvarDecl *const* getPropertyDecls() const { return PropertyDecls; }
unsigned getNumPropertyDecls() const { return NumPropertyDecls; }
typedef ObjCIvarDecl * const *propdecl_iterator;
propdecl_iterator propdecl_begin() const { return PropertyDecls; }
propdecl_iterator propdecl_end() const {
return PropertyDecls+NumPropertyDecls;
}
unsigned propdecl_size() const { return NumPropertyDecls; }
bool propdecl_empty() const { return NumPropertyDecls == 0; }
/// setPropertyDeclLists - Set the property decl list to the specified array
/// of decls.
void setPropertyDeclLists(ObjCIvarDecl **Properties, unsigned NumProp);
const PropertyAttributeKind getPropertyAttributes() const {
PropertyAttributeKind getPropertyAttributes() const {
return PropertyAttributeKind(PropertyAttributes);
}
void setPropertyAttributes(PropertyAttributeKind PRVal) {
PropertyAttributes = (PropertyAttributeKind) (PropertyAttributes | PRVal);
PropertyAttributes |= PRVal;
}
const IdentifierInfo *getGetterName() const { return GetterName; }
IdentifierInfo *getGetterName() { return GetterName; }
IdentifierInfo *getGetterName() const { return GetterName; }
void setGetterName(IdentifierInfo *Id) { GetterName = Id; }
const IdentifierInfo *getSetterName() const { return SetterName; }
IdentifierInfo *getSetterName() { return SetterName; }
IdentifierInfo *getSetterName() const { return SetterName; }
void setSetterName(IdentifierInfo *Id) { SetterName = Id; }
static bool classof(const Decl *D) {