diff options
author | John McCall <rjmccall@apple.com> | 2011-07-12 20:27:29 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2011-07-12 20:27:29 +0000 |
commit | ad346f4f678ab1c3222425641d851dc63e9dfa1a (patch) | |
tree | ac5ab28888fb9041423b037fc6437038d831281d /lib/CodeGen/CGDecl.cpp | |
parent | bb52786da8d055568eef6e5694288c1258bc8c2a (diff) |
Generalize Cleanup::Emit's "isForEH" parameter into a set
of flags. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134997 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGDecl.cpp')
-rw-r--r-- | lib/CodeGen/CGDecl.cpp | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/lib/CodeGen/CGDecl.cpp b/lib/CodeGen/CGDecl.cpp index 0a580573b5..c30c00455d 100644 --- a/lib/CodeGen/CGDecl.cpp +++ b/lib/CodeGen/CGDecl.cpp @@ -316,9 +316,10 @@ namespace { CodeGenFunction::Destroyer &destroyer; bool useEHCleanupForArray; - void Emit(CodeGenFunction &CGF, bool isForEH) { + void Emit(CodeGenFunction &CGF, Flags flags) { // Don't use an EH cleanup recursively from an EH cleanup. - bool useEHCleanupForArray = !isForEH && this->useEHCleanupForArray; + bool useEHCleanupForArray = + flags.isForNormalCleanup() && this->useEHCleanupForArray; CGF.emitDestroy(addr, type, destroyer, useEHCleanupForArray); } @@ -334,9 +335,9 @@ namespace { llvm::Value *NRVOFlag; llvm::Value *Loc; - void Emit(CodeGenFunction &CGF, bool IsForEH) { + void Emit(CodeGenFunction &CGF, Flags flags) { // Along the exceptions path we always execute the dtor. - bool NRVO = !IsForEH && NRVOFlag; + bool NRVO = flags.isForNormalCleanup() && NRVOFlag; llvm::BasicBlock *SkipDtorBB = 0; if (NRVO) { @@ -358,7 +359,7 @@ namespace { struct CallStackRestore : EHScopeStack::Cleanup { llvm::Value *Stack; CallStackRestore(llvm::Value *Stack) : Stack(Stack) {} - void Emit(CodeGenFunction &CGF, bool IsForEH) { + void Emit(CodeGenFunction &CGF, Flags flags) { llvm::Value *V = CGF.Builder.CreateLoad(Stack, "tmp"); llvm::Value *F = CGF.CGM.getIntrinsic(llvm::Intrinsic::stackrestore); CGF.Builder.CreateCall(F, V); @@ -369,7 +370,7 @@ namespace { const VarDecl &Var; ExtendGCLifetime(const VarDecl *var) : Var(*var) {} - void Emit(CodeGenFunction &CGF, bool forEH) { + void Emit(CodeGenFunction &CGF, Flags flags) { // Compute the address of the local variable, in case it's a // byref or something. DeclRefExpr DRE(const_cast<VarDecl*>(&Var), Var.getType(), VK_LValue, @@ -388,7 +389,7 @@ namespace { const VarDecl *Var) : CleanupFn(CleanupFn), FnInfo(*Info), Var(*Var) {} - void Emit(CodeGenFunction &CGF, bool IsForEH) { + void Emit(CodeGenFunction &CGF, Flags flags) { DeclRefExpr DRE(const_cast<VarDecl*>(&Var), Var.getType(), VK_LValue, SourceLocation()); // Compute the address of the local variable, in case it's a byref @@ -1301,7 +1302,7 @@ namespace { : ArrayBegin(arrayBegin), ArrayEnd(arrayEnd), ElementType(elementType), Destroyer(*destroyer) {} - void Emit(CodeGenFunction &CGF, bool isForEH) { + void Emit(CodeGenFunction &CGF, Flags flags) { emitPartialArrayDestroy(CGF, ArrayBegin, ArrayEnd, ElementType, Destroyer); } @@ -1323,7 +1324,7 @@ namespace { : ArrayBegin(arrayBegin), ArrayEndPointer(arrayEndPointer), ElementType(elementType), Destroyer(*destroyer) {} - void Emit(CodeGenFunction &CGF, bool isForEH) { + void Emit(CodeGenFunction &CGF, Flags flags) { llvm::Value *arrayEnd = CGF.Builder.CreateLoad(ArrayEndPointer); emitPartialArrayDestroy(CGF, ArrayBegin, arrayEnd, ElementType, Destroyer); @@ -1379,7 +1380,7 @@ namespace { llvm::Value *Param; - void Emit(CodeGenFunction &CGF, bool IsForEH) { + void Emit(CodeGenFunction &CGF, Flags flags) { CGF.EmitARCRelease(Param, /*precise*/ false); } }; |