[cfe-commits] r55983 - in /cfe/trunk/lib/CodeGen: CGObjC.cpp CGObjCGNU.cpp CGObjCMac.cpp CGObjCRuntime.h CGStmt.cpp CodeGenFunction.h
Anders Carlsson
andersca at mac.com
Tue Sep 9 03:04:30 PDT 2008
Author: andersca
Date: Tue Sep 9 05:04:29 2008
New Revision: 55983
URL: http://llvm.org/viewvc/llvm-project?rev=55983&view=rev
Log:
Move handling of @try and @throw to the runtime class.
Modified:
cfe/trunk/lib/CodeGen/CGObjC.cpp
cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
cfe/trunk/lib/CodeGen/CGObjCMac.cpp
cfe/trunk/lib/CodeGen/CGObjCRuntime.h
cfe/trunk/lib/CodeGen/CGStmt.cpp
cfe/trunk/lib/CodeGen/CodeGenFunction.h
Modified: cfe/trunk/lib/CodeGen/CGObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjC.cpp?rev=55983&r1=55982&r2=55983&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjC.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjC.cpp Tue Sep 9 05:04:29 2008
@@ -471,4 +471,14 @@
EmitBlock(LoopEnd);
}
+void CodeGenFunction::EmitObjCAtTryStmt(const ObjCAtTryStmt &S)
+{
+ CGM.getObjCRuntime().EmitTryStmt(*this, S);
+}
+
+void CodeGenFunction::EmitObjCAtThrowStmt(const ObjCAtThrowStmt &S)
+{
+ CGM.getObjCRuntime().EmitThrowStmt(*this, S);
+}
+
CGObjCRuntime::~CGObjCRuntime() {}
Modified: cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCGNU.cpp?rev=55983&r1=55982&r2=55983&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCGNU.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCGNU.cpp Tue Sep 9 05:04:29 2008
@@ -122,6 +122,11 @@
virtual void GenerateProtocol(const ObjCProtocolDecl *PD);
virtual llvm::Function *ModuleInitFunction();
virtual llvm::Function *EnumerationMutationFunction();
+
+ virtual void EmitTryStmt(CodeGen::CodeGenFunction &CGF,
+ const ObjCAtTryStmt &S);
+ virtual void EmitThrowStmt(CodeGen::CodeGenFunction &CGF,
+ const ObjCAtThrowStmt &S);
};
} // end anonymous namespace
@@ -967,6 +972,18 @@
return 0;
}
+void CGObjCGNU::EmitTryStmt(CodeGen::CodeGenFunction &CGF,
+ const ObjCAtTryStmt &S)
+{
+ CGF.ErrorUnsupported(&S, "@try statement");
+}
+
+void CGObjCGNU::EmitThrowStmt(CodeGen::CodeGenFunction &CGF,
+ const ObjCAtThrowStmt &S)
+{
+ CGF.ErrorUnsupported(&S, "@throw statement");
+}
+
CodeGen::CGObjCRuntime *CodeGen::CreateGNUObjCRuntime(CodeGen::CodeGenModule &CGM){
return new CGObjCGNU(CGM);
}
Modified: cfe/trunk/lib/CodeGen/CGObjCMac.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCMac.cpp?rev=55983&r1=55982&r2=55983&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Tue Sep 9 05:04:29 2008
@@ -373,6 +373,12 @@
virtual llvm::Function *ModuleInitFunction();
virtual llvm::Function *EnumerationMutationFunction();
+
+ virtual void EmitTryStmt(CodeGen::CodeGenFunction &CGF,
+ const ObjCAtTryStmt &S);
+ virtual void EmitThrowStmt(CodeGen::CodeGenFunction &CGF,
+ const ObjCAtThrowStmt &S);
+
};
} // end anonymous namespace
@@ -1392,6 +1398,18 @@
return ObjCTypes.EnumerationMutationFn;
}
+void CGObjCMac::EmitTryStmt(CodeGen::CodeGenFunction &CGF,
+ const ObjCAtTryStmt &S)
+{
+ CGF.ErrorUnsupported(&S, "@try statement");
+}
+
+void CGObjCMac::EmitThrowStmt(CodeGen::CodeGenFunction &CGF,
+ const ObjCAtThrowStmt &S)
+{
+ CGF.ErrorUnsupported(&S, "@throw statement");
+}
+
/* *** Private Interface *** */
/// EmitImageInfo - Emit the image info marker used to encode some module
Modified: cfe/trunk/lib/CodeGen/CGObjCRuntime.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCRuntime.h?rev=55983&r1=55982&r2=55983&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCRuntime.h (original)
+++ cfe/trunk/lib/CodeGen/CGObjCRuntime.h Tue Sep 9 05:04:29 2008
@@ -36,6 +36,8 @@
class CodeGenFunction;
}
+ class ObjCAtTryStmt;
+ class ObjCAtThrowStmt;
class ObjCCategoryImplDecl;
class ObjCImplementationDecl;
class ObjCInterfaceDecl;
@@ -130,6 +132,11 @@
/// the structure. If this returns true then @defs is invalid for this
/// runtime and a warning should be generated.
virtual bool LateBoundIVars() const { return false; }
+
+ virtual void EmitTryStmt(CodeGen::CodeGenFunction &CGF,
+ const ObjCAtTryStmt &S) = 0;
+ virtual void EmitThrowStmt(CodeGen::CodeGenFunction &CGF,
+ const ObjCAtThrowStmt &S) = 0;
};
/// Creates an instance of an Objective-C runtime class.
Modified: cfe/trunk/lib/CodeGen/CGStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmt.cpp?rev=55983&r1=55982&r2=55983&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGStmt.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGStmt.cpp Tue Sep 9 05:04:29 2008
@@ -78,16 +78,16 @@
case Stmt::AsmStmtClass: EmitAsmStmt(cast<AsmStmt>(*S)); break;
case Stmt::ObjCAtTryStmtClass:
- ErrorUnsupported(S, "@try statement");
- break;
+ EmitObjCAtTryStmt(cast<ObjCAtTryStmt>(*S));
+ break;
case Stmt::ObjCAtCatchStmtClass:
- ErrorUnsupported(S, "@catch statement");
+ assert(0 && "@catch statements should be handled by EmitObjCAtTryStmt");
break;
case Stmt::ObjCAtFinallyStmtClass:
- ErrorUnsupported(S, "@finally statement");
+ assert(0 && "@finally statements should be handled by EmitObjCAtTryStmt");
break;
case Stmt::ObjCAtThrowStmtClass:
- ErrorUnsupported(S, "@throw statement");
+ EmitObjCAtThrowStmt(cast<ObjCAtThrowStmt>(*S));
break;
case Stmt::ObjCAtSynchronizedStmtClass:
ErrorUnsupported(S, "@synchronized statement");
Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=55983&r1=55982&r2=55983&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Tue Sep 9 05:04:29 2008
@@ -242,6 +242,8 @@
void EmitAsmStmt(const AsmStmt &S);
void EmitObjCForCollectionStmt(const ObjCForCollectionStmt &S);
+ void EmitObjCAtTryStmt(const ObjCAtTryStmt &S);
+ void EmitObjCAtThrowStmt(const ObjCAtThrowStmt &S);
//===--------------------------------------------------------------------===//
// LValue Expression Emission
More information about the cfe-commits
mailing list