[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
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] 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] 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] 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] 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
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-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
@@ -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
@@ -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
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] [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] [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] 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] 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
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] [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] [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
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-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-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] 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-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 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
@@ -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
@@ -5082,11 +5085,16 @@ void Sema::InstantiateFunctionDefinition(SourceLocation PointOfInstantiation, if (AtEndOfTU && !getDiagnostics().hasErrorOccurred() && !getSourceManager().isInSystemHeader(PatternDecl->getBeginLoc())) { Diag(PointOfInstantiation,

[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] 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] [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] [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] 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 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] 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 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] [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] 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] 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] [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-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] [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-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] [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: 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] [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
@@ -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
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
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] 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] 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
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
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
@@ -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] [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 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] [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] 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 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 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 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 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] 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 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 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] 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] [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] [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 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-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] [clang][modules] Fix lambda and its enclosing function are not loaded from same module. (PR #142467)

2025-06-02 Thread Haojian Wu via cfe-commits
https://github.com/hokein created https://github.com/llvm/llvm-project/pull/142467 This is a follow-up fix to https://github.com/llvm/llvm-project/pull/109167. Previously, we stored a mapping between the enclosing function and the lambda class declaration. When loading the enclosing function,

[clang] [clang][AST] Reduce some AST node size. (PR #142585)

2025-06-03 Thread Haojian Wu via cfe-commits
https://github.com/hokein created https://github.com/llvm/llvm-project/pull/142585 This patch reduces the size of several AST nodes by moving some fields into the free bitfield space in the base `Stmt` class: * `CXXForRangeStmt`: 96 → 88 bytes * `ChooseExpr`: 56 → 48 bytes * `ArrayTypeTraitExp

[clang] [clang][modules] Remove the workaround for the lambda issue. (PR #142547)

2025-06-03 Thread Haojian Wu via cfe-commits
@@ -1702,36 +1702,7 @@ static NamedDecl* getLambdaCallOperatorHelper(const CXXRecordDecl &RD) { assert(allLookupResultsAreTheSame(Calls) && "More than one lambda call operator!"); - - // FIXME: If we have multiple call operators, we might be in a situation - // w

[clang] [Serialization] Fix source location data loss during decoding. (PR #145529)

2025-06-24 Thread Haojian Wu via cfe-commits
https://github.com/hokein created https://github.com/llvm/llvm-project/pull/145529 The delta encoding can produce values up to 33 bits, but the current decoding logic only preserves the lower 32 bits, potentially causing data loss. This patch fixes the issue by preserving the lower 33 bits for

[clang] [Serialization] Fix source location data loss during decoding. (PR #145529)

2025-06-24 Thread Haojian Wu via cfe-commits
hokein wrote: > Sorry. I failed to understand the problem. In what case, may the encoder > produce up to 33 bits? The newly-added testcase shows the issue -- the encoded value for the delta is `1<<32`, relevant code https://github.com/llvm/llvm-project/blob/c3c923c8d62c1e85fe396a499c921c8a475

[clang] [Serialization] Fix source location data loss during decoding. (PR #145529)

2025-06-25 Thread Haojian Wu via cfe-commits
hokein wrote: > > Yeah, the current situation conflicts with 64-bit source location. We > > discussed this. The conclusion is, if we need large source location space, > > use 48 bits and leave upper 16 bits for module file index. 48 bits should > > be enough for most cases. Thanks, this makes

[clang] [Serialization] Remove delta encoding optimization (PR #145670)

2025-06-25 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/145670 >From d2cac7f56f5adf2ddfe084e684562a56f5c5dc65 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Wed, 25 Jun 2025 12:30:18 +0200 Subject: [PATCH 1/2] [Serialization] Remove delta encoding. --- clang/include/clang

[clang] [clang] NFC: Add alias for std::pair used in SourceLocation (PR #145711)

2025-06-25 Thread Haojian Wu via cfe-commits
https://github.com/hokein created https://github.com/llvm/llvm-project/pull/145711 Introduce a type alias for the commonly used `std::pair` to improve code readability, and make it easier for future updates (64-bit source locations). >From 2bd778b5b5c5ffc0a36cf0e0e71034fe16c48ad0 Mon Sep 17 0

[clang] a945fb1 - [clang] NFC, move the SourceLocationEncoding.h header guard to the begining of the file

2025-06-25 Thread Haojian Wu via cfe-commits
Author: Haojian Wu Date: 2025-06-25T16:26:40+02:00 New Revision: a945fb1481e01f9631fde5f6174276532c33fc98 URL: https://github.com/llvm/llvm-project/commit/a945fb1481e01f9631fde5f6174276532c33fc98 DIFF: https://github.com/llvm/llvm-project/commit/a945fb1481e01f9631fde5f6174276532c33fc98.diff LO

[clang] [Serialization] Remove delta encoding optimization (PR #145670)

2025-06-25 Thread Haojian Wu via cfe-commits
https://github.com/hokein created https://github.com/llvm/llvm-project/pull/145670 See the discussion in https://github.com/llvm/llvm-project/pull/145529. This will slightly increase the PCM size (~5%), some data (in-memory preamble size in clangd): - SemaExpr.cpp: 77MB -> 80MB - FindTarget.

[clang] [clang] Reduce TemplateDeclInstantiator size. (PR #142983)

2025-06-06 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/142983 >From 61be4bfea92d52cfc3e48a3cabb1bc80cbebb7fa Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Thu, 5 Jun 2025 15:38:58 +0200 Subject: [PATCH 1/2] [clang] Reduce TemplateDeclInstantiator size. --- clang/include

[clang] [clang] Reduce LateInstantiatedAttrVec vector default size. (PR #142840)

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

[clang] [clang] Reduce TemplateDeclInstantiator size. (PR #142983)

2025-06-05 Thread Haojian Wu via cfe-commits
https://github.com/hokein created https://github.com/llvm/llvm-project/pull/142983 This gives us another ~1.85% improvement (1617->1647 for the `instantiation-depth-default.cpp`) on clang's template instantiation depths, No performance regressions have been observed: https://llvm-compile-ti

[clang] [clang] Reduce TemplateDeclInstantiator size. (PR #142983)

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

[clang-tools-extra] [clangd] Guard against trivial FunctionProtoTypeLoc when creating inlay hints (PR #143087)

2025-06-06 Thread Haojian Wu via cfe-commits
https://github.com/hokein approved this pull request. https://github.com/llvm/llvm-project/pull/143087 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

<    26   27   28   29   30   31   32   >