aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-09-27 18:58:34 +0000
committerAnders Carlsson <andersca@mac.com>2009-09-27 18:58:34 +0000
commit6815e941998659a55c20c147861b0f437928c3d8 (patch)
treeb271f7790f637ce815c2fd633972f496ebeb4665 /lib/CodeGen
parent6bfc8b635f275d99c2c4c3fe823cb366a3627b6b (diff)
CodeGen for try statements. (We just emit the body for now).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82910 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/CGCXX.cpp13
-rw-r--r--lib/CodeGen/CGStmt.cpp4
-rw-r--r--lib/CodeGen/CodeGenFunction.h3
3 files changed, 16 insertions, 4 deletions
diff --git a/lib/CodeGen/CGCXX.cpp b/lib/CodeGen/CGCXX.cpp
index 8934a67614..4c1f6ad4cd 100644
--- a/lib/CodeGen/CGCXX.cpp
+++ b/lib/CodeGen/CGCXX.cpp
@@ -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());
+}
diff --git a/lib/CodeGen/CGStmt.cpp b/lib/CodeGen/CGStmt.cpp
index 26d1c3b8a4..2a5d5edd25 100644
--- a/lib/CodeGen/CGStmt.cpp
+++ b/lib/CodeGen/CGStmt.cpp
@@ -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;
}
}
diff --git a/lib/CodeGen/CodeGenFunction.h b/lib/CodeGen/CodeGenFunction.h
index 6b6b1494e4..73cac24431 100644
--- a/lib/CodeGen/CodeGenFunction.h
+++ b/lib/CodeGen/CodeGenFunction.h
@@ -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
//===--------------------------------------------------------------------===//