[flang-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)
Tianlan Zhou via flang-commits
flang-commits at lists.llvm.org
Tue Jan 30 21:06:27 PST 2024
================
@@ -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<CXXMethodDecl>(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
More information about the flang-commits
mailing list