r282645 - [Coroutines] Add proper mangling for operator co_await for MicrosoftABI
Gor Nishanov via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 28 15:37:17 PDT 2016
Author: gornishanov
Date: Wed Sep 28 17:37:17 2016
New Revision: 282645
URL: http://llvm.org/viewvc/llvm-project?rev=282645&view=rev
Log:
[Coroutines] Add proper mangling for operator co_await for MicrosoftABI
Reviewers: rnk, rsmith
Subscribers: mehdi_amini, cfe-commits
Differential Revision: https://reviews.llvm.org/D25045
Added:
cfe/trunk/test/CodeGenCoroutines/
cfe/trunk/test/CodeGenCoroutines/microsoft-abi-operator-coawait.cpp
Modified:
cfe/trunk/lib/AST/MicrosoftMangle.cpp
Modified: cfe/trunk/lib/AST/MicrosoftMangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/MicrosoftMangle.cpp?rev=282645&r1=282644&r2=282645&view=diff
==============================================================================
--- cfe/trunk/lib/AST/MicrosoftMangle.cpp (original)
+++ cfe/trunk/lib/AST/MicrosoftMangle.cpp Wed Sep 28 17:37:17 2016
@@ -1089,6 +1089,8 @@ void MicrosoftCXXNameMangler::mangleOper
case OO_Array_New: Out << "?_U"; break;
// <operator-name> ::= ?_V # delete[]
case OO_Array_Delete: Out << "?_V"; break;
+ // <operator-name> ::= ?__L # co_await
+ case OO_Coawait: Out << "?__L"; break;
case OO_Conditional: {
DiagnosticsEngine &Diags = Context.getDiags();
@@ -1097,14 +1099,6 @@ void MicrosoftCXXNameMangler::mangleOper
Diags.Report(Loc, DiagID);
break;
}
-
- case OO_Coawait: {
- DiagnosticsEngine &Diags = Context.getDiags();
- unsigned DiagID = Diags.getCustomDiagID(DiagnosticsEngine::Error,
- "cannot mangle this operator co_await yet");
- Diags.Report(Loc, DiagID);
- break;
- }
case OO_None:
case NUM_OVERLOADED_OPERATORS:
Added: cfe/trunk/test/CodeGenCoroutines/microsoft-abi-operator-coawait.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCoroutines/microsoft-abi-operator-coawait.cpp?rev=282645&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenCoroutines/microsoft-abi-operator-coawait.cpp (added)
+++ cfe/trunk/test/CodeGenCoroutines/microsoft-abi-operator-coawait.cpp Wed Sep 28 17:37:17 2016
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 -triple x86_64-pc-windows-msvc18.0.0 -fcoroutines -emit-llvm %s -o - -std=c++14 -disable-llvm-passes | FileCheck %s
+struct no_suspend {
+ bool await_ready() { return true; }
+ template <typename F> void await_suspend(F) {}
+ void await_resume() {}
+};
+
+struct A {
+ no_suspend operator co_await() { return {}; }
+};
+
+struct B {};
+
+no_suspend operator co_await(B const&) { return {}; }
+
+// CHECK-LABEL: f(
+extern "C" void f() {
+ A a;
+ B b;
+ // CHECK: call void @"\01??__LA@@QEAA?AUno_suspend@@XZ"(
+ a.operator co_await();
+ // CHECK-NEXT: call i8 @"\01??__L at YA?AUno_suspend@@AEBUB@@@Z"(
+ operator co_await(b);
+}
+
More information about the cfe-commits
mailing list