r183931 - Fix a small bug in the linkage computation for the lambda conversion-to-function-pointer member.

Eli Friedman eli.friedman at gmail.com
Thu Jun 13 12:39:48 PDT 2013


Author: efriedma
Date: Thu Jun 13 14:39:48 2013
New Revision: 183931

URL: http://llvm.org/viewvc/llvm-project?rev=183931&view=rev
Log:
Fix a small bug in the linkage computation for the lambda conversion-to-function-pointer member.


Modified:
    cfe/trunk/lib/Sema/SemaLambda.cpp
    cfe/trunk/test/CodeGenCXX/mangle-lambdas.cpp

Modified: cfe/trunk/lib/Sema/SemaLambda.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLambda.cpp?rev=183931&r1=183930&r2=183931&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaLambda.cpp (original)
+++ cfe/trunk/lib/Sema/SemaLambda.cpp Thu Jun 13 14:39:48 2013
@@ -834,7 +834,7 @@ static void addFunctionPointerConversion
                                 ConvTy, 
                                 S.Context.getTrivialTypeSourceInfo(ConvTy, 
                                                                    Loc),
-                                /*isInline=*/false, /*isExplicit=*/false,
+                                /*isInline=*/true, /*isExplicit=*/false,
                                 /*isConstexpr=*/false, 
                                 CallOperator->getBody()->getLocEnd());
   Conversion->setAccess(AS_public);

Modified: cfe/trunk/test/CodeGenCXX/mangle-lambdas.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/mangle-lambdas.cpp?rev=183931&r1=183930&r2=183931&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/mangle-lambdas.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/mangle-lambdas.cpp Thu Jun 13 14:39:48 2013
@@ -106,6 +106,7 @@ struct StaticMembers {
   static T x;
   static T y;
   static T z;
+  static int (*f)();
 };
 
 template<typename T> int accept_lambda(T);
@@ -119,6 +120,9 @@ T StaticMembers<T>::y = []{return 3;}();
 template<typename T>
 T StaticMembers<T>::z = accept_lambda([]{return 4;});
 
+template<typename T>
+int (*StaticMembers<T>::f)() = []{return 5;};
+
 // CHECK: define internal void @__cxx_global_var_init()
 // CHECK: call i32 @_ZNK13StaticMembersIfE1xMUlvE_clEv
 // CHECK-NEXT: call i32 @_ZNK13StaticMembersIfE1xMUlvE0_clEv
@@ -140,7 +144,12 @@ template float StaticMembers<float>::y;
 // CHECK: declare i32 @_Z13accept_lambdaIN13StaticMembersIfE1zMUlvE_EEiT_()
 template float StaticMembers<float>::z;
 
-// CHECK: define internal void @__cxx_global_var_init3
+// CHECK: define internal void @__cxx_global_var_init3()
+// CHECK: call {{.*}} @_ZNK13StaticMembersIfE1fMUlvE_cvPFivEEv
+// CHECK: define linkonce_odr i32 ()* @_ZNK13StaticMembersIfE1fMUlvE_cvPFivEEv
+template int (*StaticMembers<float>::f)();
+
+// CHECK: define internal void @__cxx_global_var_init4
 // CHECK: call i32 @"_ZNK13StaticMembersIdE3$_2clEv"
 // CHECK: define internal i32 @"_ZNK13StaticMembersIdE3$_2clEv"
 // CHECK: ret i32 42





More information about the cfe-commits mailing list