-Add missing visitor for ObjCIvarRefExpr.

-Wrap objc runtime calls with "extern "C"" (for now).

llvm-svn: 48284
This commit is contained in:
Steve Naroff 2008-03-12 13:19:12 +00:00
parent 136a24742c
commit 5d5efca405
2 changed files with 15 additions and 2 deletions

View File

@ -136,6 +136,7 @@ namespace {
void VisitObjCMessageExpr(ObjCMessageExpr* Node);
void VisitObjCSelectorExpr(ObjCSelectorExpr *Node);
void VisitObjCProtocolExpr(ObjCProtocolExpr *Node);
void VisitObjCIvarRefExpr(ObjCIvarRefExpr *Node);
};
}
@ -293,6 +294,13 @@ void StmtDumper::VisitDeclRefExpr(DeclRefExpr *Node) {
fprintf(F, "='%s' %p", Node->getDecl()->getName(), (void*)Node->getDecl());
}
void StmtDumper::VisitObjCIvarRefExpr(ObjCIvarRefExpr *Node) {
DumpExpr(Node->getBase());
fprintf(F, " ObjCIvarRefExpr");
fprintf(F, "='%s' %p", Node->getDecl()->getName(), (void*)Node->getDecl());
}
void StmtDumper::VisitPreDefinedExpr(PreDefinedExpr *Node) {
DumpExpr(Node);
switch (Node->getIdentType()) {

View File

@ -281,7 +281,9 @@ void RewriteTest::Initialize(ASTContext &context) {
S += "typedef struct objc_object Protocol;\n";
S += "#define _REWRITER_typedef_Protocol\n";
S += "#endif\n";
S += "extern struct objc_object *objc_msgSend";
if (LangOpts.Microsoft)
S += "extern \"C\" {\n";
S += "struct objc_object *objc_msgSend";
S += "(struct objc_object *, struct objc_selector *, ...);\n";
S += "extern struct objc_object *objc_msgSendSuper";
S += "(struct objc_super *, struct objc_selector *, ...);\n";
@ -291,7 +293,7 @@ void RewriteTest::Initialize(ASTContext &context) {
S += "(struct objc_super *, struct objc_selector *, ...);\n";
S += "extern struct objc_object *objc_msgSend_fpret";
S += "(struct objc_object *, struct objc_selector *, ...);\n";
S += "extern struct objc_object *objc_getClass";
S += "struct objc_object *objc_getClass";
S += "(const char *);\n";
S += "extern struct objc_object *objc_getMetaClass";
S += "(const char *);\n";
@ -302,6 +304,8 @@ void RewriteTest::Initialize(ASTContext &context) {
S += "extern int objc_exception_match";
S += "(struct objc_class *, struct objc_object *, ...);\n";
S += "extern Protocol *objc_getProtocol(const char *);\n";
if (LangOpts.Microsoft)
S += "} // end extern \"C\"\n";
S += "#include <objc/objc.h>\n";
S += "#ifndef __FASTENUMERATIONSTATE\n";
S += "struct __objcFastEnumerationState {\n\t";
@ -1967,6 +1971,7 @@ Stmt *RewriteTest::SynthMessageExpr(ObjCMessageExpr *Exp) {
SourceLocation());
MsgExprs.push_back(Unop);
} else {
//recExpr->dump();
// Remove all type-casts because it may contain objc-style types; e.g.
// Foo<Proto> *.
while (CastExpr *CE = dyn_cast<CastExpr>(recExpr))