in facebook-clang-plugins/libtooling/ASTExporter.h [2614:2641]
void ASTExporter<ATDWriter>::VisitObjCCategoryDecl(const ObjCCategoryDecl *D) {
VisitObjCContainerDecl(D);
const ObjCInterfaceDecl *CI = D->getClassInterface();
const ObjCCategoryImplDecl *Impl = D->getImplementation();
ObjCCategoryDecl::protocol_iterator I = D->protocol_begin(),
E = D->protocol_end();
bool HasProtocols = I != E;
ObjectScope Scope(
OF, 0 + (bool)CI + (bool)Impl + HasProtocols); // not covered by tests
if (CI) {
OF.emitTag("class_interface");
dumpDeclRef(*CI);
}
if (Impl) {
OF.emitTag("implementation");
dumpDeclRef(*Impl);
}
if (HasProtocols) {
OF.emitTag("protocols");
ArrayScope Scope(OF, std::distance(I, E)); // not covered by tests
for (; I != E; ++I) {
assert(*I);
dumpDeclRef(**I);
}
}
}