in facebook-clang-plugins/libtooling/ASTExporter.h [2844:2936]
void ASTExporter<ATDWriter>::VisitObjCPropertyDecl(const ObjCPropertyDecl *D) {
VisitNamedDecl(D);
ObjCPropertyDecl::PropertyControl PC = D->getPropertyImplementation();
bool HasPropertyControl = PC != ObjCPropertyDecl::None;
ObjCPropertyAttribute::Kind Attrs = D->getPropertyAttributes();
bool HasPropertyAttributes = Attrs != ObjCPropertyAttribute::kind_noattr;
ObjCMethodDecl *Getter = D->getGetterMethodDecl();
ObjCMethodDecl *Setter = D->getSetterMethodDecl();
ObjCIvarDecl *Ivar = D->getPropertyIvarDecl();
ObjectScope Scope(OF,
1 + (bool)Getter + (bool)Setter + (bool)Ivar +
HasPropertyControl +
HasPropertyAttributes); // not covered by tests
OF.emitTag("qual_type");
dumpQualType(D->getType());
if (Getter) {
OF.emitTag("getter_method");
dumpDeclRef(*Getter);
}
if (Setter) {
OF.emitTag("setter_method");
dumpDeclRef(*Setter);
}
if (Ivar) {
OF.emitTag("ivar_decl");
dumpDeclRef(*Ivar);
}
if (HasPropertyControl) {
OF.emitTag("property_control");
switch (PC) {
case ObjCPropertyDecl::Required:
OF.emitSimpleVariant("Required");
break;
case ObjCPropertyDecl::Optional:
OF.emitSimpleVariant("Optional");
break;
default:
OF.emitSimpleVariant("None");
break;
}
}
if (HasPropertyAttributes) {
OF.emitTag("property_attributes");
bool readonly = Attrs & ObjCPropertyAttribute::kind_readonly;
bool assign = Attrs & ObjCPropertyAttribute::kind_assign;
bool readwrite = Attrs & ObjCPropertyAttribute::kind_readwrite;
bool retain = Attrs & ObjCPropertyAttribute::kind_retain;
bool copy = Attrs & ObjCPropertyAttribute::kind_copy;
bool nonatomic = Attrs & ObjCPropertyAttribute::kind_nonatomic;
bool atomic = Attrs & ObjCPropertyAttribute::kind_atomic;
bool weak = Attrs & ObjCPropertyAttribute::kind_weak;
bool strong = Attrs & ObjCPropertyAttribute::kind_strong;
bool unsafeUnretained =
Attrs & ObjCPropertyAttribute::kind_unsafe_unretained;
bool getter = Attrs & ObjCPropertyAttribute::kind_getter;
bool setter = Attrs & ObjCPropertyAttribute::kind_setter;
int toEmit = readonly + assign + readwrite + retain + copy + nonatomic +
atomic + weak + strong + unsafeUnretained + getter + setter;
ArrayScope Scope(OF, toEmit);
if (readonly)
OF.emitSimpleVariant("Readonly");
if (assign)
OF.emitSimpleVariant("Assign");
if (readwrite)
OF.emitSimpleVariant("Readwrite");
if (retain)
OF.emitSimpleVariant("Retain");
if (copy)
OF.emitSimpleVariant("Copy");
if (nonatomic)
OF.emitSimpleVariant("Nonatomic");
if (atomic)
OF.emitSimpleVariant("Atomic");
if (weak)
OF.emitSimpleVariant("Weak");
if (strong)
OF.emitSimpleVariant("Strong");
if (unsafeUnretained)
OF.emitSimpleVariant("Unsafe_unretained");
if (getter) {
OF.emitSimpleVariant("ExplicitGetter");
}
if (setter) {
OF.emitSimpleVariant("ExplicitSetter");
}
}
}