[lld] [lldb] [libunwind] [mlir] [libcxx] [llvm] [openmp] [libc] [compiler-rt] [flang] [clang-tools-extra] [libcxxabi] [clang] [clang] static operators should evaluate object argument (PR #68485)

2024-01-30 Thread Younan Zhang via cfe-commits


@@ -15097,15 +15102,9 @@ ExprResult 
Sema::CreateOverloadedArraySubscriptExpr(SourceLocation LLoc,
 ExprValueKind VK = Expr::getValueKindForType(ResultTy);
 ResultTy = ResultTy.getNonLValueExprType(Context);
 
-CallExpr *TheCall;
-if (Method->isInstance())
-  TheCall = CXXOperatorCallExpr::Create(
-  Context, OO_Subscript, FnExpr.get(), MethodArgs, ResultTy, VK,
-  RLoc, CurFPFeatureOverrides());
-else
-  TheCall =
-  CallExpr::Create(Context, FnExpr.get(), MethodArgs, ResultTy, VK,
-   RLoc, CurFPFeatureOverrides());
+CallExpr *TheCall = CXXOperatorCallExpr::Create(

zyn0217 wrote:

Thanks. Given that the commit has been reverted, can you please submit a new 
relanding PR?

https://github.com/llvm/llvm-project/pull/68485
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[lld] [lldb] [libunwind] [mlir] [libcxx] [llvm] [openmp] [libc] [compiler-rt] [flang] [clang-tools-extra] [libcxxabi] [clang] [clang] static operators should evaluate object argument (PR #68485)

2024-01-30 Thread Tianlan Zhou via cfe-commits


@@ -15097,15 +15102,9 @@ ExprResult 
Sema::CreateOverloadedArraySubscriptExpr(SourceLocation LLoc,
 ExprValueKind VK = Expr::getValueKindForType(ResultTy);
 ResultTy = ResultTy.getNonLValueExprType(Context);
 
-CallExpr *TheCall;
-if (Method->isInstance())
-  TheCall = CXXOperatorCallExpr::Create(
-  Context, OO_Subscript, FnExpr.get(), MethodArgs, ResultTy, VK,
-  RLoc, CurFPFeatureOverrides());
-else
-  TheCall =
-  CallExpr::Create(Context, FnExpr.get(), MethodArgs, ResultTy, VK,
-   RLoc, CurFPFeatureOverrides());
+CallExpr *TheCall = CXXOperatorCallExpr::Create(

SuperSodaSea wrote:

You are right, `hasCXXExplicitFunctionObjectParameter()` should imply 
`isInstance()`, so `isInstance()` is no longer needed. Passed `check-clangd` on 
my own build.

```diff
  if (const CXXMethodDecl *Method =
  dyn_cast_or_null(Callee.Decl))
-   if (Method->isInstance() &&
-   (IsFunctor || Method->hasCXXExplicitFunctionObjectParameter()))
+   if (IsFunctor || Method->hasCXXExplicitFunctionObjectParameter())
  Args = Args.drop_front(1);
```

Diff: 
1ceaae47b2b43fd8fa5512e20e0b32a7e8f4ab5b...910ae406c88efd5cc97894dc1408606094bc0b82

https://github.com/llvm/llvm-project/pull/68485
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits