[clang] [Clang] Optimize some `getBeginLoc` implementations (PR #141058)

2025-05-23 Thread Haojian Wu via cfe-commits
@@ -2901,34 +2907,44 @@ class CallExpr : public Expr { // // * An optional of type FPOptionsOverride. // - // Note that we store the offset in bytes from the this pointer to the start - // of the trailing objects. It would be perfectly possible to compute it - // based

[clang-tools-extra] [clang-tidy] Don't run use-nullptr check on objective-c code. (PR #141229)

2025-05-23 Thread Haojian Wu via cfe-commits
https://github.com/hokein created https://github.com/llvm/llvm-project/pull/141229 `nullptr` doesn't exist in objective-c. Right now, if an objective-c file compiled with `-std=c23` flag, it will trigger this check. This patch suppresses the check warning. >From 07e1b67719f10d3fb31e2cdbe944

[clang-tools-extra] [clang-tidy] Don't run use-nullptr check on objective-c code. (PR #141229)

2025-05-23 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/141229 >From 7d6ba7c08e260d75ad33c06f069898a528fe6159 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Fri, 23 May 2025 14:16:52 +0200 Subject: [PATCH] [clang-tidy] Don't run use-nullptr check on objective-c code. If we

[clang] [clang] Fixed an assertion failure triggered when instantiating a template with an expr that references an invalid decl (PR #140905)

2025-05-21 Thread Haojian Wu via cfe-commits
https://github.com/hokein created https://github.com/llvm/llvm-project/pull/140905 Fixes #140898 >From d8a728d1e32c2bd317d11a0d8f46e6d66c0bb125 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Wed, 21 May 2025 16:07:54 +0200 Subject: [PATCH] [clang] Fixed an assertion failure triggered when i

[clang] WIP [clang] Recursively instantiate constexpr template functions. (PR #140865)

2025-05-21 Thread Haojian Wu via cfe-commits
https://github.com/hokein created https://github.com/llvm/llvm-project/pull/140865 See https://github.com/llvm/llvm-project/issues/120108 TODO: test the patch >From 31b94099a420dc9606c84771e9ba6365fadafe20 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Wed, 21 May 2025 10:14:28 +0200 Subject

[clang] [clang] Fix assertion failure in constexpr union deserialization (PR #140179)

2025-05-16 Thread Haojian Wu via cfe-commits
@@ -414,7 +414,7 @@ let Class = PropertyTypeCase in { let Read = [{ node.getUnionValue() }]; } def : Creator<[{ -return APValue(cast(fieldDecl), std::move(value)); +return APValue(cast_if_present(fieldDecl), std::move(value)); hokein wrote: Ad

[clang] [clang] Fix assertion failure in constexpr union deserialization (PR #140179)

2025-05-16 Thread Haojian Wu via cfe-commits
https://github.com/hokein edited https://github.com/llvm/llvm-project/pull/140179 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Fix assertion failure in constexpr union deserialization (PR #140179)

2025-05-16 Thread Haojian Wu via cfe-commits
https://github.com/hokein approved this pull request. Thanks for the fix. I think we need a release note in clang/docs/ReleaseNotes.rst https://github.com/llvm/llvm-project/pull/140179 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://li

[clang] Reland "Reland [Modules] Remove unnecessary check when generating name lookup table in ASTWriter" (PR #139253)

2025-05-12 Thread Haojian Wu via cfe-commits
https://github.com/hokein closed https://github.com/llvm/llvm-project/pull/139253 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Reland "Reland [Modules] Remove unnecessary check when generating name lookup table in ASTWriter" (PR #139253)

2025-05-12 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/139253 Rate limit · GitHub body { background-color: #f6f8fa; color: #24292e; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-se

[clang] Reland "Reland [Modules] Remove unnecessary check when generating name lookup table in ASTWriter" (PR #139253)

2025-05-12 Thread Haojian Wu via cfe-commits
https://github.com/hokein edited https://github.com/llvm/llvm-project/pull/139253 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Reland "Reland [Modules] Remove unnecessary check when generating name lookup table in ASTWriter" (PR #139253)

2025-05-12 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/139253 >From b8ba1ae30227fd7c946c5f5e57fb83e47f3bbe69 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Fri, 9 May 2025 10:24:01 +0200 Subject: [PATCH 1/6] Reland "Reland [Modules] Remove unnecessary check when generatin

[clang] Reland "Reland [Modules] Remove unnecessary check when generating name lookup table in ASTWriter" (PR #139253)

2025-05-09 Thread Haojian Wu via cfe-commits
https://github.com/hokein edited https://github.com/llvm/llvm-project/pull/139253 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Reland "Reland [Modules] Remove unnecessary check when generating name lookup table in ASTWriter" (PR #139253)

2025-05-09 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/139253 >From b8ba1ae30227fd7c946c5f5e57fb83e47f3bbe69 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Fri, 9 May 2025 10:24:01 +0200 Subject: [PATCH] Reland "Reland [Modules] Remove unnecessary check when generating na

[clang] Reland "Reland [Modules] Remove unnecessary check when generating name lookup table in ASTWriter" (PR #139253)

2025-05-09 Thread Haojian Wu via cfe-commits
https://github.com/hokein edited https://github.com/llvm/llvm-project/pull/139253 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Reland "Reland [Modules] Remove unnecessary check when generating name lookup table in ASTWriter" (PR #139253)

2025-05-09 Thread Haojian Wu via cfe-commits
https://github.com/hokein created https://github.com/llvm/llvm-project/pull/139253 This relands the patch https://github.com/llvm/llvm-project/commit/67b298f6d82e0b4bb648ac0dabe895e816a77ef1 >From 47211ed01154f9b53395b1c4c33014c7d3bf3c25 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Fri, 9

[clang] [clang] Implement some missing interfaces for DelegatingDeserializationListener (PR #133424)

2025-03-28 Thread Haojian Wu via cfe-commits
https://github.com/hokein closed https://github.com/llvm/llvm-project/pull/133424 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Implement some missing interfaces for DelegatingDeserializationListener (PR #133424)

2025-03-28 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/133424 >From 8eda8337877f85a2e59cb71faeb0da3ed6bff9ee Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Fri, 28 Mar 2025 12:05:41 +0100 Subject: [PATCH] [clang] Implement some missing interfaces for DelegatingDeserializa

[clang] [clang] Implement some missing interfaces for DelegatingDeserializationListener (PR #133424)

2025-03-28 Thread Haojian Wu via cfe-commits
https://github.com/hokein created https://github.com/llvm/llvm-project/pull/133424 Split from the https://github.com/llvm/llvm-project/pull/133395 per the review comment. This patch also moves the `DelegatingDeserializationListener` close to `ASTDeserializationListener`. >From b081c35a3a6b70

[clang] [clang] Fix the crash when dumping deserialized decls (PR #133395)

2025-03-28 Thread Haojian Wu via cfe-commits
@@ -57,6 +59,8 @@ class ASTDeserializationListener { /// A module import was read from the AST file. virtual void ModuleImportRead(serialization::SubmoduleID ID, SourceLocation ImportLoc) {} + /// The deserialization of the AST file was fini

[clang] [clang] Fix the crash when dumping deserialized decls (PR #133395)

2025-03-28 Thread Haojian Wu via cfe-commits
@@ -103,15 +120,30 @@ class DeserializedDeclsDumper : public DelegatingDeserializationListener { : DelegatingDeserializationListener(Previous, DeletePrevious) {} void DeclRead(GlobalDeclID ID, const Decl *D) override { -llvm::outs() << "PCH DECL: " << D->getDeclKi

[clang] [clang] Fix the crash when dumping deserialized decls (PR #133395)

2025-03-28 Thread Haojian Wu via cfe-commits
hokein wrote: > There are two parts to this patch: > > 1. forwarding more methods properly > 2. updating the interface, adding new callbacks and changing the behavior of > `-dump-deserialized-decls`` > > I think (1) is a no-brainer. I would be very eager to LGTM it right away, but > could you

[clang] [clang] Fix the crash when dumping deserialized decls (PR #133395)

2025-03-28 Thread Haojian Wu via cfe-commits
https://github.com/hokein ready_for_review https://github.com/llvm/llvm-project/pull/133395 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Fix the crash when dumping deserialized decls (PR #133395)

2025-03-28 Thread Haojian Wu via cfe-commits
https://github.com/hokein edited https://github.com/llvm/llvm-project/pull/133395 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Fix the crash when dumping deserialized decls (PR #133395)

2025-03-28 Thread Haojian Wu via cfe-commits
https://github.com/hokein edited https://github.com/llvm/llvm-project/pull/133395 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [WIP] Fix the crash when dump the deserialized decl (PR #133395)

2025-03-28 Thread Haojian Wu via cfe-commits
https://github.com/hokein edited https://github.com/llvm/llvm-project/pull/133395 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [WIP] Fix the crash when dump the deserialized decl (PR #133395)

2025-03-28 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/133395 >From 517f66dd11729a833ea64350622d2a10d83c2c3b Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Fri, 28 Mar 2025 09:32:50 +0100 Subject: [PATCH] Fix the crash when dumping the deserialized decls --- clang/docs/R

[clang] [WIP] Fix the crash when dump the deserialized decl (PR #133395)

2025-03-28 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/133395 >From 228f45851d9c0c6b5b08aa725b6c53704d71630a Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Fri, 28 Mar 2025 09:32:50 +0100 Subject: [PATCH] Fix the crash when dumping the deserialized decls --- clang/docs/R

[clang] [WIP] Fix the crash when dump the deserialized decl (PR #133395)

2025-03-28 Thread Haojian Wu via cfe-commits
https://github.com/hokein created https://github.com/llvm/llvm-project/pull/133395 None >From 4095be6747a5d6f3cd619c644490c4170ab44d89 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Fri, 28 Mar 2025 09:32:50 +0100 Subject: [PATCH] [WIP] Fix the crash when dump the deserialized decl --- .../

[clang] [clang] Add a missing space to the -Weager-load-cxx-named-modules diagnostic message. (PR #131987)

2025-03-19 Thread Haojian Wu via cfe-commits
https://github.com/hokein closed https://github.com/llvm/llvm-project/pull/131987 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Do not infer lifetimebound for functions with void return type (PR #131997)

2025-03-19 Thread Haojian Wu via cfe-commits
https://github.com/hokein approved this pull request. It would be nice to have have a test for it. I think it should not be too hard to add one. https://github.com/llvm/llvm-project/pull/131997 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] Improve the -Wundefined-func-template diagnostic note for invisible template functions (PR #129031)

2025-03-19 Thread Haojian Wu via cfe-commits
https://github.com/hokein closed https://github.com/llvm/llvm-project/pull/129031 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Add a missing space to the -Weager-load-cxx-named-modules diagnostic message. (PR #131987)

2025-03-19 Thread Haojian Wu via cfe-commits
https://github.com/hokein created https://github.com/llvm/llvm-project/pull/131987 None >From f15c7880c04597b2227e5189b8c3af2078338cf8 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Wed, 19 Mar 2025 10:26:51 +0100 Subject: [PATCH] [clang] Add a missing space to the -Weager-load-cxx-named-mod

[clang] Improve the -Wundefined-func-template diagnostic note for invisible template functions (PR #129031)

2025-03-17 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/129031 >From 184a449456f82d26ca8ea253b7c3913df512c1a3 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Thu, 27 Feb 2025 11:15:09 +0100 Subject: [PATCH 1/5] Improve the -Wundefined-func-template diagnostic note for invis

[clang] Improve the -Wundefined-func-template diagnostic note for invisible template functions (PR #129031)

2025-03-17 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/129031 >From 184a449456f82d26ca8ea253b7c3913df512c1a3 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Thu, 27 Feb 2025 11:15:09 +0100 Subject: [PATCH 1/4] Improve the -Wundefined-func-template diagnostic note for invis

[clang] Improve the -Wundefined-func-template diagnostic note for invisible template functions (PR #129031)

2025-03-17 Thread Haojian Wu via cfe-commits
@@ -5654,6 +5654,8 @@ def warn_func_template_missing : Warning<"instantiation of function %q0 " InGroup, DefaultIgnore; def note_forward_template_decl : Note< "forward declaration of template entity is here">; +def note_unreachable_template_decl +: Note<"unreachable de

[clang] Improve the -Wundefined-func-template diagnostic note for invisible template functions (PR #129031)

2025-03-17 Thread Haojian Wu via cfe-commits
hokein wrote: > Should this come with a release note as well? Yeah, I think so. Done. https://github.com/llvm/llvm-project/pull/129031 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Improve the -Wundefined-func-template diagnostic note for invisible template functions (PR #129031)

2025-03-17 Thread Haojian Wu via cfe-commits
@@ -5082,11 +5085,18 @@ void Sema::InstantiateFunctionDefinition(SourceLocation PointOfInstantiation, if (AtEndOfTU && !getDiagnostics().hasErrorOccurred() && !getSourceManager().isInSystemHeader(PatternDecl->getBeginLoc())) { Diag(PointOfInstantiation,

[clang] Improve the -Wundefined-func-template diagnostic note for invisible template functions (PR #129031)

2025-03-17 Thread Haojian Wu via cfe-commits
@@ -0,0 +1,10 @@ +// RUN: rm -rf %t hokein wrote: Done. https://github.com/llvm/llvm-project/pull/129031 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commi

[clang] Improve the -Wundefined-func-template diagnostic note for invisible template functions (PR #129031)

2025-03-17 Thread Haojian Wu via cfe-commits
@@ -0,0 +1,10 @@ +// RUN: rm -rf %t +// RUN: %clang_cc1 -std=c++20 -fmodules -fmodules-cache-path=%t -I%S/Inputs/undefined-template \ +// RUN: -Wundefined-func-template \ +// RUN: -fimplicit-module-maps %s 2>&1 | grep "unreachable declaration of template entity is her"

[clang] Improve the -Wundefined-func-template diagnostic note for invisible template functions (PR #129031)

2025-03-17 Thread Haojian Wu via cfe-commits
@@ -759,13 +759,11 @@ Sema::BuildDependentDeclRefExpr(const CXXScopeSpec &SS, TemplateArgs); } -bool Sema::DiagnoseUninstantiableTemplate(SourceLocation PointOfInstantiation, - NamedDecl *Instantiation, -

[clang] Improve the -Wundefined-func-template diagnostic note for invisible template functions (PR #129031)

2025-03-17 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/129031 >From 5bf873e8ab3b97956ca03ef6337baa0f52320003 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Thu, 27 Feb 2025 11:15:09 +0100 Subject: [PATCH 1/4] Improve the -Wundefined-func-template diagnostic note for invis

[clang] Improve the -Wundefined-func-template diagnostic note for invisible template functions (PR #129031)

2025-02-28 Thread Haojian Wu via cfe-commits
https://github.com/hokein edited https://github.com/llvm/llvm-project/pull/129031 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] WIP: Improve the -Wundefined-func-template diagnostic note for invisible template functions (PR #129031)

2025-02-28 Thread Haojian Wu via cfe-commits
https://github.com/hokein ready_for_review https://github.com/llvm/llvm-project/pull/129031 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] WIP: Improve the -Wundefined-func-template diagnostic note for invisible template functions (PR #129031)

2025-02-28 Thread Haojian Wu via cfe-commits
@@ -5654,6 +5654,8 @@ def warn_func_template_missing : Warning<"instantiation of function %q0 " InGroup, DefaultIgnore; def note_forward_template_decl : Note< "forward declaration of template entity is here">; +def note_unreachable_template_decl +: Note<"declaration of

[clang] WIP: Improve the -Wundefined-func-template diagnostic note for invisible template functions (PR #129031)

2025-02-28 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/129031 >From 5bf873e8ab3b97956ca03ef6337baa0f52320003 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Thu, 27 Feb 2025 11:15:09 +0100 Subject: [PATCH 1/3] Improve the -Wundefined-func-template diagnostic note for invis

[clang] WIP: Improve the -Wundefined-func-template diagnostic note for invisible template functions (PR #129031)

2025-02-28 Thread Haojian Wu via cfe-commits
@@ -5082,11 +5085,16 @@ void Sema::InstantiateFunctionDefinition(SourceLocation PointOfInstantiation, if (AtEndOfTU && !getDiagnostics().hasErrorOccurred() && !getSourceManager().isInSystemHeader(PatternDecl->getBeginLoc())) { Diag(PointOfInstantiation,

[clang] [modules] Add missing test file for b21ee08e57173102b67bc18237b135550 (PR #129221)

2025-02-28 Thread Haojian Wu via cfe-commits
https://github.com/hokein closed https://github.com/llvm/llvm-project/pull/129221 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [modules] Add missing test file for b21ee08e57173102b67bc18237b135550 (PR #129221)

2025-02-28 Thread Haojian Wu via cfe-commits
https://github.com/hokein created https://github.com/llvm/llvm-project/pull/129221 The commit missed a test file. >From 7edbcad61eefd03fbb3cdf4d7759b0e41e348946 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Fri, 28 Feb 2025 11:20:33 +0100 Subject: [PATCH] [modules] Add missing test file for

[clang] WIP: Improve the -Wundefined-func-template diagnostic note for invisible template functions (PR #129031)

2025-02-28 Thread Haojian Wu via cfe-commits
https://github.com/hokein edited https://github.com/llvm/llvm-project/pull/129031 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] WIP: Improve the -Wundefined-func-template diagnostic note for invisible template functions (PR #129031)

2025-02-28 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/129031 >From 5bf873e8ab3b97956ca03ef6337baa0f52320003 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Thu, 27 Feb 2025 11:15:09 +0100 Subject: [PATCH] Improve the -Wundefined-func-template diagnostic note for invisible

[clang] WIP: Improve the -Wundefined-func-template diagnostic note for invisible template functions (PR #129031)

2025-02-27 Thread Haojian Wu via cfe-commits
https://github.com/hokein created https://github.com/llvm/llvm-project/pull/129031 See discussion in https://github.com/llvm/llvm-project/issues/125071. >From ccd5da1bdc4c80bd3461458fc1f4360d766fb6e2 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Thu, 27 Feb 2025 11:15:09 +0100 Subject: [PATC

[clang] [Clang] Fix an integer overflow issue in computing CTAD's parameter depth (PR #128704)

2025-02-25 Thread Haojian Wu via cfe-commits
hokein wrote: > > Need to add a release note as it fixes an existing issue. > > Do you think we need a backport? If so, we can add the release note in the > backport PR This is not a regression, but we have a change in clang20 which exposes this issue in the assertion-build clang. I'd prefer

[clang] [Clang] Fix an integer overflow issue in computing CTAD's parameter depth (PR #128704)

2025-02-25 Thread Haojian Wu via cfe-commits
https://github.com/hokein edited https://github.com/llvm/llvm-project/pull/128704 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Fix an integer overflow issue in computing CTAD's parameter depth (PR #128704)

2025-02-25 Thread Haojian Wu via cfe-commits
@@ -377,8 +377,12 @@ struct ConvertConstructorToDeductionGuideTransform { if (NestedPattern) Args.addOuterRetainedLevels(NestedPattern->getTemplateDepth()); auto [Depth, Index] = getDepthAndIndex(Param); +assert(Depth || + cast(FT

[clang] [Clang] Fix an integer overflow issue in computing CTAD's parameter depth (PR #128704)

2025-02-25 Thread Haojian Wu via cfe-commits
hokein wrote: > (We should have been doing this wrong prior to 20, but it didn't crash > because it called Decl::getTemplateDepth(), which returns 0 for the > transformed template parameter declaration) I think you're right. The depth is already incorrect in clang19 etc. https://godbolt.org/z

[clang] [Clang] Fix an integer overflow issue in computing CTAD's parameter depth (PR #128704)

2025-02-25 Thread Haojian Wu via cfe-commits
@@ -377,8 +377,12 @@ struct ConvertConstructorToDeductionGuideTransform { if (NestedPattern) Args.addOuterRetainedLevels(NestedPattern->getTemplateDepth()); auto [Depth, Index] = getDepthAndIndex(Param); +assert(Depth || + cast(FT

[clang] [Clang] Fix an integer overflow issue in computing CTAD's parameter depth (PR #128704)

2025-02-25 Thread Haojian Wu via cfe-commits
https://github.com/hokein edited https://github.com/llvm/llvm-project/pull/128704 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Fix an integer overflow issue in computing CTAD's parameter depth (PR #128704)

2025-02-25 Thread Haojian Wu via cfe-commits
https://github.com/hokein commented: Thanks for the quick fix! https://github.com/llvm/llvm-project/pull/128704 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Implement CWG 2628 "Implicit deduction guides should propagate constraints" (PR #111143)

2025-02-24 Thread Haojian Wu via cfe-commits
@@ -390,7 +393,7 @@ struct ConvertConstructorToDeductionGuideTransform { /*EvaluateConstraint=*/false); } -assert(NewParam->getTemplateDepth() == 0 && +assert(getDepthAndIndex(NewParam).first == 0 && hokein wrote: A heads

[clang] [WIP][clang]: Implement a conditional lifetimebound_if builtin. (PR #125520)

2025-02-23 Thread Haojian Wu via cfe-commits
hokein wrote: > A moved from object could be reinitalized: > > ``` > void test() { > std::vector abc; > std::string b; > add(abc, std::move(b)); > b = std::string(); // now b can be used again. > } > ``` > > That being said, maybe this is rare enough that we could have

[clang] [WIP][clang]: Implement a conditional lifetimebound_if builtin. (PR #125520)

2025-02-21 Thread Haojian Wu via cfe-commits
hokein wrote: Another thought for supporting the `emplace_back(Args...)` case (for STL only). The underlying implementation of the `emplace_back` relies on `std::allocator_traits::construct(Alloc& a, T* p, Args&&... args)`, so we could use the `lifetime_capture_by` annotation in the instantia

[clang] [WIP][clang]: Implement a conditional lifetimebound_if builtin. (PR #125520)

2025-02-20 Thread Haojian Wu via cfe-commits
hokein wrote: It feels like the current direction & discussion is expanding into a broader problem space beyond the specific issue this PR aims to address. We have two major problems which seem to be orthogonal: 1. **avoiding code duplication** – specifically, reducing the number of function

[clang] [WIP][clang]: Implement a conditional lifetimebound_if builtin. (PR #125520)

2025-02-20 Thread Haojian Wu via cfe-commits
hokein wrote: > It would be nice if you could share some code snippets how exactly this would > be used in practice. Some simple examples from Abseil. When using `lifetime_capture` in the `insert` method, we currently have two overloads: - [one overload](https://github.com/abseil/abseil-cpp

[clang] [WIP][clang]: Implement a conditional lifetimebound_if builtin. (PR #125520)

2025-02-20 Thread Haojian Wu via cfe-commits
hokein wrote: > auto& value = m[std::string_view(std::string())]; // Doesn't get caught This case is supported as well, https://godbolt.org/z/KKsvd8Kx1. https://github.com/llvm/llvm-project/pull/125520 ___ cfe-commits mailing list cfe-commits@lists.l

[clang] [clang] Fix false positive regression for lifetime analysis warning. (PR #127460)

2025-02-18 Thread Haojian Wu via cfe-commits
hokein wrote: /cherry-pick https://github.com/llvm/llvm-project/commit/9c49b188b8e1434eb774ee8422124ad3e8870dce https://github.com/llvm/llvm-project/pull/127460 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mai

[clang] [clang] Fix false positive regression for lifetime analysis warning. (PR #127460)

2025-02-18 Thread Haojian Wu via cfe-commits
https://github.com/hokein milestoned https://github.com/llvm/llvm-project/pull/127460 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Fix false positive regression for lifetime analysis warning. (PR #127460)

2025-02-17 Thread Haojian Wu via cfe-commits
hokein wrote: / cherry-pick 9c49b188b8e1434eb774ee8422124ad3e8870dce https://github.com/llvm/llvm-project/pull/127460 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Diagnose the code with trailing comma in the function call. (PR #125232)

2025-02-17 Thread Haojian Wu via cfe-commits
hokein wrote: clang19 rejects this code as well, https://godbolt.org/z/Yf96W8KWv. To make this case work, I think we should use the `__VA_OPT__`. `#define debug_nok(...) fprintf(stderr, "qwerty" __VA_OPT__(,) ## __VA_ARGS__)` https://github.com/llvm/llvm-project/pull/125232 __

[clang] [clang] Fix false positive regression for lifetime analysis warning. (PR #127460)

2025-02-17 Thread Haojian Wu via cfe-commits
https://github.com/hokein closed https://github.com/llvm/llvm-project/pull/127460 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Fix false positive regression for lifetime analysis warning. (PR #127460)

2025-02-17 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/127460 >From 3601ae837475da3c473f5be9c17687c439495ded Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Mon, 17 Feb 2025 10:08:14 +0100 Subject: [PATCH 1/3] [clang] Fix false positive regression for lifetime analysis war

[clang] [clang] Fix false positive regression for lifetime analysis warning. (PR #127460)

2025-02-17 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/127460 >From 3601ae837475da3c473f5be9c17687c439495ded Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Mon, 17 Feb 2025 10:08:14 +0100 Subject: [PATCH 1/2] [clang] Fix false positive regression for lifetime analysis war

[clang] [clang] Fix false positive regression for lifetime analysis warning. (PR #127460)

2025-02-17 Thread Haojian Wu via cfe-commits
@@ -852,3 +852,27 @@ struct Test { }; } // namespace GH120543 + +namespace GH127195 { +template +struct StatusOr { + T* operator->() [[clang::lifetimebound]]; + T* value() [[clang::lifetimebound]]; +}; + +const char* foo() { + StatusOr s; + return s->data(); // expected-w

[clang] 262e4c1 - Revert "[clang][Modules] Remove a resloved issue from StandardCPlusPlusModules.rst"

2025-02-17 Thread Haojian Wu via cfe-commits
Author: Haojian Wu Date: 2025-02-17T10:47:43+01:00 New Revision: 262e4c19878175780c88da867e88fc4e202d4788 URL: https://github.com/llvm/llvm-project/commit/262e4c19878175780c88da867e88fc4e202d4788 DIFF: https://github.com/llvm/llvm-project/commit/262e4c19878175780c88da867e88fc4e202d4788.diff LO

[clang] [clang] Fix false positive regression for lifetime analysis warning. (PR #127460)

2025-02-17 Thread Haojian Wu via cfe-commits
https://github.com/hokein ready_for_review https://github.com/llvm/llvm-project/pull/127460 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Fix false positive regression for lifetime analysis warning. (PR #127460)

2025-02-17 Thread Haojian Wu via cfe-commits
https://github.com/hokein created https://github.com/llvm/llvm-project/pull/127460 This fixes a false positive caused by #114044. For `GSLPointer*` types, it's less clear whether the lifetime issue is about the GSLPointer object itself or the owner it points to. To avoid false positives, we t

[clang] 82dc2d4 - [clang][Modules] Remove a resloved issue from StandardCPlusPlusModules.rst

2025-02-17 Thread Haojian Wu via cfe-commits
Author: Haojian Wu Date: 2025-02-17T10:46:11+01:00 New Revision: 82dc2d403066a84ef0051b06f1d179e00331f319 URL: https://github.com/llvm/llvm-project/commit/82dc2d403066a84ef0051b06f1d179e00331f319 DIFF: https://github.com/llvm/llvm-project/commit/82dc2d403066a84ef0051b06f1d179e00331f319.diff LO

[clang] [clang] Fix false positive regression for lifetime analysis warning. (PR #127460)

2025-02-17 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/127460 >From 26cf4cd668f9a2d533014a85e8da4a91ce6c8994 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Mon, 17 Feb 2025 10:08:14 +0100 Subject: [PATCH] [clang] Fix false positive regression for lifetime analysis warning

[clang-tools-extra] [clangd] Enable parsing of forwarding functions in the preamble by default (PR #127359)

2025-02-16 Thread Haojian Wu via cfe-commits
https://github.com/hokein commented: The change looks good. We should be mindful of the potential performance regression due to this (1% increase in preamble size, as noted https://reviews.llvm.org/D124688#3483895). I’ll leave the final approval to @kadircet. https://github.com/llvm/llvm

[clang] Diagnose the code with trailing comma in the function call. (PR #125232)

2025-02-14 Thread Haojian Wu via cfe-commits
hokein wrote: /cherry-pick https://github.com/llvm/llvm-project/commit/922f339c4ef3631f66dc4b8caa4c356103dbf69d https://github.com/llvm/llvm-project/pull/125232 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mai

[clang] Diagnose the code with trailing comma in the function call. (PR #125232)

2025-02-14 Thread Haojian Wu via cfe-commits
https://github.com/hokein milestoned https://github.com/llvm/llvm-project/pull/125232 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Diagnose the code with trailing comma in the function call. (PR #125232)

2025-02-14 Thread Haojian Wu via cfe-commits
https://github.com/hokein closed https://github.com/llvm/llvm-project/pull/125232 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Remove the PackExpansion restrictions for rewrite substitution (PR #126206)

2025-02-13 Thread Haojian Wu via cfe-commits
https://github.com/hokein approved this pull request. Thanks! Please add a release note. https://github.com/llvm/llvm-project/pull/126206 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commit

[clang] [Clang] Remove the PackExpansion restrictions for rewrite substitution (PR #126206)

2025-02-13 Thread Haojian Wu via cfe-commits
https://github.com/hokein edited https://github.com/llvm/llvm-project/pull/126206 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Remove the PackExpansion restrictions for rewrite substitution (PR #126206)

2025-02-13 Thread Haojian Wu via cfe-commits
@@ -2041,9 +2041,11 @@ TemplateName TemplateInstantiator::TransformTemplateName( // We're rewriting the template parameter as a reference to another // template parameter. if (Arg.getKind() == TemplateArgument::Pack) { - assert(Arg.pack_size() =

[clang] [clang] CTAD: Remove an incorrect assertion in BuildDeductionGuideForTypeAlias (PR #126532)

2025-02-13 Thread Haojian Wu via cfe-commits
https://github.com/hokein closed https://github.com/llvm/llvm-project/pull/126532 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] CTAD: Remove an incorrect assertion in BuildDeductionGuideForTypeAlias (PR #126532)

2025-02-11 Thread Haojian Wu via cfe-commits
https://github.com/hokein ready_for_review https://github.com/llvm/llvm-project/pull/126532 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] CTAD: Remove an incorrect assertion in BuildDeductionGuideForTypeAlias (PR #126532)

2025-02-11 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/126532 >From cc0b4f59c273db9baff85a457ef534d6f7ca9cfb Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Mon, 10 Feb 2025 15:44:00 +0100 Subject: [PATCH] [clang] CTAD: Remove an incorrect assertion in BuildDeductionGuideF

[clang] [clang] CTAD: Remove an incorrect assertion in BuildDeductionGuideForTypeAlias (PR #126532)

2025-02-10 Thread Haojian Wu via cfe-commits
https://github.com/hokein created https://github.com/llvm/llvm-project/pull/126532 Fixes #125821 The assertion was too strict, as Clang can reach this code path when recursively generating deduction guides for alias templates. See the detailed explanation [here](https://github.com/llvm/llvm-

[clang] [clang] CTAD alias: Respect explicit deduction guides defined after the first use of the alias template. (PR #125478)

2025-02-10 Thread Haojian Wu via cfe-commits
https://github.com/hokein closed https://github.com/llvm/llvm-project/pull/125478 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] CTAD alias: Respect explicit deduction guides defined after the first use of the alias template. (PR #125478)

2025-02-10 Thread Haojian Wu via cfe-commits
@@ -237,8 +237,17 @@ static_assert(__is_same(decltype(s.t), int)); // explicit deduction guide. Foo(int) -> Foo; AFoo s2{i}; -// FIXME: the type should be X because of the above explicit deduction guide. -static_assert(__is_same(decltype(s2.t), int)); +static_assert(__is_same(d

[clang] [clang] CTAD alias: Respect explicit deduction guides defined after the first use of the alias template. (PR #125478)

2025-02-10 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/125478 >From 4af8e1985c4882e1083cd522eb955f69066bd15e Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Mon, 3 Feb 2025 11:55:17 +0100 Subject: [PATCH 1/3] [clang] CTAD alias: Respecte explicit deduction guides defined a

[clang] [lldb] [lldb][TypeSystemClang] Initialize ClassTemplateSpecializationDecl's StrictPackMatch field (PR #126215)

2025-02-07 Thread Haojian Wu via cfe-commits
https://github.com/hokein approved this pull request. Thank you! https://github.com/llvm/llvm-project/pull/126215 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [lldb] Reland: [clang] fix P3310 overload resolution flag propagation (PR #125791)

2025-02-06 Thread Haojian Wu via cfe-commits
hokein wrote: Heads-up: this patch triggers a MSAN failure in an lldb test (`lldb/test/API/commands/expression/call-function/TestCallStdStringFunction.py`), the stacktrace: ``` ==5633==WARNING: MemorySanitizer: use-of-uninitialized-value #0 in decltype(auto) clang::ASTNodeImporter::CallOv

[clang] [clang] CTAD alias: Respect explicit deduction guides defined after the first use of the alias template. (PR #125478)

2025-02-05 Thread Haojian Wu via cfe-commits
@@ -237,8 +237,17 @@ static_assert(__is_same(decltype(s.t), int)); // explicit deduction guide. Foo(int) -> Foo; AFoo s2{i}; -// FIXME: the type should be X because of the above explicit deduction guide. -static_assert(__is_same(decltype(s2.t), int)); +static_assert(__is_same(d

[clang] [clang] CTAD alias: Respect explicit deduction guides defined after the first use of the alias template. (PR #125478)

2025-02-05 Thread Haojian Wu via cfe-commits
@@ -237,8 +237,17 @@ static_assert(__is_same(decltype(s.t), int)); // explicit deduction guide. Foo(int) -> Foo; AFoo s2{i}; -// FIXME: the type should be X because of the above explicit deduction guide. -static_assert(__is_same(decltype(s2.t), int)); +static_assert(__is_same(d

[clang] [clang] fix P3310 overload resolution flag propagation (PR #125372)

2025-02-04 Thread Haojian Wu via cfe-commits
hokein wrote: The lldb code needs to be updated as well https://github.com/llvm/llvm-project/blob/d5488f157c74332646d2b6e9d16c88e61d5a789e/lldb/source/Plugins/ExpressionParser/Clang/CxxModuleHandler.cpp#L277-L283 https://github.com/llvm/llvm-project/pull/125372 _

[clang] Diagnose the code with trailing comma in the function call. (PR #125232)

2025-02-04 Thread Haojian Wu via cfe-commits
hokein wrote: > @hokein feel free to merge :) Thanks for the ping. We have several instances of `func(1,);` in our internal codebase, and the number is not small unfortunately. I'm currently working on a cleanup, which will take some time. I plan to merge this patch as soon as the cleanup is

[clang] [WIP][clang]: Implement a conditional lifetimebound_if builtin. (PR #125520)

2025-02-03 Thread Haojian Wu via cfe-commits
https://github.com/hokein edited https://github.com/llvm/llvm-project/pull/125520 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [WIP][clang]: Implement a conditional lifetimebound_if builtin. (PR #125520)

2025-02-03 Thread Haojian Wu via cfe-commits
https://github.com/hokein created https://github.com/llvm/llvm-project/pull/125520 This WIP PR explores the idea of introducing `[[clang::lifetimebound_if()]]`, a built-in attribute that conditionally applies `[[clang::lifetimebound]]` based on the given boolean expression. One of the key

  1   2   3   4   5   6   7   8   9   10   >