[clang] counter var3 (PR #162291)

Helena Kotas via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 7 16:13:42 PDT 2025


================
@@ -145,19 +145,34 @@ static CXXMethodDecl *lookupResourceInitMethodAndSetupArgs(
     // explicit binding
     auto *RegSlot = llvm::ConstantInt::get(CGM.IntTy, Binding.getSlot());
     Args.add(RValue::get(RegSlot), AST.UnsignedIntTy);
-    CreateMethod = lookupMethod(ResourceDecl, "__createFromBinding", SC_Static);
+    if (Binding.hasCounterImplicitOrderID())
+      CreateMethod = lookupMethod(
+          ResourceDecl, "__createFromBindingWithImplicitCounter", SC_Static);
+    else
+      CreateMethod =
+          lookupMethod(ResourceDecl, "__createFromBinding", SC_Static);
----------------
hekota wrote:

How about this?
```
  const char *Name = Binding.hasCounterImplicitOrderID()
                     ? "__createFromBindingWithImplicitCounter"
                     : "__createFromBinding";
  CreateMethod = lookupMethod(ResourceDecl, Name, SC_Static);
```


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


More information about the cfe-commits mailing list