================
@@ -773,11 +773,26 @@ class InlayHintVisitor : public 
RecursiveASTVisitor<InlayHintVisitor> {
     bool HasNonDefaultArgs = false;
 
     ArrayRef<const ParmVarDecl *> Params, ForwardedParams;
+
     // Resolve parameter packs to their forwarded parameter
     SmallVector<const ParmVarDecl *> ForwardedParamsStorage;
+    // If args are direct-initialized
+    const CXXRecordDecl *CxxRecord{};
+
     if (Callee.Decl) {
       Params = maybeDropCxxExplicitObjectParameters(Callee.Decl->parameters());
-      ForwardedParamsStorage = resolveForwardingParameters(Callee.Decl);
+
+      [&]() {
+        auto Params = resolveForwardingParameters(Callee.Decl);
+        if (std::holds_alternative<decltype(ForwardedParamsStorage)>(Params)) {
+          ForwardedParamsStorage =
+              std::get<decltype(ForwardedParamsStorage)>(Params);
+        }
+        if (std::holds_alternative<decltype(CxxRecord)>(Params)) {
+          CxxRecord = std::get<decltype(CxxRecord)>(Params);
+        }
+      }();
----------------
upsj wrote:

Does this actually need to be an IIFE, or can we just use different variable 
names? I'm guessing the goal is to shadow the Params variable? Name is just a 
suggestion.
```suggestion
      auto ParamsOrRecord = resolveForwardingParameters(Callee.Decl);
      if 
(std::holds_alternative<decltype(ForwardedParamsStorage)>(ParamsOrRecord)) {
        ForwardedParamsStorage =
            std::get<decltype(ForwardedParamsStorage)>(ParamsOrRecord);
      }
      if (std::holds_alternative<decltype(CxxRecord)>(ParamsOrRecord)) {
        CxxRecord = std::get<decltype(CxxRecord)>(ParamsOrRecord);
      }
```

https://github.com/llvm/llvm-project/pull/176635
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to