stub out some printing of objc decls.

llvm-svn: 42703
This commit is contained in:
Chris Lattner 2007-10-06 18:52:10 +00:00
parent 8689fa69e2
commit 5ccf60fc44
2 changed files with 45 additions and 7 deletions

View File

@ -92,10 +92,27 @@ namespace {
}
} else if (TypedefDecl *TD = dyn_cast<TypedefDecl>(D)) {
PrintTypeDefDecl(TD);
} else if (ObjcInterfaceDecl *OID = dyn_cast<ObjcInterfaceDecl>(D)) {
PrintObjcInterfaceDecl(OID);
} else if (ScopedDecl *SD = dyn_cast<ScopedDecl>(D)) {
fprintf(stderr, "Read top-level variable decl: '%s'\n", SD->getName());
} else if (ObjcInterfaceDecl *OID = dyn_cast<ObjcInterfaceDecl>(D)) {
PrintObjcInterfaceDecl(OID);
} else if (ObjcForwardProtocolDecl *OFPD =
dyn_cast<ObjcForwardProtocolDecl>(D)) {
fprintf(stderr, "@protocol ");
for (unsigned i = 0, e = OFPD->getNumForwardDecls(); i != e; ++i) {
const ObjcProtocolDecl *D = OFPD->getForwardProtocolDecl(i);
if (i) fprintf(stderr, ", ");
fprintf(stderr, "%s", D->getName());
}
fprintf(stderr, "\n");
} else if (ObjcImplementationDecl *OID =
dyn_cast<ObjcImplementationDecl>(D)) {
fprintf(stderr, "@implementation %s [printing todo]\n",
OID->getName());
} else if (isa<ObjcClassDecl>(D)) {
fprintf(stderr, "@class [printing todo]\n");
} else {
assert(0 && "Unknown decl type!");
}
}
};
@ -124,6 +141,12 @@ namespace {
PrintTypeDefDecl(TD);
} else if (ScopedDecl *SD = dyn_cast<ScopedDecl>(D)) {
fprintf(stderr, "Read top-level variable decl: '%s'\n", SD->getName());
} else if (ObjcInterfaceDecl *OID = dyn_cast<ObjcInterfaceDecl>(D)) {
fprintf(stderr, "Read objc interface '%s'\n", OID->getName());
} else if (isa<ObjcForwardProtocolDecl>(D)) {
fprintf(stderr, "Read objc fwd protocol decl\n");
} else {
assert(0 && "Unknown decl type!");
}
}
};

View File

@ -378,8 +378,8 @@ public:
/// @protocol NSTextInput, NSChangeSpelling, NSDraggingInfo;
///
class ObjcForwardProtocolDecl : public TypeDecl {
ObjcProtocolDecl **ReferencedProtocols; // Null if not defined.
int NumReferencedProtocols; // -1 if not defined.
ObjcProtocolDecl **ReferencedProtocols;
unsigned NumReferencedProtocols;
public:
ObjcForwardProtocolDecl(SourceLocation L, unsigned nElts)
: TypeDecl(ObjcForwardProtocol, L, 0, 0) {
@ -387,12 +387,27 @@ public:
ReferencedProtocols = new ObjcProtocolDecl*[nElts];
memset(ReferencedProtocols, '\0', nElts*sizeof(ObjcProtocolDecl*));
NumReferencedProtocols = nElts;
} else {
ReferencedProtocols = 0;
}
}
void setForwardProtocolDecl(int idx, ObjcProtocolDecl *OID) {
assert((idx < NumReferencedProtocols) && "index out of range");
void setForwardProtocolDecl(unsigned idx, ObjcProtocolDecl *OID) {
assert(idx < NumReferencedProtocols && "index out of range");
ReferencedProtocols[idx] = OID;
}
unsigned getNumForwardDecls() const { return NumReferencedProtocols; }
ObjcProtocolDecl *getForwardProtocolDecl(unsigned idx) {
assert(idx < NumReferencedProtocols && "index out of range");
return ReferencedProtocols[idx];
}
const ObjcProtocolDecl *getForwardProtocolDecl(unsigned idx) const {
assert(idx < NumReferencedProtocols && "index out of range");
return ReferencedProtocols[idx];
}
static bool classof(const Decl *D) {
return D->getKind() == ObjcForwardProtocol;
}
@ -581,7 +596,7 @@ class ObjcImplementationDecl : public TypeDecl {
ObjcMethodDecl **ClassMethods; // Null if not defined
int NumClassMethods; // -1 if not defined
public:
public:
ObjcImplementationDecl(SourceLocation L, IdentifierInfo *Id,
ObjcInterfaceDecl* superDecl)
: TypeDecl(ObjcImplementation, L, Id, 0),