diff options
author | David Chisnall <csdavec@swan.ac.uk> | 2011-03-25 11:57:33 +0000 |
---|---|---|
committer | David Chisnall <csdavec@swan.ac.uk> | 2011-03-25 11:57:33 +0000 |
commit | 9735ca6e01113aec6a825dd5b1cb1b98fb377d31 (patch) | |
tree | 4e163d10246039897ca18669e452e4210f504d1b /lib/CodeGen/CGObjCRuntime.h | |
parent | 844c25d4383ccaf44765687cc4a7e591b3fe1472 (diff) |
Continuing work on ObjC tidyup:
- Moved the CGObjCRuntime functions out of CGObjCMac.cpp into CGObjCRuntime.cpp
- Added generic functions in CGObjCRuntime for emitting @try and @synchronize
blocks, usable by any runtime that uses DWARF exceptions.
- Made the GNU runtimes use these functions.
It should now be possible to replace the equivalent functions in
CGObjCNonFragileABIMac with simple calls to these two functions, providing the
runtime functions as arguments. I'll post a diff to the list for review before
making any changes to the Mac runtime stuff.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128274 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGObjCRuntime.h')
-rw-r--r-- | lib/CodeGen/CGObjCRuntime.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/CodeGen/CGObjCRuntime.h b/lib/CodeGen/CGObjCRuntime.h index e6869adbc6..9778e18fce 100644 --- a/lib/CodeGen/CGObjCRuntime.h +++ b/lib/CodeGen/CGObjCRuntime.h @@ -87,6 +87,26 @@ protected: const ObjCIvarDecl *Ivar, unsigned CVRQualifiers, llvm::Value *Offset); + /// Emits a try / catch statement. This function is intended to be called by + /// subclasses, and provides a generic mechanism for generating these, which + /// should be usable by all runtimes. The caller must provide the functions to + /// call when entering and exiting a @catch() block, and the function used to + /// rethrow exceptions. If the begin and end catch functions are NULL, then + /// the function assumes that the EH personality function provides the + /// thrown object directly. + void EmitTryCatchStmt(CodeGenFunction &CGF, + const ObjCAtTryStmt &S, + llvm::Function *beginCatchFn, + llvm::Function *endCatchFn, + llvm::Function *exceptionRethrowFn); + /// Emits an @synchronize() statement, using the syncEnterFn and syncExitFn + /// arguments as the functions called to lock and unlock the object. This + /// function can be called by subclasses that use zero-cost exception + /// handling. + void EmitAtSynchronizedStmt(CodeGenFunction &CGF, + const ObjCAtSynchronizedStmt &S, + llvm::Function *syncEnterFn, + llvm::Function *syncExitFn); public: virtual ~CGObjCRuntime(); |