[clang-tools-extra] [clang][dataflow]Use dyn_cast_or_null instead cast to prevent crash (PR #68510)

2023-10-09 Thread Qizhi Hu via cfe-commits
jcsxky wrote: > please update release note also Although `bugprone-unchecked-optional-access` is used to test this issue, root cause is in `FlowSensitiveAnalysis`. So, I am confused about which file should be updated about release not. Look forward to your suggestion! Thank you. https://githu

[clang] [clang][dataflow]Use dyn_cast_or_null instead cast to prevent crash (PR #68510)

2023-10-09 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/68510 >From 3978a4322ed7f82b52a1978debe8108f00f18acc Mon Sep 17 00:00:00 2001 From: huqizhi Date: Sun, 8 Oct 2023 16:00:29 +0800 Subject: [PATCH] [clang][analysis]Use dyn_cast_or_null instead cast to prevent crash ---

[clang] [clang][dataflow]Use cast_or_null instead cast to prevent crash (PR #68510)

2023-10-09 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky edited https://github.com/llvm/llvm-project/pull/68510 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][dataflow]Use cast_or_null instead cast to prevent crash (PR #68510)

2023-10-09 Thread Qizhi Hu via cfe-commits
@@ -599,7 +599,7 @@ void transferAssignment(const CXXOperatorCallExpr *E, BoolValue &HasValueVal, LatticeTransferState &State) { assert(E->getNumArgs() > 0); - if (auto *Loc = cast( + if (auto *Loc = dyn_cast_or_null( jcsxky wrote:

[clang] [clang][dataflow]Use cast_or_null instead cast to prevent crash (PR #68510)

2023-10-09 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/68510 >From 7a8c515c70bb06ae886c8c434d9d3a79a152d115 Mon Sep 17 00:00:00 2001 From: huqizhi Date: Sun, 8 Oct 2023 16:00:29 +0800 Subject: [PATCH] [clang][analysis]Use dyn_cast_or_null instead cast to prevent crash ---

[clang-tools-extra] [clang][dataflow]Use cast_or_null instead cast to prevent crash (PR #68510)

2023-10-09 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/68510 >From 38cf358039d81fb3703885db082b64e11760c5fc Mon Sep 17 00:00:00 2001 From: huqizhi Date: Sun, 8 Oct 2023 16:00:29 +0800 Subject: [PATCH] [clang][analysis]Use dyn_cast_or_null instead cast to prevent crash ---

[clang-tools-extra] [clang][dataflow]Use cast_or_null instead cast to prevent crash (PR #68510)

2023-10-09 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/68510 >From 466b612ff055ff7497c9473b38b90bc849370b21 Mon Sep 17 00:00:00 2001 From: huqizhi Date: Sun, 8 Oct 2023 16:00:29 +0800 Subject: [PATCH] [clang][analysis]Use dyn_cast_or_null instead cast to prevent crash ---

[clang-tools-extra] [clang][dataflow]Use cast_or_null instead cast to prevent crash (PR #68510)

2023-10-09 Thread Qizhi Hu via cfe-commits
jcsxky wrote: > LGTM, When release notes could be nice > (clang-tools-extra/doc/ReleaseNotest.rst) with something like: `Improved > bugprone-unchecked-optional-acces check to not crash during handling of > optional values` or `to not crash i certain situations` it may also not be so > necessa

[clang-tools-extra] [clang][dataflow]Use cast_or_null instead cast to prevent crash (PR #68510)

2023-10-09 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/68510 >From eb9f8342821048edefaefd038bdd989853ac69a3 Mon Sep 17 00:00:00 2001 From: huqizhi Date: Sun, 8 Oct 2023 16:00:29 +0800 Subject: [PATCH] [clang][analysis]Use dyn_cast_or_null instead cast to prevent crash ---

[clang] [clang][dataflow]Use cast_or_null instead cast to prevent crash (PR #68510)

2023-10-10 Thread Qizhi Hu via cfe-commits
@@ -180,3 +180,44 @@ void std_forward_rvalue_ref_safe(absl::optional&& opt) { std::forward>(opt).value(); } + +namespace std { + +template +class optional { +public: + template + optional& operator=(const U &u){ jcsxky wrote: Using `absl::optional`

[clang] [clang][dataflow]Use cast_or_null instead cast to prevent crash (PR #68510)

2023-10-10 Thread Qizhi Hu via cfe-commits
jcsxky wrote: > Thanks for this fix! Unfortunately, I wasn't able to repro the crash in > godbolt: https://godbolt.org/z/s741z5djY. Can you double check that the check > crashes on that example without your fix? The test case is different from that in this patch. Use `float` in `optional`. ht

[clang] [clang][dataflow]Use cast_or_null instead cast to prevent crash (PR #68510)

2023-10-10 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/68510 >From 55ca8fa197e469a7c8f57d7a174c07a063eb022e Mon Sep 17 00:00:00 2001 From: huqizhi Date: Sun, 8 Oct 2023 16:00:29 +0800 Subject: [PATCH] [clang][analysis]Use dyn_cast_or_null instead cast to prevent crash ---

[clang] [clang][dataflow]Use cast_or_null instead cast to prevent crash (PR #68510)

2023-10-10 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky deleted https://github.com/llvm/llvm-project/pull/68510 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][dataflow]Use cast_or_null instead cast to prevent crash (PR #68510)

2023-10-15 Thread Qizhi Hu via cfe-commits
jcsxky wrote: @ymand Could you take a look at this pr? https://github.com/llvm/llvm-project/pull/68510 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][dataflow]Use cast_or_null instead of cast to prevent crash (PR #68510)

2023-10-15 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky edited https://github.com/llvm/llvm-project/pull/68510 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] improve ast comparation (PR #66110)

2023-09-12 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky created https://github.com/llvm/llvm-project/pull/66110: 1.VarDecl should not be ignored. 2.GotoStmt has no children, it should be handle explicitly. >From ab11dd019685d714a4d697cc021cb313a5b30b95 Mon Sep 17 00:00:00 2001 From: huqizhi Date: Wed, 13 Sep 2023 0

[clang] improve ast comparation (PR #66110)

2023-09-12 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky review_requested https://github.com/llvm/llvm-project/pull/66110 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] improve ast comparation (PR #66110)

2023-09-12 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/66110: >From 3194b8958491331918459e6913e5931cc7528115 Mon Sep 17 00:00:00 2001 From: huqizhi Date: Wed, 13 Sep 2023 00:03:27 +0800 Subject: [PATCH] improve ast comparation 1.VarDecl should not be ignored. 2.Got

[clang] [ASTImport]improve ast comparation (PR #66110)

2023-09-12 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky edited https://github.com/llvm/llvm-project/pull/66110 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [ASTImport]improve ast comparation (PR #66110)

2023-09-12 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/66110: >From 98a32795dae4587f64c10f91c6ab47f96881ad4b Mon Sep 17 00:00:00 2001 From: huqizhi Date: Wed, 13 Sep 2023 00:03:27 +0800 Subject: [PATCH] improve ast comparation 1.VarDecl should not be ignored. 2.Got

[clang] [ASTImport]improve ast comparation (PR #66110)

2023-09-12 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/66110: >From 999017a007b77efc6c4b2e643e82379c7c46ca2b Mon Sep 17 00:00:00 2001 From: huqizhi Date: Wed, 13 Sep 2023 00:03:27 +0800 Subject: [PATCH] improve ast comparation 1.VarDecl should not be ignored. 2.Got

[clang] [ASTImport]improve ast comparation (PR #66110)

2023-09-12 Thread Qizhi Hu via cfe-commits
@@ -1295,6 +1306,21 @@ static bool IsStructurallyEquivalent(StructuralEquivalenceContext &Context, return true; } +static bool IsStructurallyEquivalent(StructuralEquivalenceContext &Context, jcsxky wrote: Thanks for your remind. Storage checking is added a

[clang] [ASTImport]improve ast comparation (PR #66110)

2023-09-14 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky closed https://github.com/llvm/llvm-project/pull/66110 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] fix crash in codegen stage when an lambda expression declared in an unevaluated context (PR #80802)

2024-02-16 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/80802 >From c19a66ed4eadd5f16b586b349fd578d873902be2 Mon Sep 17 00:00:00 2001 From: huqizhi Date: Tue, 6 Feb 2024 14:06:40 +0800 Subject: [PATCH 1/2] [Clang][Sema] fix crash in codegen stage when an lambda expression d

[clang] [Clang][Sema] fix crash in codegen stage when an lambda expression declared in an unevaluated context (PR #80802)

2024-02-20 Thread Qizhi Hu via cfe-commits
jcsxky wrote: > @jcsxky Do you have more test cases other than the one from #76674? I wonder > what'll happen if constraint checking is involved. Do you mean `concept`? If yes, I will have a try. https://github.com/llvm/llvm-project/pull/80802 ___ cf

[clang] [Clang][Sema] Fix mismatch of out-of-line definition of template class (PR #102554)

2024-08-08 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky created https://github.com/llvm/llvm-project/pull/102554 Skip adding template instantiation arguments when the declaration is a nested class template when instantiating constraint expression. attempt to fix https://github.com/llvm/llvm-project/issues/102320 >From 0080

[clang] [Clang][Sema] Fix mismatch of out-of-line definition of template class (PR #102554)

2024-08-08 Thread Qizhi Hu via cfe-commits
jcsxky wrote: > I'm sorry but this approach doesn't make sense to me. > > I have to say that I self-assigned the issue hours before this patch (I don't > know when you started working on it because you haven't explained anything > either), and that means I'll look into that recently since I've

[clang] [Clang][Sema] Fix mismatch of out-of-line definition of template class (PR #102554)

2024-08-08 Thread Qizhi Hu via cfe-commits
@@ -951,7 +951,8 @@ static const Expr *SubstituteConstraintExpressionWithoutSatisfaction( DeclInfo.getDecl(), DeclInfo.getLexicalDeclContext(), /*Final=*/false, /*Innermost=*/std::nullopt, /*RelativeToPrimary=*/true, - /*Pattern=*/nullptr, /*ForConstrain

[clang] [Clang][Sema] Fix mismatch of out-of-line definition of template class (PR #102554)

2024-08-08 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky closed https://github.com/llvm/llvm-project/pull/102554 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Concepts] Fix a constraint comparison regression for out-of-line ClassTemplateDecls (PR #102587)

2024-08-09 Thread Qizhi Hu via cfe-commits
jcsxky wrote: > Note that @jcsxky has a similar patch #102554 that fixes the same thing. I > don't intend to contend against him, and admittedly, that patch works. > > But I don't think that approach is so reasonable because it is hacky in that > `ForConstraintInstantiation` is disabled in the

[clang] [Clang][Concepts] Fix a constraint comparison regression for out-of-line ClassTemplateDecls (PR #102587)

2024-08-09 Thread Qizhi Hu via cfe-commits
@@ -599,3 +599,39 @@ template unsigned long DerivedCollection::index() {} } // namespace GH72557 + +namespace GH102320 { + +template +concept Constrained = true; + +template class C { + template > class D; + template +requires Constrained + class E; +}; + +template

[clang] [Clang][Sema] fix noexecpt mismatch of friend declaration (PR #102267)

2024-08-12 Thread Qizhi Hu via cfe-commits
jcsxky wrote: > substitute so all references to template parameters have the correct depth @sdkrystian Agree! The underlying issue is the incorrect depth makes the comparison of the operands of the `noexcept-specifier` failed. because clang can't find instantiated template parameter declaratio

[clang] [Clang][Sema] fix noexecpt mismatch of friend declaration (PR #102267)

2024-08-12 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky edited https://github.com/llvm/llvm-project/pull/102267 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] fix noexecpt mismatch of friend declaration (PR #102267)

2024-08-14 Thread Qizhi Hu via cfe-commits
jcsxky wrote: @sdkrystian Could you please take another look at this patch? The approach does what you said before. When checking exception specific equivalence of the two functions, we do instantiation and substitute all the template parameters with instantiated ones. But we can't find them

[clang] [Clang][Sema] Skip checking anonymous enum in using enum declaration (PR #87144)

2024-04-04 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/87144 >From c4adc0ae83294e4524f2740a40eee483c2cb Mon Sep 17 00:00:00 2001 From: huqizhi Date: Sat, 30 Mar 2024 14:47:00 +0800 Subject: [PATCH] [Clang][Sema] Skip checking anonymous enum in using enum declaration -

[clang] [clang][ASTImporter] fix variable inline of CXX17 (PR #87314)

2024-04-04 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky closed https://github.com/llvm/llvm-project/pull/87314 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] Skip checking anonymous enum in using enum declaration (PR #87144)

2024-04-05 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky closed https://github.com/llvm/llvm-project/pull/87144 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] Skip checking anonymous enum in using enum declaration (PR #87144)

2024-04-06 Thread Qizhi Hu via cfe-commits
@@ -1537,6 +1537,10 @@ void Sema::PushOnScopeChains(NamedDecl *D, Scope *S, bool AddToContext) { cast(D)->isFunctionTemplateSpecialization()) return; + if (isa(D) && D->getDeclName().isEmpty()) { jcsxky wrote: `Sema::ActOnUsingEnumDeclaration` inv

[clang] [Clang][Sema] Skip checking anonymous enum in using enum declaration (PR #87144)

2024-04-07 Thread Qizhi Hu via cfe-commits
@@ -1537,6 +1537,10 @@ void Sema::PushOnScopeChains(NamedDecl *D, Scope *S, bool AddToContext) { cast(D)->isFunctionTemplateSpecialization()) return; + if (isa(D) && D->getDeclName().isEmpty()) { jcsxky wrote: These checks include name conflict an

[clang] [Clang][Sema] Skip checking anonymous enum in using enum declaration (PR #87144)

2024-04-07 Thread Qizhi Hu via cfe-commits
@@ -1537,6 +1537,10 @@ void Sema::PushOnScopeChains(NamedDecl *D, Scope *S, bool AddToContext) { cast(D)->isFunctionTemplateSpecialization()) return; + if (isa(D) && D->getDeclName().isEmpty()) { jcsxky wrote: Ah, I see. I skip those checking when

[clang] [Clang][Sema] set declaration invalid earlier to prevent crash in calculating record layout (PR #87173)

2024-04-08 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/87173 >From 51f3dc24417eb0b74f029b85b47519b6d152 Mon Sep 17 00:00:00 2001 From: huqizhi Date: Sun, 31 Mar 2024 09:38:05 +0800 Subject: [PATCH] [Clang][Sema] set declaration invalid earlier to prevent crash in calcu

[clang] [Clang][Sema] set declaration invalid earlier to prevent crash in calculating record layout (PR #87173)

2024-04-08 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky edited https://github.com/llvm/llvm-project/pull/87173 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] Fix the lambda call expression inside of a type alias declaration (PR #82310)

2024-04-08 Thread Qizhi Hu via cfe-commits
jcsxky wrote: Still crash on ```cpp template constexpr auto x = F(); template constexpr int a() { return 1; } template struct A { using Func = decltype( [](T) { return x<[] constexpr { return a(); }>; // return x<[] constexpr { return b(); }>; }.template operator()('

[clang] [Clang][Sema] Fix the lambda call expression inside of a type alias declaration (PR #82310)

2024-04-08 Thread Qizhi Hu via cfe-commits
jcsxky wrote: > > Still crash on > > ```c++ > > template constexpr auto x = F(); > > template constexpr int a() { return 1; } > > > > template > > struct A { > > using Func = decltype( > > [](T) { > > return x<[] constexpr { return a(); }>; > > // return x<[] constexpr {

[clang] [Clang][Sema] set declaration invalid earlier to prevent crash in calculating record layout (PR #87173)

2024-04-09 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/87173 >From 26da477eb3633880734c096b13f89cc0d557745b Mon Sep 17 00:00:00 2001 From: huqizhi Date: Sun, 31 Mar 2024 09:38:05 +0800 Subject: [PATCH] [Clang][Sema] set declaration invalid earlier to prevent crash in calcu

[clang] [Clang][Sema] set declaration invalid earlier to prevent crash in calculating record layout (PR #87173)

2024-04-09 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/87173 >From a0c0feae5bee318bcc253e5497994bfe78f308ee Mon Sep 17 00:00:00 2001 From: huqizhi Date: Sun, 31 Mar 2024 09:38:05 +0800 Subject: [PATCH] [Clang][Sema] set declaration invalid earlier to prevent crash in calcu

[clang] [Clang][Sema] Fix issue on requires expression with templated base class member function (PR #85198)

2024-04-11 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky edited https://github.com/llvm/llvm-project/pull/85198 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] Fix issue on requires expression with templated base class member function (PR #85198)

2024-04-11 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/85198 >From a7bc05667f7280958e68fd82e01b620e18e4203c Mon Sep 17 00:00:00 2001 From: huqizhi Date: Thu, 14 Mar 2024 16:32:36 +0800 Subject: [PATCH] [Clang][Sema] Fix issue on requires expression with templated base clas

[clang] [Clang][Sema] Fix issue on requires expression with templated base class member function (PR #85198)

2024-04-11 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky ready_for_review https://github.com/llvm/llvm-project/pull/85198 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] Fix issue on requires expression with templated base class member function (PR #85198)

2024-04-11 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky edited https://github.com/llvm/llvm-project/pull/85198 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] Fix issue on requires expression with templated base class member function (PR #85198)

2024-04-11 Thread Qizhi Hu via cfe-commits
@@ -7735,7 +7735,8 @@ ExprResult Sema::BuildResolvedCallExpr(Expr *Fn, NamedDecl *NDecl, } if (CXXMethodDecl *Method = dyn_cast_or_null(FDecl)) -if (Method->isImplicitObjectMemberFunction()) +if (!isa(CurContext) && jcsxky wrote: In require body,

[clang] [Clang][Sema] Fix issue on requires expression with templated base class member function (PR #85198)

2024-04-11 Thread Qizhi Hu via cfe-commits
@@ -7735,7 +7735,8 @@ ExprResult Sema::BuildResolvedCallExpr(Expr *Fn, NamedDecl *NDecl, } if (CXXMethodDecl *Method = dyn_cast_or_null(FDecl)) -if (Method->isImplicitObjectMemberFunction()) +if (!isa(CurContext) && jcsxky wrote: Yeah, I think it

[clang] [Clang][Sema] Fix issue on requires expression with templated base class member function (PR #85198)

2024-04-11 Thread Qizhi Hu via cfe-commits
@@ -7735,7 +7735,8 @@ ExprResult Sema::BuildResolvedCallExpr(Expr *Fn, NamedDecl *NDecl, } if (CXXMethodDecl *Method = dyn_cast_or_null(FDecl)) -if (Method->isImplicitObjectMemberFunction()) +if (!isa(CurContext) && jcsxky wrote: @erichkeane I am

[clang] [Clang][Sema] Fix issue on requires expression with templated base class member function (PR #85198)

2024-04-13 Thread Qizhi Hu via cfe-commits
@@ -7735,7 +7735,8 @@ ExprResult Sema::BuildResolvedCallExpr(Expr *Fn, NamedDecl *NDecl, } if (CXXMethodDecl *Method = dyn_cast_or_null(FDecl)) -if (Method->isImplicitObjectMemberFunction()) +if (!isa(CurContext) && jcsxky wrote: Do you mean that

[clang] [Clang][Sema] Fix issue on requires expression with templated base class member function (PR #85198)

2024-04-13 Thread Qizhi Hu via cfe-commits
@@ -7735,7 +7735,8 @@ ExprResult Sema::BuildResolvedCallExpr(Expr *Fn, NamedDecl *NDecl, } if (CXXMethodDecl *Method = dyn_cast_or_null(FDecl)) -if (Method->isImplicitObjectMemberFunction()) +if (!isa(CurContext) && jcsxky wrote: And if only chec

[clang] [Clang][Sema] Fix issue on requires expression with templated base class member function (PR #85198)

2024-04-14 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky edited https://github.com/llvm/llvm-project/pull/85198 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] Fix issue on requires expression with templated base class member function (PR #85198)

2024-04-14 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky edited https://github.com/llvm/llvm-project/pull/85198 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] Fix issue on requires expression with templated base class member function (PR #85198)

2024-04-14 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky edited https://github.com/llvm/llvm-project/pull/85198 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] qualifier should be transformed (PR #94725)

2024-06-06 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky created https://github.com/llvm/llvm-project/pull/94725 None >From 9fc6172cb3ef627eb7d4e939dff6f4504c06150a Mon Sep 17 00:00:00 2001 From: huqizhi Date: Fri, 7 Jun 2024 14:04:52 +0800 Subject: [PATCH] [Clang][Sema] qualifier should be transformed --- clang/lib/Sema/

[clang] [Clang][Sema] qualifier should be transformed (PR #94725)

2024-06-06 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky converted_to_draft https://github.com/llvm/llvm-project/pull/94725 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] qualifier should be transformed (PR #94725)

2024-06-06 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/94725 >From 917cd980ed6a130b9f175492638afa22a1246c5c Mon Sep 17 00:00:00 2001 From: huqizhi Date: Fri, 7 Jun 2024 14:04:52 +0800 Subject: [PATCH] [Clang][Sema] qualifier should be transformed --- clang/lib/Sema/SemaTe

[clang] [Clang][Sema] qualifier should be transformed (PR #94725)

2024-06-07 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/94725 >From 6a90ef0b3947a0de2d6453856c80d8f0fd393548 Mon Sep 17 00:00:00 2001 From: huqizhi Date: Fri, 7 Jun 2024 14:04:52 +0800 Subject: [PATCH] [Clang][Sema] qualifier should be transformed --- clang/lib/Sema/TreeTr

[clang] [Clang][Sema] qualifier should be transformed (PR #94725)

2024-06-07 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/94725 >From 57576620fc412015bd19a34e12be61f4b81eb655 Mon Sep 17 00:00:00 2001 From: huqizhi Date: Fri, 7 Jun 2024 14:04:52 +0800 Subject: [PATCH] [Clang][Sema] qualifier should be transformed --- clang/lib/Sema/TreeTr

[clang] [Clang][Sema] qualifier should be transformed (PR #94725)

2024-06-07 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/94725 >From 2977f65d503c2a96247705ce50157870aaefa003 Mon Sep 17 00:00:00 2001 From: huqizhi Date: Fri, 7 Jun 2024 14:04:52 +0800 Subject: [PATCH] [Clang][Sema] qualifier should be transformed --- clang/docs/ReleaseNot

[clang] [Clang][Sema] qualifier should be transformed (PR #94725)

2024-06-07 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/94725 >From a1754c56a3293cd6529244f9a0f7486f4912e18d Mon Sep 17 00:00:00 2001 From: huqizhi Date: Fri, 7 Jun 2024 14:04:52 +0800 Subject: [PATCH] [Clang][Sema] qualifier should be transformed --- clang/docs/ReleaseNot

[clang] [Clang][Sema] qualifier should be transformed (PR #94725)

2024-06-07 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky edited https://github.com/llvm/llvm-project/pull/94725 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] qualifier should be transformed (PR #94725)

2024-06-07 Thread Qizhi Hu via cfe-commits
jcsxky wrote: crash on trunk assertion. https://github.com/llvm/llvm-project/pull/94725 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] qualifier should be transformed (PR #94725)

2024-06-07 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky ready_for_review https://github.com/llvm/llvm-project/pull/94725 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] SourceLocIdentKind::Function should not be dependent (PR #94942)

2024-06-10 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky created https://github.com/llvm/llvm-project/pull/94942 Consider the testcase, return type of `construct_at` is ```cpp DecltypeType 0x5570d8c0 'decltype(new struct BasicPersistent(declval()))' sugar dependent |-CXXNewExpr 0x5570d880 'struct BasicPersistent *' Fu

[clang] [clang] SourceLocIdentKind::Function should not be dependent (PR #94942)

2024-06-10 Thread Qizhi Hu via cfe-commits
jcsxky wrote: > because we want to make the name of the function and any template parameter refers to the instantiated function rather than that of the function template. Does that mean we should transform the `SourceLocExpr` into a certain function name when instantiating if it is `__builtin_

[clang] [StructuralEquivalence] improve NTTP and CXXDependentScopeMemberExpr comparison (PR #95190)

2024-06-11 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky created https://github.com/llvm/llvm-project/pull/95190 improve `ASTStructuralEquivalenceTest`: 1. compare the depth and index of NTTP 2. provide comparison of `CXXDependentScopeMemberExpr` to `StmtCompare`. >From 644c6e8499285e5b3ab17193ec63eed051dae583 Mon Sep 17 00

[clang] [StructuralEquivalence] improve NTTP and CXXDependentScopeMemberExpr comparison (PR #95190)

2024-06-11 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/95190 >From 157f664408062da41f4d82d20ddc06e0e563fe31 Mon Sep 17 00:00:00 2001 From: huqizhi Date: Wed, 12 Jun 2024 09:47:16 +0800 Subject: [PATCH] [StructuralEquivalence] improve NTTP and CXXDependentScopeMemberExpr co

[clang] [StructuralEquivalence] improve NTTP and CXXDependentScopeMemberExpr comparison (PR #95190)

2024-06-11 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/95190 >From ba081d51a0cc803188760eec2847bfc73d2192b8 Mon Sep 17 00:00:00 2001 From: huqizhi Date: Wed, 12 Jun 2024 09:47:16 +0800 Subject: [PATCH] [StructuralEquivalence] improve NTTP and CXXDependentScopeMemberExpr co

[clang] [StructuralEquivalence] improve NTTP and CXXDependentScopeMemberExpr comparison (PR #95190)

2024-06-12 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky closed https://github.com/llvm/llvm-project/pull/95190 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] SourceLocIdentKind::Function should not be dependent (PR #94942)

2024-06-12 Thread Qizhi Hu via cfe-commits
jcsxky wrote: > SourceLocation needs to be dependent because we want to make the name of the > function and any template parameter refers to the instantiated function > rather than that of the function template. This was changed in #78436 > > The issue is that SourceLocation then is a dependen

[clang] [Clang][Sema] qualifier should be transformed (PR #94725)

2024-06-13 Thread Qizhi Hu via cfe-commits
jcsxky wrote: > Needs changes as discussed. > Needs changes as discussed. I am really appreciate for your guidance and I will check in the weekend. https://github.com/llvm/llvm-project/pull/94725 ___ cfe-commits mailing list cfe-commits@lists.llvm.

[clang] [clang] SourceLocIdentKind::Function should not be dependent (PR #94942)

2024-06-13 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/94942 >From 96f4e2a5c82296b61e53189135d88a2d2b0da9f4 Mon Sep 17 00:00:00 2001 From: Qizhi Hu <836744...@qq.com> Date: Mon, 10 Jun 2024 16:53:54 +0800 Subject: [PATCH] [clang] SourceLocIdentKind::Function should not be de

[clang] [clang] SourceLocIdentKind::Function should not be dependent (PR #94942)

2024-06-13 Thread Qizhi Hu via cfe-commits
jcsxky wrote: ```cpp struct BasicPersistent; struct SourceLocation { static constexpr const char* Current(const char * func = __builtin_FUNCTION()) { return func; } }; template BasicPersistent &&__declval(int); template auto declval() -> decltype(__declval<_Tp>(0));

[clang] [clang] SourceLocIdentKind::Function should not be dependent (PR #94942)

2024-06-16 Thread Qizhi Hu via cfe-commits
jcsxky wrote: > So, looked into this more. You are correct that `Function` needs not be > dependent because we only ever show the name of the function unqualified. > However, `FunctionSig` does. Here is an example of what we are trying to > preserve https://godbolt.org/z/M3eTa8nn5 (the clang 1

[clang] [clang] SourceLocIdentKind::Function should not be dependent (PR #94942)

2024-06-16 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky closed https://github.com/llvm/llvm-project/pull/94942 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] Skip checking anonymous enum in using enum declaration (PR #87144)

2024-06-16 Thread Qizhi Hu via cfe-commits
jcsxky wrote: > This change has caused a regression in one of our systems integration tests > that test static analysis for the bstring lib project > (https://github.com/websnarf/bstrlib) with cross translation unit analysis > enabled. Unfortunately I do not have a simple reproducer that stand

[clang] [Clang][Sema] Skip checking anonymous enum in using enum declaration (PR #87144)

2024-06-16 Thread Qizhi Hu via cfe-commits
jcsxky wrote: ```cpp ls bstrwrap.cpp bstrwrap.h ctudir test.cpp test.plist test.sh cat bstrwrap.cpp #include "bstrwrap.h" #include Bstrlib::CBString::CBString () { } cat bstrwrap.h #include namespace Bstrlib { struct CBString { CBString (); }; extern std::istream& getline (void); } cat

[clang] [Clang][Sema] Skip checking anonymous enum in using enum declaration (PR #87144)

2024-06-16 Thread Qizhi Hu via cfe-commits
jcsxky wrote: > Hi @jcsxky , I fetched and rebased to origin/main just now (6/16/2024 at > 4:30pm Central US time), and rebuilt - and I see the crash. Did you try > rebasing to latest source and rebuilding? > > `$ clang --analyze -Xclang -analyzer-config -Xclang > experimental-enable-naive-ct

[clang] [Clang][Sema] Use correct TemplateName when transforming TemplateSpecializationType (PR #93411)

2024-05-28 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky closed https://github.com/llvm/llvm-project/pull/93411 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [libcxx] [clang] Preserve Qualifiers and type sugar in TemplateNames (PR #93433)

2024-05-30 Thread Qizhi Hu via cfe-commits
jcsxky wrote: @mizvekov After I apply you changes in this patch, https://github.com/llvm/llvm-project/issues/91677 is still crash(although it makes sense with `-ast-dump` option). I put it below for explanation clearly: ```cpp template struct t1 { template struct t2 {}; }; template t1::

[clang] [Clang][Sema] Use correct TemplateName when transforming TemplateSpecializationType (PR #93411)

2024-05-30 Thread Qizhi Hu via cfe-commits
jcsxky wrote: > So After we have formed a TemplateSpecializationType, we are done with the > NNS. We keep it around in an ElaboratedType for type sugar only, it should > not be needed to compile the program correctly anymore. > > So I think this solution violates one important aspect of our AS

[clang] [clang][ASTImport] fix issue on anonymous enum import (PR #93923)

2024-05-30 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky created https://github.com/llvm/llvm-project/pull/93923 Don't skip searching in `ToContext` during importing `EnumDecl`. And `IsStructuralMatch` in `StructralEquivalence` can make sure to determine whether the found result is match or not. >From 7e602ae8d3c7ca0c3218d

[clang] [clang][ASTImport] fix issue on anonymous enum import (PR #93923)

2024-05-31 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/93923 >From 7e602ae8d3c7ca0c3218d8ce9106510c43b6295b Mon Sep 17 00:00:00 2001 From: huqizhi Date: Fri, 31 May 2024 13:12:41 +0800 Subject: [PATCH 1/2] [clang][ASTImport] fix issue on anonymous enum import --- clang/li

[clang] [clang][ASTImport] fix issue on anonymous enum import (PR #93923)

2024-05-31 Thread Qizhi Hu via cfe-commits
jcsxky wrote: > Does this work on the following code? > > ``` > struct A { > enum { E1,E2 } x; > enum { E3,E4 } y; > }; > ``` I have updated testcase according to your suggestion to demonstrate this solution works correctly on the testcase above. https://github.com/

[clang] [clang][ASTImport] fix issue on anonymous enum import (PR #93923)

2024-05-31 Thread Qizhi Hu via cfe-commits
@@ -9674,6 +9674,27 @@ TEST_P(ASTImporterOptionSpecificTestBase, ImportInstantiatedFromMember) { EXPECT_TRUE(ImportedPartialSpecialization->getInstantiatedFromMember()); } +TEST_P(ASTImporterOptionSpecificTestBase, ImportAnonymousEnum) { + const char *ToCode = + R"( +

[clang] [clang][ASTImport] fix issue on anonymous enum import (PR #93923)

2024-06-03 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/93923 >From 7e602ae8d3c7ca0c3218d8ce9106510c43b6295b Mon Sep 17 00:00:00 2001 From: huqizhi Date: Fri, 31 May 2024 13:12:41 +0800 Subject: [PATCH 1/2] [clang][ASTImport] fix issue on anonymous enum import --- clang/li

[clang] [clang][ASTImport] fix issue on anonymous enum import (PR #93923)

2024-06-03 Thread Qizhi Hu via cfe-commits
@@ -9674,6 +9674,40 @@ TEST_P(ASTImporterOptionSpecificTestBase, ImportInstantiatedFromMember) { EXPECT_TRUE(ImportedPartialSpecialization->getInstantiatedFromMember()); } +AST_MATCHER_P(EnumDecl, hasEnumConstName, StringRef, ConstName) { + for (EnumConstantDecl *D : Node.

[clang] [clang][ASTImport] fix issue on anonymous enum import (PR #93923)

2024-06-03 Thread Qizhi Hu via cfe-commits
@@ -9674,6 +9674,40 @@ TEST_P(ASTImporterOptionSpecificTestBase, ImportInstantiatedFromMember) { EXPECT_TRUE(ImportedPartialSpecialization->getInstantiatedFromMember()); } +AST_MATCHER_P(EnumDecl, hasEnumConstName, StringRef, ConstName) { + for (EnumConstantDecl *D : Node.

[clang] [libcxx] [Clang] Implement resolution for CWG1835 (PR #92957)

2024-06-04 Thread Qizhi Hu via cfe-commits
@@ -1442,19 +1442,27 @@ SourceLocation CXXUnresolvedConstructExpr::getBeginLoc() const { CXXDependentScopeMemberExpr::CXXDependentScopeMemberExpr( const ASTContext &Ctx, Expr *Base, QualType BaseType, bool IsArrow, SourceLocation OperatorLoc, NestedNameSpecifierLoc Qua

[clang] [clang][ASTImport] fix issue on anonymous enum import (PR #93923)

2024-06-04 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky closed https://github.com/llvm/llvm-project/pull/93923 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] Fix issue on requires expression with templated base class member function (PR #85198)

2024-04-15 Thread Qizhi Hu via cfe-commits
jcsxky wrote: > Ah, I had missed (thanks github review tool!) that the 'ImplicitObjectMember' > part already existed. Sorry for that. Never mind! Partly because I didn't make it more clear due to my poor expression . https://github.com/llvm/llvm-project/pull/85198

[clang] [Clang][Sema] Fix issue on requires expression with templated base class member function (PR #85198)

2024-04-15 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/85198 >From 0076d87897371f3467c49818a7789cedda27e485 Mon Sep 17 00:00:00 2001 From: huqizhi Date: Thu, 14 Mar 2024 16:32:36 +0800 Subject: [PATCH] [Clang][Sema] Fix issue on requires expression with templated base clas

[clang] [Clang][Sema] Fix issue on requires expression with templated base class member function (PR #85198)

2024-04-15 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky closed https://github.com/llvm/llvm-project/pull/85198 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] set declaration invalid earlier to prevent crash in calculating record layout (PR #87173)

2024-04-17 Thread Qizhi Hu via cfe-commits
jcsxky wrote: gently ping. @erichkeane @shafik Any opinions on this pr? https://github.com/llvm/llvm-project/pull/87173 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] set declaration invalid earlier to prevent crash in calculating record layout (PR #87173)

2024-04-17 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/87173 >From 19b2cab0c84a934910f65536a0627045d30b9729 Mon Sep 17 00:00:00 2001 From: huqizhi Date: Sun, 31 Mar 2024 09:38:05 +0800 Subject: [PATCH] [Clang][Sema] set declaration invalid earlier to prevent crash in calcu

<    1   2   3   4   5   >