[cfe-commits] r150649 - in /cfe/trunk/lib/CodeGen: CGClass.cpp CodeGenFunction.cpp CodeGenFunction.h
Eli Friedman
eli.friedman at gmail.com
Wed Feb 15 17:37:34 PST 2012
Author: efriedma
Date: Wed Feb 15 19:37:33 2012
New Revision: 150649
URL: http://llvm.org/viewvc/llvm-project?rev=150649&view=rev
Log:
Start of IRGen for lambda conversion operators.
Modified:
cfe/trunk/lib/CodeGen/CGClass.cpp
cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
cfe/trunk/lib/CodeGen/CodeGenFunction.h
Modified: cfe/trunk/lib/CodeGen/CGClass.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGClass.cpp?rev=150649&r1=150648&r2=150649&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGClass.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGClass.cpp Wed Feb 15 19:37:33 2012
@@ -1720,3 +1720,11 @@
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");
+}
Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.cpp?rev=150649&r1=150648&r2=150649&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.cpp Wed Feb 15 19:37:33 2012
@@ -447,6 +447,15 @@
!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);
Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=150649&r1=150648&r2=150649&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Wed Feb 15 19:37:33 2012
@@ -1376,6 +1376,9 @@
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();
More information about the cfe-commits
mailing list