[clang] Revert "Reapply "[Clang][Sema] Use the correct lookup context when building overloaded 'operator->' in the current instantiation (#104458)"" (PR #123982)
llvm-ci wrote: LLVM Buildbot has detected a new failure on builder `llvm-clang-aarch64-darwin` running on `doug-worker-5` while building `clang` at step 6 "test-build-unified-tree-check-all". Full details are available at: https://lab.llvm.org/buildbot/#/builders/190/builds/13304 Here is the relevant piece of the build log for the reference ``` Step 6 (test-build-unified-tree-check-all) failure: test (failure) TEST 'LLVM :: ExecutionEngine/OrcLazy/multiple-compile-threads-basic.ll' FAILED Exit Code: 2 Command Output (stderr): -- RUN: at line 1: /Users/buildbot/buildbot-root/aarch64-darwin/build/bin/lli -jit-kind=orc-lazy -compile-threads=2 -thread-entry hello /Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/test/ExecutionEngine/OrcLazy/multiple-compile-threads-basic.ll | /Users/buildbot/buildbot-root/aarch64-darwin/build/bin/FileCheck /Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/test/ExecutionEngine/OrcLazy/multiple-compile-threads-basic.ll + /Users/buildbot/buildbot-root/aarch64-darwin/build/bin/lli -jit-kind=orc-lazy -compile-threads=2 -thread-entry hello /Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/test/ExecutionEngine/OrcLazy/multiple-compile-threads-basic.ll + /Users/buildbot/buildbot-root/aarch64-darwin/build/bin/FileCheck /Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/test/ExecutionEngine/OrcLazy/multiple-compile-threads-basic.ll PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace. #0 0x00010547e468 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/Users/buildbot/buildbot-root/aarch64-darwin/build/bin/lli+0x100e9a468) #1 0x00010547c4ec llvm::sys::RunSignalHandlers() (/Users/buildbot/buildbot-root/aarch64-darwin/build/bin/lli+0x100e984ec) #2 0x00010547eb24 SignalHandler(int) (/Users/buildbot/buildbot-root/aarch64-darwin/build/bin/lli+0x100e9ab24) #3 0x000191c1a584 (/usr/lib/system/libsystem_platform.dylib+0x18047a584) #4 0x000191be921c (/usr/lib/system/libsystem_pthread.dylib+0x18044921c) #5 0x000191b0fad0 (/usr/lib/libc++.1.dylib+0x18036fad0) #6 0x00010502e8dc void llvm::detail::UniqueFunctionBase, llvm::detail::DenseMapPair>>>::CallImpl, llvm::detail::DenseMapPair> const&)::$_45>(void*, llvm::Expected, llvm::detail::DenseMapPair>>&) (/Users/buildbot/buildbot-root/aarch64-darwin/build/bin/lli+0x100a4a8dc) #7 0x00010502a64c llvm::orc::AsynchronousSymbolQuery::handleComplete(llvm::orc::ExecutionSession&)::RunQueryCompleteTask::run() (/Users/buildbot/buildbot-root/aarch64-darwin/build/bin/lli+0x100a4664c) #8 0x0001050e69bc void* std::__1::__thread_proxy[abi:un170006]>, llvm::orc::DynamicThreadPoolTaskDispatcher::dispatch(std::__1::unique_ptr>)::$_0>>(void*) (/Users/buildbot/buildbot-root/aarch64-darwin/build/bin/lli+0x100b029bc) #9 0x000191be9f94 (/usr/lib/system/libsystem_pthread.dylib+0x180449f94) #10 0x000191be4d34 (/usr/lib/system/libsystem_pthread.dylib+0x180444d34) FileCheck error: '' is empty. FileCheck command line: /Users/buildbot/buildbot-root/aarch64-darwin/build/bin/FileCheck /Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/test/ExecutionEngine/OrcLazy/multiple-compile-threads-basic.ll -- ``` https://github.com/llvm/llvm-project/pull/123982 ___ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Revert "Reapply "[Clang][Sema] Use the correct lookup context when building overloaded 'operator->' in the current instantiation (#104458)"" (PR #123982)
https://github.com/sdkrystian updated
https://github.com/llvm/llvm-project/pull/123982
>From c57b0c0bda26134131a4c846e0b81b000250709d Mon Sep 17 00:00:00 2001
From: Krystian Stasiowski
Date: Wed, 22 Jan 2025 13:43:38 -0500
Subject: [PATCH 1/2] =?UTF-8?q?Revert=20"Reapply=20"[Clang][Sema]=20Use=20?=
=?UTF-8?q?the=20correct=20lookup=20context=20when=20building=20o=E2=80=A6?=
=?UTF-8?q?"?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This reverts commit 195a1fc5b05d7a42b2e3fa383edb9a7e8b34a9c5.
---
clang/include/clang/Sema/Sema.h | 5 ++-
clang/lib/Sema/SemaExprCXX.cpp| 21 +++--
clang/lib/Sema/SemaExprMember.cpp | 2 +-
clang/lib/Sema/SemaOverload.cpp | 20 +++--
clang/lib/Sema/TreeTransform.h| 5 +--
.../temp.res/temp.dep/temp.dep.type/p4.cpp| 45 +--
6 files changed, 39 insertions(+), 59 deletions(-)
diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index a2a47d535b8e06..9fa33d6ca76ba5 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -10608,8 +10608,9 @@ class Sema final : public SemaBase {
/// BuildOverloadedArrowExpr - Build a call to an overloaded @c operator->
/// (if one exists), where @c Base is an expression of class type and
/// @c Member is the name of the member we're trying to find.
- ExprResult BuildOverloadedArrowExpr(Expr *Base, SourceLocation OpLoc,
- bool *NoArrowOperatorFound);
+ ExprResult BuildOverloadedArrowExpr(Scope *S, Expr *Base,
+ SourceLocation OpLoc,
+ bool *NoArrowOperatorFound = nullptr);
ExprResult BuildCXXMemberCallExpr(Expr *Exp, NamedDecl *FoundDecl,
CXXConversionDecl *Method,
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp
index 0ebf5f54613926..1e39d69e8b230f 100644
--- a/clang/lib/Sema/SemaExprCXX.cpp
+++ b/clang/lib/Sema/SemaExprCXX.cpp
@@ -7999,6 +7999,18 @@ ExprResult Sema::ActOnStartCXXMemberReference(Scope *S,
Expr *Base,
QualType BaseType = Base->getType();
MayBePseudoDestructor = false;
+ if (BaseType->isDependentType()) {
+// If we have a pointer to a dependent type and are using the -> operator,
+// the object type is the type that the pointer points to. We might still
+// have enough information about that type to do something useful.
+if (OpKind == tok::arrow)
+ if (const PointerType *Ptr = BaseType->getAs())
+BaseType = Ptr->getPointeeType();
+
+ObjectType = ParsedType::make(BaseType);
+MayBePseudoDestructor = true;
+return Base;
+ }
// C++ [over.match.oper]p8:
// [...] When operator->returns, the operator-> is applied to the value
@@ -8013,7 +8025,7 @@ ExprResult Sema::ActOnStartCXXMemberReference(Scope *S,
Expr *Base,
SmallVector OperatorArrows;
CTypes.insert(Context.getCanonicalType(BaseType));
-while (BaseType->getAsRecordDecl()) {
+while (BaseType->isRecordType()) {
if (OperatorArrows.size() >= getLangOpts().ArrowDepth) {
Diag(OpLoc, diag::err_operator_arrow_depth_exceeded)
<< StartingType << getLangOpts().ArrowDepth <<
Base->getSourceRange();
@@ -8024,7 +8036,7 @@ ExprResult Sema::ActOnStartCXXMemberReference(Scope *S,
Expr *Base,
}
Result = BuildOverloadedArrowExpr(
- Base, OpLoc,
+ S, Base, OpLoc,
// When in a template specialization and on the first loop iteration,
// potentially give the default diagnostic (with the fixit in a
// separate note) instead of having the error reported back to here
@@ -8088,7 +8100,7 @@ ExprResult Sema::ActOnStartCXXMemberReference(Scope *S,
Expr *Base,
// it's legal for the type to be incomplete if this is a pseudo-destructor
// call. We'll do more incomplete-type checks later in the lookup process,
// so just skip this check for ObjC types.
- if (BaseType->isDependentType() || !BaseType->isRecordType()) {
+ if (!BaseType->isRecordType()) {
ObjectType = ParsedType::make(BaseType);
MayBePseudoDestructor = true;
return Base;
@@ -8099,7 +8111,8 @@ ExprResult Sema::ActOnStartCXXMemberReference(Scope *S,
Expr *Base,
// Unlike the object expression in other contexts, *this is not required to
// be of complete type for purposes of class member access (5.2.5) outside
// the member function body.
- if (!isThisOutsideMemberFunctionBody(BaseType) &&
+ if (!BaseType->isDependentType() &&
+ !isThisOutsideMemberFunctionBody(BaseType) &&
RequireCompleteType(OpLoc, BaseType,
diag::err_incomplete_member_access)) {
return CreateRecoveryExpr(Base->getBeginLoc(), Base->getEndLoc(), {Base});
diff --git a/clang/lib/Sema/SemaExprMember.cpp
b/clang/lib/Sema/SemaExprMemb
[clang] Revert "Reapply "[Clang][Sema] Use the correct lookup context when building overloaded 'operator->' in the current instantiation (#104458)"" (PR #123982)
https://github.com/sdkrystian closed https://github.com/llvm/llvm-project/pull/123982 ___ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Revert "Reapply "[Clang][Sema] Use the correct lookup context when building overloaded 'operator->' in the current instantiation (#104458)"" (PR #123982)
github-actions[bot] wrote:
:warning: C/C++ code formatter, clang-format found issues in your code.
:warning:
You can test this locally with the following command:
``bash
git-clang-format --diff 589593254eede2f624f29390dc1018725e536505
c57b0c0bda26134131a4c846e0b81b000250709d --extensions cpp,h --
clang/include/clang/Sema/Sema.h clang/lib/Sema/SemaExprCXX.cpp
clang/lib/Sema/SemaExprMember.cpp clang/lib/Sema/SemaOverload.cpp
clang/lib/Sema/TreeTransform.h
clang/test/CXX/temp/temp.res/temp.dep/temp.dep.type/p4.cpp
``
View the diff from clang-format here.
``diff
diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp
index 7e8811b527..23056ca5de 100644
--- a/clang/lib/Sema/SemaOverload.cpp
+++ b/clang/lib/Sema/SemaOverload.cpp
@@ -15962,9 +15962,9 @@ Sema::BuildCallToObjectOfClassType(Scope *S, Expr *Obj,
return CheckForImmediateInvocation(MaybeBindToTemporary(TheCall), Method);
}
-ExprResult
-Sema::BuildOverloadedArrowExpr(Scope *S, Expr *Base, SourceLocation OpLoc,
- bool *NoArrowOperatorFound) {
+ExprResult Sema::BuildOverloadedArrowExpr(Scope *S, Expr *Base,
+ SourceLocation OpLoc,
+ bool *NoArrowOperatorFound) {
assert(Base->getType()->isRecordType() &&
"left-hand side must have class type");
``
https://github.com/llvm/llvm-project/pull/123982
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Revert "Reapply "[Clang][Sema] Use the correct lookup context when building overloaded 'operator->' in the current instantiation (#104458)"" (PR #123982)
llvmbot wrote:
@llvm/pr-subscribers-clang
Author: Krystian Stasiowski (sdkrystian)
Changes
Reverts llvm/llvm-project#109422
---
Full diff: https://github.com/llvm/llvm-project/pull/123982.diff
6 Files Affected:
- (modified) clang/include/clang/Sema/Sema.h (+3-2)
- (modified) clang/lib/Sema/SemaExprCXX.cpp (+17-4)
- (modified) clang/lib/Sema/SemaExprMember.cpp (+1-1)
- (modified) clang/lib/Sema/SemaOverload.cpp (+5-15)
- (modified) clang/lib/Sema/TreeTransform.h (+2-3)
- (modified) clang/test/CXX/temp/temp.res/temp.dep/temp.dep.type/p4.cpp
(+11-34)
``diff
diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index a2a47d535b8e06..9fa33d6ca76ba5 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -10608,8 +10608,9 @@ class Sema final : public SemaBase {
/// BuildOverloadedArrowExpr - Build a call to an overloaded @c operator->
/// (if one exists), where @c Base is an expression of class type and
/// @c Member is the name of the member we're trying to find.
- ExprResult BuildOverloadedArrowExpr(Expr *Base, SourceLocation OpLoc,
- bool *NoArrowOperatorFound);
+ ExprResult BuildOverloadedArrowExpr(Scope *S, Expr *Base,
+ SourceLocation OpLoc,
+ bool *NoArrowOperatorFound = nullptr);
ExprResult BuildCXXMemberCallExpr(Expr *Exp, NamedDecl *FoundDecl,
CXXConversionDecl *Method,
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp
index 0ebf5f54613926..1e39d69e8b230f 100644
--- a/clang/lib/Sema/SemaExprCXX.cpp
+++ b/clang/lib/Sema/SemaExprCXX.cpp
@@ -7999,6 +7999,18 @@ ExprResult Sema::ActOnStartCXXMemberReference(Scope *S,
Expr *Base,
QualType BaseType = Base->getType();
MayBePseudoDestructor = false;
+ if (BaseType->isDependentType()) {
+// If we have a pointer to a dependent type and are using the -> operator,
+// the object type is the type that the pointer points to. We might still
+// have enough information about that type to do something useful.
+if (OpKind == tok::arrow)
+ if (const PointerType *Ptr = BaseType->getAs())
+BaseType = Ptr->getPointeeType();
+
+ObjectType = ParsedType::make(BaseType);
+MayBePseudoDestructor = true;
+return Base;
+ }
// C++ [over.match.oper]p8:
// [...] When operator->returns, the operator-> is applied to the value
@@ -8013,7 +8025,7 @@ ExprResult Sema::ActOnStartCXXMemberReference(Scope *S,
Expr *Base,
SmallVector OperatorArrows;
CTypes.insert(Context.getCanonicalType(BaseType));
-while (BaseType->getAsRecordDecl()) {
+while (BaseType->isRecordType()) {
if (OperatorArrows.size() >= getLangOpts().ArrowDepth) {
Diag(OpLoc, diag::err_operator_arrow_depth_exceeded)
<< StartingType << getLangOpts().ArrowDepth <<
Base->getSourceRange();
@@ -8024,7 +8036,7 @@ ExprResult Sema::ActOnStartCXXMemberReference(Scope *S,
Expr *Base,
}
Result = BuildOverloadedArrowExpr(
- Base, OpLoc,
+ S, Base, OpLoc,
// When in a template specialization and on the first loop iteration,
// potentially give the default diagnostic (with the fixit in a
// separate note) instead of having the error reported back to here
@@ -8088,7 +8100,7 @@ ExprResult Sema::ActOnStartCXXMemberReference(Scope *S,
Expr *Base,
// it's legal for the type to be incomplete if this is a pseudo-destructor
// call. We'll do more incomplete-type checks later in the lookup process,
// so just skip this check for ObjC types.
- if (BaseType->isDependentType() || !BaseType->isRecordType()) {
+ if (!BaseType->isRecordType()) {
ObjectType = ParsedType::make(BaseType);
MayBePseudoDestructor = true;
return Base;
@@ -8099,7 +8111,8 @@ ExprResult Sema::ActOnStartCXXMemberReference(Scope *S,
Expr *Base,
// Unlike the object expression in other contexts, *this is not required to
// be of complete type for purposes of class member access (5.2.5) outside
// the member function body.
- if (!isThisOutsideMemberFunctionBody(BaseType) &&
+ if (!BaseType->isDependentType() &&
+ !isThisOutsideMemberFunctionBody(BaseType) &&
RequireCompleteType(OpLoc, BaseType,
diag::err_incomplete_member_access)) {
return CreateRecoveryExpr(Base->getBeginLoc(), Base->getEndLoc(), {Base});
diff --git a/clang/lib/Sema/SemaExprMember.cpp
b/clang/lib/Sema/SemaExprMember.cpp
index 8326a4db0a7719..d130e8b86bc56d 100644
--- a/clang/lib/Sema/SemaExprMember.cpp
+++ b/clang/lib/Sema/SemaExprMember.cpp
@@ -1357,7 +1357,7 @@ static ExprResult LookupMemberExpr(Sema &S, LookupResult
&R,
BaseType = Ptr->getPointeeType();
else if (BaseType->isFunctionType())
goto fail;
-else if (BaseExpr.get()->isTypeDependent())
+else if
[clang] Revert "Reapply "[Clang][Sema] Use the correct lookup context when building overloaded 'operator->' in the current instantiation (#104458)"" (PR #123982)
https://github.com/sdkrystian created
https://github.com/llvm/llvm-project/pull/123982
Reverts llvm/llvm-project#109422
>From c57b0c0bda26134131a4c846e0b81b000250709d Mon Sep 17 00:00:00 2001
From: Krystian Stasiowski
Date: Wed, 22 Jan 2025 13:43:38 -0500
Subject: [PATCH] =?UTF-8?q?Revert=20"Reapply=20"[Clang][Sema]=20Use=20the?=
=?UTF-8?q?=20correct=20lookup=20context=20when=20building=20o=E2=80=A6"?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This reverts commit 195a1fc5b05d7a42b2e3fa383edb9a7e8b34a9c5.
---
clang/include/clang/Sema/Sema.h | 5 ++-
clang/lib/Sema/SemaExprCXX.cpp| 21 +++--
clang/lib/Sema/SemaExprMember.cpp | 2 +-
clang/lib/Sema/SemaOverload.cpp | 20 +++--
clang/lib/Sema/TreeTransform.h| 5 +--
.../temp.res/temp.dep/temp.dep.type/p4.cpp| 45 +--
6 files changed, 39 insertions(+), 59 deletions(-)
diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index a2a47d535b8e06..9fa33d6ca76ba5 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -10608,8 +10608,9 @@ class Sema final : public SemaBase {
/// BuildOverloadedArrowExpr - Build a call to an overloaded @c operator->
/// (if one exists), where @c Base is an expression of class type and
/// @c Member is the name of the member we're trying to find.
- ExprResult BuildOverloadedArrowExpr(Expr *Base, SourceLocation OpLoc,
- bool *NoArrowOperatorFound);
+ ExprResult BuildOverloadedArrowExpr(Scope *S, Expr *Base,
+ SourceLocation OpLoc,
+ bool *NoArrowOperatorFound = nullptr);
ExprResult BuildCXXMemberCallExpr(Expr *Exp, NamedDecl *FoundDecl,
CXXConversionDecl *Method,
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp
index 0ebf5f54613926..1e39d69e8b230f 100644
--- a/clang/lib/Sema/SemaExprCXX.cpp
+++ b/clang/lib/Sema/SemaExprCXX.cpp
@@ -7999,6 +7999,18 @@ ExprResult Sema::ActOnStartCXXMemberReference(Scope *S,
Expr *Base,
QualType BaseType = Base->getType();
MayBePseudoDestructor = false;
+ if (BaseType->isDependentType()) {
+// If we have a pointer to a dependent type and are using the -> operator,
+// the object type is the type that the pointer points to. We might still
+// have enough information about that type to do something useful.
+if (OpKind == tok::arrow)
+ if (const PointerType *Ptr = BaseType->getAs())
+BaseType = Ptr->getPointeeType();
+
+ObjectType = ParsedType::make(BaseType);
+MayBePseudoDestructor = true;
+return Base;
+ }
// C++ [over.match.oper]p8:
// [...] When operator->returns, the operator-> is applied to the value
@@ -8013,7 +8025,7 @@ ExprResult Sema::ActOnStartCXXMemberReference(Scope *S,
Expr *Base,
SmallVector OperatorArrows;
CTypes.insert(Context.getCanonicalType(BaseType));
-while (BaseType->getAsRecordDecl()) {
+while (BaseType->isRecordType()) {
if (OperatorArrows.size() >= getLangOpts().ArrowDepth) {
Diag(OpLoc, diag::err_operator_arrow_depth_exceeded)
<< StartingType << getLangOpts().ArrowDepth <<
Base->getSourceRange();
@@ -8024,7 +8036,7 @@ ExprResult Sema::ActOnStartCXXMemberReference(Scope *S,
Expr *Base,
}
Result = BuildOverloadedArrowExpr(
- Base, OpLoc,
+ S, Base, OpLoc,
// When in a template specialization and on the first loop iteration,
// potentially give the default diagnostic (with the fixit in a
// separate note) instead of having the error reported back to here
@@ -8088,7 +8100,7 @@ ExprResult Sema::ActOnStartCXXMemberReference(Scope *S,
Expr *Base,
// it's legal for the type to be incomplete if this is a pseudo-destructor
// call. We'll do more incomplete-type checks later in the lookup process,
// so just skip this check for ObjC types.
- if (BaseType->isDependentType() || !BaseType->isRecordType()) {
+ if (!BaseType->isRecordType()) {
ObjectType = ParsedType::make(BaseType);
MayBePseudoDestructor = true;
return Base;
@@ -8099,7 +8111,8 @@ ExprResult Sema::ActOnStartCXXMemberReference(Scope *S,
Expr *Base,
// Unlike the object expression in other contexts, *this is not required to
// be of complete type for purposes of class member access (5.2.5) outside
// the member function body.
- if (!isThisOutsideMemberFunctionBody(BaseType) &&
+ if (!BaseType->isDependentType() &&
+ !isThisOutsideMemberFunctionBody(BaseType) &&
RequireCompleteType(OpLoc, BaseType,
diag::err_incomplete_member_access)) {
return CreateRecoveryExpr(Base->getBeginLoc(), Base->getEndLoc(), {Base});
diff --git a/clang/lib/Sema/SemaExprMember.cpp
b/clang/lib/S
