[PATCH] D25045: [Coroutines] Add proper mangling for operator co_await for MicrosoftABI
Gor Nishanov via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 28 14:25:13 PDT 2016
GorNishanov created this revision.
GorNishanov added reviewers: rsmith, rnk.
GorNishanov added a subscriber: cfe-commits.
Herald added a subscriber: mehdi_amini.
https://reviews.llvm.org/D25045
Files:
lib/AST/MicrosoftMangle.cpp
test/CodeGenCoroutines/microsoft-abi-operator-coawait.cpp
Index: test/CodeGenCoroutines/microsoft-abi-operator-coawait.cpp
===================================================================
--- /dev/null
+++ test/CodeGenCoroutines/microsoft-abi-operator-coawait.cpp
@@ -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);
+}
+
Index: lib/AST/MicrosoftMangle.cpp
===================================================================
--- lib/AST/MicrosoftMangle.cpp
+++ lib/AST/MicrosoftMangle.cpp
@@ -1089,6 +1089,8 @@
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();
@@ -1098,14 +1100,6 @@
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:
llvm_unreachable("Not an overloaded operator");
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25045.72900.patch
Type: text/x-patch
Size: 1762 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160928/bdd5b4f4/attachment.bin>
More information about the cfe-commits
mailing list