]> granicus.if.org Git - clang/commitdiff
CodeGen for try statements. (We just emit the body for now).
authorAnders Carlsson <andersca@mac.com>
Sun, 27 Sep 2009 18:58:34 +0000 (18:58 +0000)
committerAnders Carlsson <andersca@mac.com>
Sun, 27 Sep 2009 18:58:34 +0000 (18:58 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82910 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGCXX.cpp
lib/CodeGen/CGStmt.cpp
lib/CodeGen/CodeGenFunction.h

index 8934a676144f5111c364fa6eab8ed0642fe4cdcb..4c1f6ad4cd3bf19479cbdad2479f1f3aa9e83d6c 100644 (file)
@@ -21,6 +21,7 @@
 #include "clang/AST/Decl.h"
 #include "clang/AST/DeclCXX.h"
 #include "clang/AST/DeclObjC.h"
+#include "clang/AST/StmtCXX.h"
 #include "llvm/ADT/StringExtras.h"
 using namespace clang;
 using namespace CodeGen;
@@ -28,10 +29,8 @@ using namespace CodeGen;
 void
 CodeGenFunction::EmitCXXGlobalDtorRegistration(const CXXDestructorDecl *Dtor,
                                                llvm::Constant *DeclPtr) {
-  // FIXME: This is ABI dependent and we use the Itanium ABI.
-
-  const llvm::Type *Int8PtrTy =
-    llvm::PointerType::getUnqual(llvm::Type::getInt8Ty(VMContext));
+  const llvm::Type *Int8PtrTy = 
+    llvm::Type::getInt8Ty(VMContext)->getPointerTo();
 
   std::vector<const llvm::Type *> Params;
   Params.push_back(Int8PtrTy);
@@ -1939,3 +1938,9 @@ void CodeGenFunction::SynthesizeDefaultDestructor(const CXXDestructorDecl *Dtor,
   EmitDtorEpilogue(Dtor, DtorType);
   FinishFunction();
 }
+
+// FIXME: Move this to CGCXXStmt.cpp
+void CodeGenFunction::EmitCXXTryStmt(const CXXTryStmt &S) {
+  // FIXME: We need to do more here.
+  EmitStmt(S.getTryBlock());
+}
index 26d1c3b8a4bf466e0993d38e0a3e960a5afa3e82..2a5d5edd25ebe4684670570dc19b34c8f16583c2 100644 (file)
@@ -114,6 +114,10 @@ void CodeGenFunction::EmitStmt(const Stmt *S) {
   case Stmt::ObjCForCollectionStmtClass:
     EmitObjCForCollectionStmt(cast<ObjCForCollectionStmt>(*S));
     break;
+      
+  case Stmt::CXXTryStmtClass:
+    EmitCXXTryStmt(cast<CXXTryStmt>(*S));
+    break;
   }
 }
 
index 6b6b1494e49e6cfcdde9a703d67606450b91e127..73cac244311eea2d8ff022b9a07c5854c18ec99e 100644 (file)
@@ -40,6 +40,7 @@ namespace llvm {
 namespace clang {
   class ASTContext;
   class CXXDestructorDecl;
+  class CXXTryStmt;
   class Decl;
   class EnumConstantDecl;
   class FunctionDecl;
@@ -711,6 +712,8 @@ public:
   void EmitObjCAtThrowStmt(const ObjCAtThrowStmt &S);
   void EmitObjCAtSynchronizedStmt(const ObjCAtSynchronizedStmt &S);
 
+  void EmitCXXTryStmt(const CXXTryStmt &S);
+  
   //===--------------------------------------------------------------------===//
   //                         LValue Expression Emission
   //===--------------------------------------------------------------------===//