summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2015-03-13 18:26:17 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2015-03-13 18:26:17 +0000
commitba3e5ecf075c1d186906c06fe4f85a560c244699 (patch)
tree44c13b5601f9c9b8472a9ff20bfcf9a34c70c86e /clang/lib/CodeGen
parentbdf40a62a740c6e0b6f10543617ba768759951b6 (diff)
downloadbcm5719-llvm-ba3e5ecf075c1d186906c06fe4f85a560c244699.tar.gz
bcm5719-llvm-ba3e5ecf075c1d186906c06fe4f85a560c244699.zip
MS ABI: Implement __GetExceptionInfo for std::make_exception_ptr
std::make_exception_ptr calls std::__GetExceptionInfo in order to figure out how to properly copy the exception object. Differential Revision: http://reviews.llvm.org/D8280 llvm-svn: 232188
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r--clang/lib/CodeGen/CGBuiltin.cpp8
-rw-r--r--clang/lib/CodeGen/CGCXXABI.h1
-rw-r--r--clang/lib/CodeGen/MicrosoftCXXABI.cpp2
3 files changed, 10 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index 951e9aeec27..4c79a34ca5c 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -12,6 +12,7 @@
//===----------------------------------------------------------------------===//
#include "CodeGenFunction.h"
+#include "CGCXXABI.h"
#include "CGObjCRuntime.h"
#include "CodeGenModule.h"
#include "TargetInfo.h"
@@ -1720,6 +1721,13 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
return RValue::get(CS.getInstruction());
}
}
+
+ case Builtin::BI__GetExceptionInfo: {
+ if (llvm::GlobalVariable *GV =
+ CGM.getCXXABI().getThrowInfo(FD->getParamDecl(0)->getType()))
+ return RValue::get(llvm::ConstantExpr::getBitCast(GV, CGM.Int8PtrTy));
+ break;
+ }
}
// If this is an alias for a lib function (e.g. __builtin_sin), emit
diff --git a/clang/lib/CodeGen/CGCXXABI.h b/clang/lib/CodeGen/CGCXXABI.h
index 840e1e86578..df2aa1a7b17 100644
--- a/clang/lib/CodeGen/CGCXXABI.h
+++ b/clang/lib/CodeGen/CGCXXABI.h
@@ -216,6 +216,7 @@ public:
const CXXDestructorDecl *Dtor) = 0;
virtual void emitRethrow(CodeGenFunction &CGF, bool isNoReturn) = 0;
virtual void emitThrow(CodeGenFunction &CGF, const CXXThrowExpr *E) = 0;
+ virtual llvm::GlobalVariable *getThrowInfo(QualType T) { return nullptr; }
virtual void emitBeginCatch(CodeGenFunction &CGF, const CXXCatchStmt *C) = 0;
diff --git a/clang/lib/CodeGen/MicrosoftCXXABI.cpp b/clang/lib/CodeGen/MicrosoftCXXABI.cpp
index 1f5d678f4d6..6b53359f28b 100644
--- a/clang/lib/CodeGen/MicrosoftCXXABI.cpp
+++ b/clang/lib/CodeGen/MicrosoftCXXABI.cpp
@@ -644,7 +644,7 @@ public:
llvm::GlobalVariable *getCatchableTypeArray(QualType T);
- llvm::GlobalVariable *getThrowInfo(QualType T);
+ llvm::GlobalVariable *getThrowInfo(QualType T) override;
private:
typedef std::pair<const CXXRecordDecl *, CharUnits> VFTableIdTy;
OpenPOWER on IntegriCloud