Start of IRGen for lambda conversion operators.

llvm-svn: 150649
This commit is contained in:
Eli Friedman 2012-02-16 01:37:33 +00:00
parent b6f795eee6
commit 5a6d507d1b
3 changed files with 20 additions and 0 deletions

View File

@ -1720,3 +1720,11 @@ CodeGenFunction::EmitCXXOperatorMemberCallee(const CXXOperatorCallExpr *E,
return CGM.GetAddrOfFunction(MD, Ty);
}
void CodeGenFunction::EmitLambdaToBlockPointerBody(FunctionArgList &Args) {
CGM.ErrorUnsupported(CurFuncDecl, "lambda conversion to block");
}
void CodeGenFunction::EmitLambdaToFunctionPointerBody(FunctionArgList &Args) {
CGM.ErrorUnsupported(CurFuncDecl, "lambda conversion to function");
}

View File

@ -447,6 +447,15 @@ void CodeGenFunction::GenerateCode(GlobalDecl GD, llvm::Function *Fn,
!CGM.getCodeGenOpts().CUDAIsDevice &&
FD->hasAttr<CUDAGlobalAttr>())
CGM.getCUDARuntime().EmitDeviceStubBody(*this, Args);
else if (isa<CXXConversionDecl>(FD) &&
cast<CXXConversionDecl>(FD)->getParent()->isLambda()) {
// The lambda conversion operators are special; the semantics can't be
// expressed in the AST, so IRGen needs to special-case them.
if (cast<CXXConversionDecl>(FD)->isLambdaToBlockPointerConversion())
EmitLambdaToBlockPointerBody(Args);
else
EmitLambdaToFunctionPointerBody(Args);
}
else
EmitFunctionBody(Args);

View File

@ -1376,6 +1376,9 @@ public:
void EmitDestructorBody(FunctionArgList &Args);
void EmitFunctionBody(FunctionArgList &Args);
void EmitLambdaToBlockPointerBody(FunctionArgList &Args);
void EmitLambdaToFunctionPointerBody(FunctionArgList &Args);
/// EmitReturnBlock - Emit the unified return block, trying to avoid its
/// emission when possible.
void EmitReturnBlock();