diff options
| -rw-r--r-- | clang/lib/CodeGen/CGBuiltin.cpp | 8 | 
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp index 8c3478c3b0c..2b27bebe66e 100644 --- a/clang/lib/CodeGen/CGBuiltin.cpp +++ b/clang/lib/CodeGen/CGBuiltin.cpp @@ -567,6 +567,14 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,                           ConstantInt::get(llvm::Type::getInt32Ty(VMContext), 0));      Builder.CreateStore(FrameAddr, Buf); +    // Store the stack pointer to the setjmp buffer. +    Value *StackAddr = +      Builder.CreateCall(CGM.getIntrinsic(Intrinsic::stacksave)); +    Value *StackSaveSlot = +      Builder.CreateGEP(Buf, ConstantInt::get(llvm::Type::getInt32Ty(VMContext), +                                              2)); +    Builder.CreateStore(StackAddr, StackSaveSlot); +      // Call LLVM's EH setjmp, which is lightweight.      Value *F = CGM.getIntrinsic(Intrinsic::eh_sjlj_setjmp);      Buf = Builder.CreateBitCast(Buf, llvm::Type::getInt8PtrTy(VMContext));  | 

