summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/mangle-ms-cxx11.cpp
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2014-03-05 10:35:06 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2014-03-05 10:35:06 +0000
commitf017ec360cbc76ce8785fae484c1cd8918ce7c41 (patch)
treeb3d79d3d1656d3d7ef31615033100ccadd312f0f /clang/test/CodeGenCXX/mangle-ms-cxx11.cpp
parent9106521056290aeadcb38dd5bba1ddee35da8721 (diff)
downloadbcm5719-llvm-f017ec360cbc76ce8785fae484c1cd8918ce7c41.tar.gz
bcm5719-llvm-f017ec360cbc76ce8785fae484c1cd8918ce7c41.zip
MS ABI: Mangle lambdas
Use a scheme inspired by the Itanium ABI to properly implement the mangling of lambdas. N.B. The incredibly astute observer will notice that we do not generate external names that are identical, or even compatible with, MSVC. This is fine because they don't generate names that they can use across translation units. Technically, we can generate any name we'd like so long as that name wouldn't conflict with any other and would be stable across translation units. This fixes PR15512. llvm-svn: 202962
Diffstat (limited to 'clang/test/CodeGenCXX/mangle-ms-cxx11.cpp')
-rw-r--r--clang/test/CodeGenCXX/mangle-ms-cxx11.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/mangle-ms-cxx11.cpp b/clang/test/CodeGenCXX/mangle-ms-cxx11.cpp
index c5da330a40d..3acd7a21001 100644
--- a/clang/test/CodeGenCXX/mangle-ms-cxx11.cpp
+++ b/clang/test/CodeGenCXX/mangle-ms-cxx11.cpp
@@ -101,3 +101,21 @@ decltype(a) fun(decltype(a) x, decltype(a)) { return x; }
// CHECK-DAG: ?fun@PR18022@@YA?AU<unnamed-type-a>@1@U21@0@Z
}
+
+inline int define_lambda() {
+ static auto lambda = [] { static int local; ++local; return local; };
+// First, we have the static local variable of type "<lambda_1>" inside of
+// "define_lambda".
+// CHECK-DAG: ?lambda@?1??define_lambda@@YAHXZ@4V<lambda_1>@@A
+// Next, we have the "operator()" for "<lambda_1>" which is inside of
+// "define_lambda".
+// CHECK-DAG: ??R<lambda_1>@?define_lambda@@YAHXZ@QBEHXZ
+// Finally, we have the local which is inside of "<lambda_1>" which is inside of
+// "define_lambda". Hooray.
+// CHECK-DAG: ?local@?2???R<lambda_1>@?define_lambda@@YAHXZ@QBEHXZ@4HA
+ return lambda();
+}
+
+int call_lambda() {
+ return define_lambda();
+}
OpenPOWER on IntegriCloud