[Lldb-commits] [clang] [clang-tools-extra] [lldb] [clang] Reland: Instantiate alias templates with sugar (PR #101858)

2024-08-08 Thread Younan Zhang via lldb-commits

zyn0217 wrote:

> or if we would implement a `TypeAliasTemplateSpecializationDecl` only for the 
> benefit of external resugarers.

It is not only valuable to external resugarers. Another point that warrants an 
introduction of it is for unevaluated lambdas. These lambdas e.g. appearing as 
part of the `using Alias = decltype(lambda)` could carry a requires expression 
and thus evaluating it requires the recovery of the instantiating template 
arguments for the type alias, which isn't a quite natural thing without such a 
Decl. I have improved some of these situations through an on-stack 
InstantiatingTemplate to help to inspect the template arguments; however, that 
approach is somewhat cumbersome and still couldn't extend to other scenarios 
e.g. mangling these lambdas. 
(https://github.com/llvm/llvm-project/issues/97024. We need a correct 
DeclContext for the lambda, yet a `TypeAliasTemplateDecl` isn't a DeclContext, 
unfortunately.)


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


[Lldb-commits] [clang] [clang-tools-extra] [lldb] [clang] Reland: Instantiate alias templates with sugar (PR #101858)

2024-08-11 Thread Younan Zhang via lldb-commits

zyn0217 wrote:

> See for example CXXRecordDecl's getLambdaContextDecl function.
> Unfortunately there is an issue where we currently only store this lambda 
> context when we need it for mangling reasons, …

Yeah, I remember we use that to store an ImplicitConceptSpecializationDecl as 
well, not only for the purpose of mangling but also for lambdas appearing 
inside a concept. We probably could do the same for the using aliases, though 
that still needs some tweaking to store template arguments.

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


[Lldb-commits] [lldb] [lldb][NFC] Handle UnresolvedTemplate type in TypeSystemClang.cpp after 7a484d3 (PR #91132)

2024-05-05 Thread Younan Zhang via lldb-commits

https://github.com/zyn0217 created 
https://github.com/llvm/llvm-project/pull/91132

The fix per se seems trivial (given the nature of the new built-in type), and 
hence I don't think we need extra tests.

>From e28f8b007e86d10c3649f8e4635c9bb52627302b Mon Sep 17 00:00:00 2001
From: Younan Zhang 
Date: Mon, 6 May 2024 00:20:14 +0800
Subject: [PATCH] [lldb][NFC] Handle UnresolvedTemplate type in
 TypeSystemClang.cpp after 7a484d3

---
 lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index 2621f682011b41..08d32e71c7fd32 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -3983,6 +3983,7 @@ 
TypeSystemClang::GetMinimumLanguage(lldb::opaque_compiler_type_t type) {
 
   case clang::BuiltinType::Dependent:
   case clang::BuiltinType::Overload:
+  case clang::BuiltinType::UnresolvedTemplate:
   case clang::BuiltinType::BoundMember:
   case clang::BuiltinType::UnknownAny:
 break;
@@ -5962,6 +5963,7 @@ uint32_t 
TypeSystemClang::GetNumPointeeChildren(clang::QualType type) {
 case clang::BuiltinType::LongDouble:
 case clang::BuiltinType::Dependent:
 case clang::BuiltinType::Overload:
+case clang::BuiltinType::UnresolvedTemplate:
 case clang::BuiltinType::ObjCId:
 case clang::BuiltinType::ObjCClass:
 case clang::BuiltinType::ObjCSel:

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][NFC] Handle UnresolvedTemplate type in TypeSystemClang.cpp after 7a484d3 (PR #91132)

2024-05-05 Thread Younan Zhang via lldb-commits

zyn0217 wrote:

@aganea Feel free to commit this PR yourself if this works - It's midnight and 
I'm not going to sit here. Thanks!

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


[Lldb-commits] [lldb] [lldb][NFC] Handle UnresolvedTemplate type in TypeSystemClang.cpp after 7a484d3 (PR #91132)

2024-05-06 Thread Younan Zhang via lldb-commits

zyn0217 wrote:

This had been fixed by 41574f5a6. Thanks @dwblaikie!

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


[Lldb-commits] [lldb] [lldb][NFC] Handle UnresolvedTemplate type in TypeSystemClang.cpp after 7a484d3 (PR #91132)

2024-05-06 Thread Younan Zhang via lldb-commits

https://github.com/zyn0217 closed 
https://github.com/llvm/llvm-project/pull/91132
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lld] [flang] [clang] [clang-tools-extra] [libc] [libcxx] [llvm] [lldb] [compiler-rt] [concepts] Set up an instantiation scope for constraint expression comparison (PR #79698)

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

https://github.com/zyn0217 updated 
https://github.com/llvm/llvm-project/pull/79698

>From 39f64e6fa02392415f0e2776166d4451346e7e81 Mon Sep 17 00:00:00 2001
From: Younan Zhang 
Date: Sun, 28 Jan 2024 01:17:32 +0800
Subject: [PATCH] [concepts] Set up an instantiation scope for constraint
 expression comparison

This is a follow-up for the comparison of constraints on out-of-line
function template definitions. We require the instantiation of a
ParmVarDecl while transforming the expression if that Decl gets
referenced by a DeclRefExpr. However, we're not actually performing
the class or function template instantiation at the time of such
comparison. Therefore, let's map these parameters to themselves so
that they get preserved after the substitution.

Fixes https://github.com/llvm/llvm-project/issues/74447.
---
 clang/docs/ReleaseNotes.rst   |  3 +++
 clang/lib/Sema/SemaConcept.cpp|  9 
 .../SemaTemplate/concepts-out-of-line-def.cpp | 22 +++
 3 files changed, 34 insertions(+)

diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index aa06e2b60ce91..3c5856788e717 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -128,6 +128,9 @@ Bug Fixes to C++ Support
 - Fixed a bug where variables referenced by requires-clauses inside
   nested generic lambdas were not properly injected into the constraint scope.
   (`#73418 `_)
+- Fixed a crash where substituting into a requires-expression that refers to 
function
+  parameters during the equivalence determination of two constraint 
expressions.
+  (`#74447 `)
 
 Bug Fixes to AST Handling
 ^
diff --git a/clang/lib/Sema/SemaConcept.cpp b/clang/lib/Sema/SemaConcept.cpp
index 88fc846c89e42..19a460f411757 100644
--- a/clang/lib/Sema/SemaConcept.cpp
+++ b/clang/lib/Sema/SemaConcept.cpp
@@ -797,6 +797,15 @@ static const Expr 
*SubstituteConstraintExpressionWithoutSatisfaction(
   if (Inst.isInvalid())
 return nullptr;
 
+  // Set up a dummy 'instantiation' scope in the case of reference to function
+  // parameters that the surrounding function hasn't been instantiated yet. 
Note
+  // this may happen while we're comparing two templates' constraint
+  // equivalence.
+  LocalInstantiationScope ScopeForParameters(S);
+  if (auto *FD = llvm::dyn_cast(DeclInfo.getDecl()))
+for (auto *PVD : FD->parameters())
+  ScopeForParameters.InstantiatedLocal(PVD, PVD);
+
   std::optional ThisScope;
   if (auto *RD = dyn_cast(DeclInfo.getDeclContext()))
 ThisScope.emplace(S, const_cast(RD), Qualifiers());
diff --git a/clang/test/SemaTemplate/concepts-out-of-line-def.cpp 
b/clang/test/SemaTemplate/concepts-out-of-line-def.cpp
index c4e8e6f720c49..7323ad8d9ef2c 100644
--- a/clang/test/SemaTemplate/concepts-out-of-line-def.cpp
+++ b/clang/test/SemaTemplate/concepts-out-of-line-def.cpp
@@ -536,3 +536,25 @@ void X::bar(decltype(requires { requires 
something_interesting; })) {}
 template 
 void X::bar(decltype(requires { requires is_not_same_v; })) {}
 } // namespace GH74314
+
+namespace GH74447 {
+template  struct S {
+  template 
+  void test(T target, U... value)
+requires requires {
+  target;
+  sizeof...(value) == 1;
+  V == 2;
+};
+};
+
+template 
+template 
+void S::test(T target, U... value)
+  requires requires {
+target;
+sizeof...(value) == 1;
+V == 2;
+  }
+{}
+} // namespace GH74447

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lld] [flang] [clang] [clang-tools-extra] [libc] [libcxx] [llvm] [lldb] [compiler-rt] [concepts] Set up an instantiation scope for constraint expression comparison (PR #79698)

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

zyn0217 wrote:

I'll try the CI again before landing it.

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


[Lldb-commits] [lld] [clang] [llvm] [lldb] [clang-tools-extra] [libc] [compiler-rt] [libcxx] [flang] [concepts] Push a CurContext before substituting into out-of-line constraints for comparison (PR #7

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

https://github.com/zyn0217 updated 
https://github.com/llvm/llvm-project/pull/79985

>From 7ee1874af426d7879d218c6b8852fca0a87b1836 Mon Sep 17 00:00:00 2001
From: Younan Zhang 
Date: Tue, 30 Jan 2024 18:49:08 +0800
Subject: [PATCH] [concepts] Push a CurContext before substituting into
 out-of-line constraints for comparison

InjectedClassNameType is such that every template specialization within
the Record scope ought to canonicalize to it, as outlined above the
definition of that Type.

This invariant is maintained during the tree transformation at the rebuilding
stage for a template specialization type; see RebuildTemplateSpecializationType.
In that, we attempt to retrieve the current instantiation from Sema.CurContext,
and if that fails, the transformation proceeds silently.

In terms of this issue, we previously set no CurContext other than that set
by Parser, who had left the FunctionDecl before performing the constraint 
comparison.
As a result, we would profile these types (i.e. InjectedClassNameType and its
specialization type) into different values and fail to consider two expressions
equivalent, although they are.

In passing, this also fixes a crash while attempting to dump the transformed 
expression.
We failed to look into the template parameters from a CXXRecordDecl, which we
should have done since the Decl we bound to a SubstTemplateTypeParmType can be 
of
a CXXRecord type per the call to `getTemplateInstantiationArgs`
within `SubstituteConstraintExpressionWithoutSatisfaction.`

This addresses https://github.com/llvm/llvm-project/issues/56482.
---
 clang/docs/ReleaseNotes.rst   |  3 +++
 clang/lib/AST/DeclTemplate.cpp|  4 +++
 clang/lib/Sema/SemaConcept.cpp| 14 ++-
 .../SemaTemplate/concepts-out-of-line-def.cpp | 25 +++
 4 files changed, 45 insertions(+), 1 deletion(-)

diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index aa06e2b60ce9..52fe4fabfb61 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -128,6 +128,9 @@ Bug Fixes to C++ Support
 - Fixed a bug where variables referenced by requires-clauses inside
   nested generic lambdas were not properly injected into the constraint scope.
   (`#73418 `_)
+- Addressed an issue where constraints involving injected class types are 
perceived
+  distinct from its specialization types.
+  (`#56482 `_)
 
 Bug Fixes to AST Handling
 ^
diff --git a/clang/lib/AST/DeclTemplate.cpp b/clang/lib/AST/DeclTemplate.cpp
index 7d7556e670f9..946a34ea8830 100644
--- a/clang/lib/AST/DeclTemplate.cpp
+++ b/clang/lib/AST/DeclTemplate.cpp
@@ -1583,6 +1583,10 @@ void 
TemplateParamObjectDecl::printAsInit(llvm::raw_ostream &OS,
 
 TemplateParameterList *clang::getReplacedTemplateParameterList(Decl *D) {
   switch (D->getKind()) {
+  case Decl::Kind::CXXRecord:
+return cast(D)
+->getDescribedTemplate()
+->getTemplateParameters();
   case Decl::Kind::ClassTemplate:
 return cast(D)->getTemplateParameters();
   case Decl::Kind::ClassTemplateSpecialization: {
diff --git a/clang/lib/Sema/SemaConcept.cpp b/clang/lib/Sema/SemaConcept.cpp
index 88fc846c89e4..b0974ca7f4a4 100644
--- a/clang/lib/Sema/SemaConcept.cpp
+++ b/clang/lib/Sema/SemaConcept.cpp
@@ -798,8 +798,20 @@ static const Expr 
*SubstituteConstraintExpressionWithoutSatisfaction(
 return nullptr;
 
   std::optional ThisScope;
-  if (auto *RD = dyn_cast(DeclInfo.getDeclContext()))
+
+  // See TreeTransform::RebuildTemplateSpecializationType. A context scope is
+  // essential for having an injected class as the canonical type for a 
template
+  // specialization type at the rebuilding stage. This guarantees that, for
+  // out-of-line definitions, injected class name types and their equivalent
+  // template specializations can be profiled to the same value, which makes it
+  // possible that e.g. constraints involving C> and C are
+  // perceived identical.
+  std::optional ContextScope;
+  if (auto *RD = dyn_cast(DeclInfo.getDeclContext())) {
 ThisScope.emplace(S, const_cast(RD), Qualifiers());
+ContextScope.emplace(S, const_cast(cast(RD)),
+ /*NewThisContext=*/false);
+  }
   ExprResult SubstConstr = S.SubstConstraintExprWithoutSatisfaction(
   const_cast(ConstrExpr), MLTAL);
   if (SFINAE.hasErrorOccurred() || !SubstConstr.isUsable())
diff --git a/clang/test/SemaTemplate/concepts-out-of-line-def.cpp 
b/clang/test/SemaTemplate/concepts-out-of-line-def.cpp
index c4e8e6f720c4..3a0c59f01217 100644
--- a/clang/test/SemaTemplate/concepts-out-of-line-def.cpp
+++ b/clang/test/SemaTemplate/concepts-out-of-line-def.cpp
@@ -536,3 +536,28 @@ void X::bar(decltype(requires { requires 
something_interesting; })) {}
 template 
 void X::bar(decltype(requires { requires is_not_same_v; })) {}
 } // namespace GH74314
+
+namesp

[Lldb-commits] [lld] [clang] [llvm] [lldb] [clang-tools-extra] [libc] [compiler-rt] [libcxx] [flang] [concepts] Set up an instantiation scope for constraint expression comparison (PR #79698)

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

https://github.com/zyn0217 closed 
https://github.com/llvm/llvm-project/pull/79698
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [lld] [libc] [lldb] [llvm] [clang-tools-extra] [flang] [libcxx] [compiler-rt] [concepts] Push a CurContext before substituting into out-of-line constraints for comparison (PR #7

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

https://github.com/zyn0217 updated 
https://github.com/llvm/llvm-project/pull/79985

>From 7ee1874af426d7879d218c6b8852fca0a87b1836 Mon Sep 17 00:00:00 2001
From: Younan Zhang 
Date: Tue, 30 Jan 2024 18:49:08 +0800
Subject: [PATCH] [concepts] Push a CurContext before substituting into
 out-of-line constraints for comparison

InjectedClassNameType is such that every template specialization within
the Record scope ought to canonicalize to it, as outlined above the
definition of that Type.

This invariant is maintained during the tree transformation at the rebuilding
stage for a template specialization type; see RebuildTemplateSpecializationType.
In that, we attempt to retrieve the current instantiation from Sema.CurContext,
and if that fails, the transformation proceeds silently.

In terms of this issue, we previously set no CurContext other than that set
by Parser, who had left the FunctionDecl before performing the constraint 
comparison.
As a result, we would profile these types (i.e. InjectedClassNameType and its
specialization type) into different values and fail to consider two expressions
equivalent, although they are.

In passing, this also fixes a crash while attempting to dump the transformed 
expression.
We failed to look into the template parameters from a CXXRecordDecl, which we
should have done since the Decl we bound to a SubstTemplateTypeParmType can be 
of
a CXXRecord type per the call to `getTemplateInstantiationArgs`
within `SubstituteConstraintExpressionWithoutSatisfaction.`

This addresses https://github.com/llvm/llvm-project/issues/56482.
---
 clang/docs/ReleaseNotes.rst   |  3 +++
 clang/lib/AST/DeclTemplate.cpp|  4 +++
 clang/lib/Sema/SemaConcept.cpp| 14 ++-
 .../SemaTemplate/concepts-out-of-line-def.cpp | 25 +++
 4 files changed, 45 insertions(+), 1 deletion(-)

diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index aa06e2b60ce91..52fe4fabfb619 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -128,6 +128,9 @@ Bug Fixes to C++ Support
 - Fixed a bug where variables referenced by requires-clauses inside
   nested generic lambdas were not properly injected into the constraint scope.
   (`#73418 `_)
+- Addressed an issue where constraints involving injected class types are 
perceived
+  distinct from its specialization types.
+  (`#56482 `_)
 
 Bug Fixes to AST Handling
 ^
diff --git a/clang/lib/AST/DeclTemplate.cpp b/clang/lib/AST/DeclTemplate.cpp
index 7d7556e670f95..946a34ea8830e 100644
--- a/clang/lib/AST/DeclTemplate.cpp
+++ b/clang/lib/AST/DeclTemplate.cpp
@@ -1583,6 +1583,10 @@ void 
TemplateParamObjectDecl::printAsInit(llvm::raw_ostream &OS,
 
 TemplateParameterList *clang::getReplacedTemplateParameterList(Decl *D) {
   switch (D->getKind()) {
+  case Decl::Kind::CXXRecord:
+return cast(D)
+->getDescribedTemplate()
+->getTemplateParameters();
   case Decl::Kind::ClassTemplate:
 return cast(D)->getTemplateParameters();
   case Decl::Kind::ClassTemplateSpecialization: {
diff --git a/clang/lib/Sema/SemaConcept.cpp b/clang/lib/Sema/SemaConcept.cpp
index 88fc846c89e42..b0974ca7f4a49 100644
--- a/clang/lib/Sema/SemaConcept.cpp
+++ b/clang/lib/Sema/SemaConcept.cpp
@@ -798,8 +798,20 @@ static const Expr 
*SubstituteConstraintExpressionWithoutSatisfaction(
 return nullptr;
 
   std::optional ThisScope;
-  if (auto *RD = dyn_cast(DeclInfo.getDeclContext()))
+
+  // See TreeTransform::RebuildTemplateSpecializationType. A context scope is
+  // essential for having an injected class as the canonical type for a 
template
+  // specialization type at the rebuilding stage. This guarantees that, for
+  // out-of-line definitions, injected class name types and their equivalent
+  // template specializations can be profiled to the same value, which makes it
+  // possible that e.g. constraints involving C> and C are
+  // perceived identical.
+  std::optional ContextScope;
+  if (auto *RD = dyn_cast(DeclInfo.getDeclContext())) {
 ThisScope.emplace(S, const_cast(RD), Qualifiers());
+ContextScope.emplace(S, const_cast(cast(RD)),
+ /*NewThisContext=*/false);
+  }
   ExprResult SubstConstr = S.SubstConstraintExprWithoutSatisfaction(
   const_cast(ConstrExpr), MLTAL);
   if (SFINAE.hasErrorOccurred() || !SubstConstr.isUsable())
diff --git a/clang/test/SemaTemplate/concepts-out-of-line-def.cpp 
b/clang/test/SemaTemplate/concepts-out-of-line-def.cpp
index c4e8e6f720c49..3a0c59f012179 100644
--- a/clang/test/SemaTemplate/concepts-out-of-line-def.cpp
+++ b/clang/test/SemaTemplate/concepts-out-of-line-def.cpp
@@ -536,3 +536,28 @@ void X::bar(decltype(requires { requires 
something_interesting; })) {}
 template 
 void X::bar(decltype(requires { requires is_not_same_v; })) {}
 } // namespace GH74314
+

[Lldb-commits] [libc] [libcxxabi] [lld] [clang-tools-extra] [llvm] [mlir] [flang] [lldb] [libunwind] [clang] [compiler-rt] [openmp] [libcxx] [clang] static operators should evaluate object argument (P

2024-01-30 Thread Younan Zhang via lldb-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:

While I haven’t had time to go through this PR, these lines appear to be the 
reason for the test failure. We had been relying on these different CallExprs 
to tell whether we should drop the explicit object parameter at the clangd site 
(IsFunctor). And this seemingly breaks that expectation as well as changes the 
AST?

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


[Lldb-commits] [llvm] [lldb] [lld] [libcxx] [clang-tools-extra] [libcxxabi] [libc] [clang] [libunwind] [openmp] [compiler-rt] [flang] [mlir] [clang] static operators should evaluate object argument (P

2024-01-30 Thread Younan Zhang via lldb-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 for the explanation! I think this is reasonable and makes it much more 
intuitive for static operator call expressions. So, if I understand the change 
correctly, I think we can simplify the condition testing at the clangd side: we 
can avoid the check isInstance on expressions. That means, can we just reduce 
the condition to IsFunctor && hasCXXExplicitFunctionObjectParameter?

I’m on my phone now, so I couldn't validate my thoughts. Could you please help 
me for it? I’m willing to help you reland the patch if that works!

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


[Lldb-commits] [libc] [libcxx] [lldb] [flang] [compiler-rt] [clang-tools-extra] [llvm] [lld] [clang] [concepts] Push a CurContext before substituting into out-of-line constraints for comparison (PR #7

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

https://github.com/zyn0217 closed 
https://github.com/llvm/llvm-project/pull/79985
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lld] [lldb] [libunwind] [mlir] [libcxx] [llvm] [openmp] [libc] [compiler-rt] [flang] [clang-tools-extra] [libcxxabi] [clang] [clang] static operators should evaluate object argument (P

2024-01-30 Thread Younan Zhang via lldb-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
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [flang] [clang-tools-extra] [compiler-rt] [lldb] [libunwind] [libcxx] [lld] [mlir] [clang] [libc] [openmp] [llvm] [libcxxabi] [clang] static operators should evaluate object argument (r

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

https://github.com/zyn0217 approved this pull request.

Thanks again for working on it. The clangd part LGTM, and since the other part 
was left as-is and had been accepted in our previous attempt #68485, I believe 
we can now reland the patch.

Please keep an eye on the CI in case we have missed anything else.

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


[Lldb-commits] [openmp] [lld] [compiler-rt] [flang] [lldb] [libunwind] [libcxxabi] [llvm] [libcxx] [mlir] [clang-tools-extra] [clang] [libc] [clang] static operators should evaluate object argument (r

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

https://github.com/zyn0217 closed 
https://github.com/llvm/llvm-project/pull/80108
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [openmp] [lld] [compiler-rt] [flang] [lldb] [libunwind] [libcxxabi] [llvm] [libcxx] [mlir] [clang-tools-extra] [clang] [libc] [clang] static operators should evaluate object argument (r

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


@@ -651,16 +651,12 @@ class InlayHintVisitor : public 
RecursiveASTVisitor {
 // implied object argument ([over.call.func]), the list of provided
 // arguments is preceded by the implied object argument for the purposes of
 // this correspondence...
-//
-// However, we don't have the implied object argument
-// for static operator() per clang::Sema::BuildCallToObjectOfClassType.
 llvm::ArrayRef Args = {E->getArgs(), E->getNumArgs()};
 // We don't have the implied object argument through a function pointer
 // either.
 if (const CXXMethodDecl *Method =
 dyn_cast_or_null(Callee.Decl))
-  if (Method->isInstance() &&
-  (IsFunctor || Method->hasCXXExplicitFunctionObjectParameter()))
+  if (IsFunctor || Method->hasCXXExplicitFunctionObjectParameter())

zyn0217 wrote:

See 
https://github.com/llvm/llvm-project/pull/68485/files#diff-19c518dbc68b30c66e1a2b6bd523c005fb2050dcf1a0e92305df7ab3e1b9e9f3L15744-L15751.
 The patch actually changes the behavior when we put an implied object 
argument. (I was replying at wrong place in that PR...)

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


[Lldb-commits] [openmp] [lld] [compiler-rt] [flang] [lldb] [libunwind] [libcxxabi] [llvm] [libcxx] [mlir] [clang-tools-extra] [clang] [libc] [clang] static operators should evaluate object argument (r

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


@@ -651,16 +651,12 @@ class InlayHintVisitor : public 
RecursiveASTVisitor {
 // implied object argument ([over.call.func]), the list of provided
 // arguments is preceded by the implied object argument for the purposes of
 // this correspondence...
-//
-// However, we don't have the implied object argument
-// for static operator() per clang::Sema::BuildCallToObjectOfClassType.
 llvm::ArrayRef Args = {E->getArgs(), E->getNumArgs()};
 // We don't have the implied object argument through a function pointer
 // either.
 if (const CXXMethodDecl *Method =
 dyn_cast_or_null(Callee.Decl))
-  if (Method->isInstance() &&
-  (IsFunctor || Method->hasCXXExplicitFunctionObjectParameter()))
+  if (IsFunctor || Method->hasCXXExplicitFunctionObjectParameter())

zyn0217 wrote:

So we may have an implied object argument for *static* operator() calls without 
an explicit object parameter, while it was only applied previously to 
*non-static* (`isInstance()`) operator() calls.

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


[Lldb-commits] [llvm] [libcxx] [lld] [libc] [compiler-rt] [lldb] [clang] [clang-tools-extra] [flang] [concepts] Push a CurContext before substituting into out-of-line constraints for comparison (PR #7

2024-01-31 Thread Younan Zhang via lldb-commits

zyn0217 wrote:

I plan to backport this patch and #79698 to clang 18 a few days later to see if 
we're actually not breaking anything.

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


[Lldb-commits] [clang] [clang-tools-extra] [lldb] Reland [clang] Unify `SourceLocation` and `IdentifierInfo*` pair-like data structures to `IdentifierLoc` (PR #136077)

2025-04-16 Thread Younan Zhang via lldb-commits

https://github.com/zyn0217 approved this pull request.


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


[Lldb-commits] [lldb] [llvm] Test "Revert "[CI] monolithic-linux improvements"" (PR #136078)

2025-04-16 Thread Younan Zhang via lldb-commits

https://github.com/zyn0217 created 
https://github.com/llvm/llvm-project/pull/136078

None

>From e70b8283d7778568ff715f8cc400732ad92ac321 Mon Sep 17 00:00:00 2001
From: Younan Zhang 
Date: Thu, 17 Apr 2025 11:45:52 +0800
Subject: [PATCH] Revert "[CI] monolithic-linux improvements (#135499)"

This reverts commit a399c6926a8701083c767cbb041e22ff92e9d717.
---
 .ci/compute_projects.py  | 10 ++---
 .ci/compute_projects_test.py | 13 ---
 .ci/monolithic-linux.sh  | 72 
 lldb/test/requirements.txt   |  2 -
 4 files changed, 44 insertions(+), 53 deletions(-)

diff --git a/.ci/compute_projects.py b/.ci/compute_projects.py
index 17a2136a270d5..ff43547c9bbe5 100644
--- a/.ci/compute_projects.py
+++ b/.ci/compute_projects.py
@@ -52,9 +52,6 @@
 "clang": {"clang-tools-extra", "compiler-rt", "cross-project-tests"},
 "clang-tools-extra": {"libc"},
 "mlir": {"flang"},
-# Test everything if ci scripts are changed.
-# FIXME: Figure out what is missing and add here.
-".ci": {"llvm", "clang", "lld", "lldb"},
 }
 
 DEPENDENT_RUNTIMES_TO_TEST = {"clang": {"libcxx", "libcxxabi", "libunwind"}}
@@ -133,11 +130,12 @@ def _add_dependencies(projects: Set[str]) -> Set[str]:
 def _compute_projects_to_test(modified_projects: Set[str], platform: str) -> 
Set[str]:
 projects_to_test = set()
 for modified_project in modified_projects:
+# Skip all projects where we cannot run tests.
+if modified_project not in PROJECT_CHECK_TARGETS:
+continue
 if modified_project in RUNTIMES:
 continue
-# Skip all projects where we cannot run tests.
-if modified_project in PROJECT_CHECK_TARGETS:
-projects_to_test.add(modified_project)
+projects_to_test.add(modified_project)
 if modified_project not in DEPENDENTS_TO_TEST:
 continue
 for dependent_project in DEPENDENTS_TO_TEST[modified_project]:
diff --git a/.ci/compute_projects_test.py b/.ci/compute_projects_test.py
index 1ab1c82498932..e787fd8133c86 100644
--- a/.ci/compute_projects_test.py
+++ b/.ci/compute_projects_test.py
@@ -188,19 +188,6 @@ def test_exclude_gn(self):
 self.assertEqual(env_variables["runtimes_to_build"], "")
 self.assertEqual(env_variables["runtimes_check_targets"], "")
 
- def test_ci(self):
-env_variables = compute_projects.get_env_variables(
-[".ci/compute_projects.py"], "Linux"
-)
-self.assertEqual(env_variables["projects_to_build"],
- "clang;lld;llvm;lldb")
-self.assertEqual(env_variables["project_check_targets"], "check-clang
- check-lld check-llvm check-lldb")
-self.assertEqual(env_variables["runtimes_to_build"],
- "libcxx;libcxxabi;libunwind")
-self.assertEqual(env_variables["runtimes_check_targets"], "check-cxx
- check-cxxabi check-unwind")
-
 
 if __name__ == "__main__":
 unittest.main()
diff --git a/.ci/monolithic-linux.sh b/.ci/monolithic-linux.sh
index f81a14cca6cb3..6461c9d40ad59 100755
--- a/.ci/monolithic-linux.sh
+++ b/.ci/monolithic-linux.sh
@@ -18,6 +18,7 @@ set -o pipefail
 
 MONOREPO_ROOT="${MONOREPO_ROOT:="$(git rev-parse --show-toplevel)"}"
 BUILD_DIR="${BUILD_DIR:=${MONOREPO_ROOT}/build}"
+INSTALL_DIR="${BUILD_DIR}/install"
 rm -rf "${BUILD_DIR}"
 
 ccache --zero-stats
@@ -27,14 +28,10 @@ if [[ -n "${CLEAR_CACHE:-}" ]]; then
   ccache --clear
 fi
 
-mkdir -p artifacts/reproducers
-
-# Make sure any clang reproducers will end up as artifacts.
-export CLANG_CRASH_DIAGNOSTICS_DIR=`realpath artifacts/reproducers`
-
 function at-exit {
   retcode=$?
 
+  mkdir -p artifacts
   ccache --print-stats > artifacts/ccache_stats.txt
   cp "${BUILD_DIR}"/.ninja_log artifacts/.ninja_log
 
@@ -53,28 +50,17 @@ trap at-exit EXIT
 
 projects="${1}"
 targets="${2}"
-runtimes="${3}"
 
 lit_args="-v --xunit-xml-output ${BUILD_DIR}/test-results.xml 
--use-unique-output-file-name --timeout=1200 --time-tests"
 
 echo "--- cmake"
-
 export PIP_BREAK_SYSTEM_PACKAGES=1
 pip install -q -r "${MONOREPO_ROOT}"/mlir/python/requirements.txt
 pip install -q -r "${MONOREPO_ROOT}"/lldb/test/requirements.txt
 pip install -q -r "${MONOREPO_ROOT}"/.ci/requirements.txt
-
-# Set the system llvm-symbolizer as preferred.
-export LLVM_SYMBOLIZER_PATH=`which llvm-symbolizer`
-[[ ! -f "${LLVM_SYMBOLIZER_PATH}" ]] && echo "llvm-symbolizer not found!"
-
-# Set up all runtimes either way. libcxx is a dependency of LLDB.
-# If it ends up being unused, not much harm.
 cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
   -D LLVM_ENABLE_PROJECTS="${projects}" \
-  -D LLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind" \
   -G Ninja \
-  -D CMAKE_PREFIX_PATH="${HOME}/.local" \
   -D CMAKE_BUILD_TYPE=Release \
   -D LLVM_ENABLE_ASSERTIONS=ON \
   -D LLVM_BUILD_EXAMPLES=ON \
@@ -83,47 +69,69 @@ cmake -S "${MONOREPO_ROOT}"/llv