[cfe-commits] r42703 - in /cfe/trunk: Driver/ASTStreamers.cpp include/clang/AST/DeclObjC.h
Chris Lattner
sabre at nondot.org
Sat Oct 6 11:52:10 PDT 2007
Author: lattner
Date: Sat Oct 6 13:52:10 2007
New Revision: 42703
URL: http://llvm.org/viewvc/llvm-project?rev=42703&view=rev
Log:
stub out some printing of objc decls.
Modified:
cfe/trunk/Driver/ASTStreamers.cpp
cfe/trunk/include/clang/AST/DeclObjC.h
Modified: cfe/trunk/Driver/ASTStreamers.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/ASTStreamers.cpp?rev=42703&r1=42702&r2=42703&view=diff
==============================================================================
--- cfe/trunk/Driver/ASTStreamers.cpp (original)
+++ cfe/trunk/Driver/ASTStreamers.cpp Sat Oct 6 13:52:10 2007
@@ -92,10 +92,27 @@
}
} 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 @@
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!");
}
}
};
Modified: cfe/trunk/include/clang/AST/DeclObjC.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclObjC.h?rev=42703&r1=42702&r2=42703&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclObjC.h (original)
+++ cfe/trunk/include/clang/AST/DeclObjC.h Sat Oct 6 13:52:10 2007
@@ -378,8 +378,8 @@
/// @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 @@
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 @@
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),
More information about the cfe-commits
mailing list