[clang] [llvm] [Clang][Coroutines] Introducing the `[[clang::coro_inplace_task]]` attribute (PR #94693)

Yuxuan Chen via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 17 23:03:52 PDT 2024


================
@@ -224,9 +225,26 @@ static LValueOrRValue emitSuspendExpression(CodeGenFunction &CGF, CGCoroData &Co
                                     AwaitKind Kind, AggValueSlot aggSlot,
                                     bool ignoreResult, bool forLValue) {
   auto *E = S.getCommonExpr();
+  auto &Builder = CGF.Builder;
 
-  auto CommonBinder =
-      CodeGenFunction::OpaqueValueMappingData::bind(CGF, S.getOpaqueValue(), E);
+  // S.getOperandOpaqueValue() may be null, in this case it maps to nothing.
+  std::optional<CodeGenFunction::OpaqueValueMapping> OperandMapping = std::nullopt;
+  auto CallOV = S.getOperandOpaqueValue();
+  if (CallOV) {
+    OperandMapping.emplace(CGF, CallOV);
+    LValue LV = CGF.getOrCreateOpaqueLValueMapping(CallOV);
+    llvm::Value *Value = LV.getPointer(CGF);
+    // for (auto *U : Value->users()) {
+    //   if (auto *Call = cast<llvm::CallBase>(U)) {
+    //     Call->dump();
+    //   }
+    // }
----------------
yuxuanchen1997 wrote:

Is there a better way to get the `CallInst`?

https://github.com/llvm/llvm-project/pull/94693


More information about the cfe-commits mailing list