[clang] [clang] Extend lifetime analysis to support assignments for pointer-like objects. (PR #99032)

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

[clang] [clang] Add `std::span` to the default gsl pointer annotation list. (PR #99622)

2024-07-19 Thread Haojian Wu via cfe-commits
https://github.com/hokein created https://github.com/llvm/llvm-project/pull/99622 None >From 0fdc7b5dd850c522a7b485d7b6ba8a890739e604 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Fri, 19 Jul 2024 11:42:44 +0200 Subject: [PATCH] [clang] Add `std::span` to the default gsl pointer annotation

[clang] [clang] Add `std::span` to the default gsl pointer annotation list. (PR #99622)

2024-07-19 Thread Haojian Wu via cfe-commits
hokein wrote: > Hmm. Can/should we also make these const? Yes, I will change them in a follow-up patch. https://github.com/llvm/llvm-project/pull/99622 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/list

[clang] [clang] Add `std::span` to the default gsl pointer annotation list. (PR #99622)

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

[clang] e404eed - [clang] Add the `const` to all default lists in SemaAttr.cpp, NFC

2024-07-19 Thread Haojian Wu via cfe-commits
Author: Haojian Wu Date: 2024-07-19T13:13:01+02:00 New Revision: e404eed24bebd5e3e04fc153eb330bae7d92107f URL: https://github.com/llvm/llvm-project/commit/e404eed24bebd5e3e04fc153eb330bae7d92107f DIFF: https://github.com/llvm/llvm-project/commit/e404eed24bebd5e3e04fc153eb330bae7d92107f.diff LO

[clang] [clang] NFC, simplify the code in CheckExprLifetime.cpp (PR #99637)

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

[clang] [Clang][NFCI] Prefer non-canonical template arguments for synthesized CTAD guides (PR #99840)

2024-07-22 Thread Haojian Wu via cfe-commits
https://github.com/hokein commented: Thanks, the diagnostics in the test look much better. There is an ambiguous case that I'm a little concerned about: if the alias template parameter and the underlying template parameter have the same name, the synthesized deduction guide may end up with two

[clang] [Clang][NFCI] Prefer non-canonical template arguments for synthesized CTAD guides (PR #99840)

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

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-07-22 Thread Haojian Wu via cfe-commits
https://github.com/hokein edited https://github.com/llvm/llvm-project/pull/98788 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-07-22 Thread Haojian Wu via cfe-commits
@@ -0,0 +1,260 @@ +// RUN: %clang_cc1 -fsyntax-only -std=c++23 -verify %s + +namespace test1 { + template struct Base { +template requires true +Base(T); + }; + + template struct InheritsCtors : public Base { +using Base::Base; + }; + + InheritsCtors inheritsCtors

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-07-22 Thread Haojian Wu via cfe-commits
@@ -1426,6 +1727,34 @@ void Sema::DeclareImplicitDeductionGuides(TemplateDecl *Template, if (!AddedAny) Transform.buildSimpleDeductionGuide(std::nullopt); + // FIXME: Handle explicit deduction guides from inherited constructors + // when the base deduction guides are

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-07-22 Thread Haojian Wu via cfe-commits
https://github.com/hokein commented: I haven't finished the review yet, some initial comments. https://github.com/llvm/llvm-project/pull/98788 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cf

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-07-22 Thread Haojian Wu via cfe-commits
@@ -936,19 +940,21 @@ Expr *buildIsDeducibleConstraint(Sema &SemaRef, Context.DeclarationNames.getCXXDeductionGuideName(AliasTemplate)); }; + TemplateDecl *TD = DeducingTemplate ? DeducingTemplate : AliasTemplate; + SmallVector IsDeducibleTypeTraitArgs = {

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-07-22 Thread Haojian Wu via cfe-commits
@@ -0,0 +1,260 @@ +// RUN: %clang_cc1 -fsyntax-only -std=c++23 -verify %s + hokein wrote: Can you add testcases for the template parameter packs? e.g. ``` template struct B { B(T...); }; template struct C : public B { using B::B; }; C c(1); ``` https://

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-07-22 Thread Haojian Wu via cfe-commits
@@ -1957,17 +1957,26 @@ class CXXDeductionGuideDecl : public FunctionDecl { ExplicitSpecifier ES, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, SourceLocation EndLocation, -

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-07-22 Thread Haojian Wu via cfe-commits
@@ -0,0 +1,260 @@ +// RUN: %clang_cc1 -fsyntax-only -std=c++23 -verify %s hokein wrote: nit: you need to adjust the diagnostic messages after the https://github.com/llvm/llvm-project/commit/c7bfc41860a6abe5c92dc5afb47348b0c9e69963 https://github.com/llvm/llvm-p

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-07-22 Thread Haojian Wu via cfe-commits
@@ -980,19 +986,69 @@ getRHSTemplateDeclAndArgs(Sema &SemaRef, TypeAliasTemplateDecl *AliasTemplate) { return {Template, AliasRhsTemplateArgs}; } +// Build the type for a deduction guide generated from an inherited constructor +// [over.match.class.deduct]p1.10: +// ... the

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-07-22 Thread Haojian Wu via cfe-commits
@@ -980,19 +986,69 @@ getRHSTemplateDeclAndArgs(Sema &SemaRef, TypeAliasTemplateDecl *AliasTemplate) { return {Template, AliasRhsTemplateArgs}; } +// Build the type for a deduction guide generated from an inherited constructor +// [over.match.class.deduct]p1.10: +// ... the

[clang-tools-extra] [IncludeCleaner] Also check for spellings of physical headers (PR #99843)

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

[clang] [clang][test] Add missing test file to cmake (PR #99907)

2024-07-22 Thread Haojian Wu via cfe-commits
https://github.com/hokein approved this pull request. oops, good catch! https://github.com/llvm/llvm-project/pull/99907 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][test] Add missing test file to cmake (PR #99907)

2024-07-22 Thread Haojian Wu via cfe-commits
https://github.com/hokein edited https://github.com/llvm/llvm-project/pull/99907 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][test] Add missing test file to cmake (PR #99907)

2024-07-22 Thread Haojian Wu via cfe-commits
@@ -58,7 +58,7 @@ Bar s(1); DeductionGuideVisitor::Lang_CXX2a)); } -TEST(RecursiveASTVisitor, DeductionGuideImplicitMode) { +TEST(RecursiveASTVisitor, DISABLED_DeductionGuideImplicitMode) { DeductionGuideVisitor Visitor(/*ShouldVisitImplicitCode*/ true); Visitor.Ex

[clang] 2ef12b5 - [clang] Fix the broken DeductionGuide ToolingTests after c7bfc41860a6abe5c92dc5afb47348b0c9e69963

2024-07-22 Thread Haojian Wu via cfe-commits
Author: Haojian Wu Date: 2024-07-22T20:31:25+02:00 New Revision: 2ef12b55b2a655262b03204581076522261d5eb3 URL: https://github.com/llvm/llvm-project/commit/2ef12b55b2a655262b03204581076522261d5eb3 DIFF: https://github.com/llvm/llvm-project/commit/2ef12b55b2a655262b03204581076522261d5eb3.diff LO

[clang] [clang][test] Add missing test file to cmake (PR #99907)

2024-07-22 Thread Haojian Wu via cfe-commits
@@ -58,7 +58,7 @@ Bar s(1); DeductionGuideVisitor::Lang_CXX2a)); } -TEST(RecursiveASTVisitor, DeductionGuideImplicitMode) { +TEST(RecursiveASTVisitor, DISABLED_DeductionGuideImplicitMode) { DeductionGuideVisitor Visitor(/*ShouldVisitImplicitCode*/ true); Visitor.Ex

[clang] [clang] coroutine: generate valid mangled name in CodeGenFunction::generateAwaitSuspendWrapper (PR #89731)

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

[clang] [clang] CTAD: implement the missing IsDeducible constraint for alias templates (PR #89358)

2024-04-24 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/89358 >From 2385c46a2ae67e0890a7232fdec16b0b92da060b Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Fri, 19 Apr 2024 10:54:12 +0200 Subject: [PATCH 1/3] [clang] CTAD: implement the missing IsDeducible constraint for a

[clang] [clang] CTAD: implement the missing IsDeducible constraint for alias templates (PR #89358)

2024-04-24 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/89358 >From 2385c46a2ae67e0890a7232fdec16b0b92da060b Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Fri, 19 Apr 2024 10:54:12 +0200 Subject: [PATCH 1/3] [clang] CTAD: implement the missing IsDeducible constraint for a

[clang] [clang] CTAD: implement the missing IsDeducible constraint for alias templates (PR #89358)

2024-04-24 Thread Haojian Wu via cfe-commits
@@ -868,13 +868,7 @@ C++20 implementation status Class template argument deduction for alias templates https://wg21.link/p1814r0";>P1814R0 - - - Clang 19 (Partial) - The associated constraints (over.match.class.deduct#3.3) for th

[clang] [clang] CTAD: implement the missing IsDeducible constraint for alias templates (PR #89358)

2024-04-24 Thread Haojian Wu via cfe-commits
hokein wrote: OK, I have hidden the `__is_deducible` trait as suggested. Please take another look. https://github.com/llvm/llvm-project/pull/89358 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/

[clang] [clang] CTAD: implement the missing IsDeducible constraint for alias templates (PR #89358)

2024-04-24 Thread Haojian Wu via cfe-commits
hokein wrote: > > OK, I have hidden the `__is_deducible` trait as suggested. Please take > > another look. > > Sorry, I think my suggestion was not clear enough. did you try to put > `TYPE_TRAIT_2(/**/, IsDeducible, KEYCXX)` in `TokenKinds.def` (and then other > headers should _NOT_ be modifi

[clang] [clang] CTAD: implement the missing IsDeducible constraint for alias templates (PR #89358)

2024-04-24 Thread Haojian Wu via cfe-commits
hokein wrote: > > Ah, I see. I haven't tried that, but one downside I can see is that it will > > make diagnostics for CTAD worse, we need to spell the type trait name in > > error messages when the __is_deducible trait fails. > > I think we should have a custom diag for that anyway "is not de

[clang] [clang] CTAD: implement the missing IsDeducible constraint for alias templates (PR #89358)

2024-04-26 Thread Haojian Wu via cfe-commits
hokein wrote: It appears that the consensus is to avoid exposing the internal `__is_deducible` type trait to end-users, as there are no compelling use cases and it's not expected to be used in libc++. This also aligns with the approach taken by GCC. Regarding implementation, the current table

[clang] [clang] Implement a bitwise_copyable builtin type trait. (PR #86512)

2024-04-29 Thread Haojian Wu via cfe-commits
hokein wrote: Friendly ping, it is ready for the second round of review. https://github.com/llvm/llvm-project/pull/86512 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] CTAD: implement the missing IsDeducible constraint for alias templates (PR #89358)

2024-04-29 Thread Haojian Wu via cfe-commits
hokein wrote: > @hokein Independently of the direction taken I'd like to see a better > diagnostic than "atomic constraint using an undocumented/cryptic trait that > is not in the code is not satisfied". > So when we try to print atomic constraints, we should do something more user > friendly

[clang] [clang] Add __builtin_start_object_lifetime builtin. (PR #82776)

2024-04-29 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/82776 >From 3ab1a074592f85715c061007c56c69c24794a556 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Fri, 23 Feb 2024 10:03:16 +0100 Subject: [PATCH 1/2] [clang] Add __builtin_start_object_lifetime builtin. This patch

[clang] [clang] Add __builtin_start_object_lifetime builtin. (PR #82776)

2024-04-29 Thread Haojian Wu via cfe-commits
hokein wrote: Friendly ping. https://github.com/llvm/llvm-project/pull/82776 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [AST] Dump explicit template arguments for UnreslovedLookupExpr. (PR #90466)

2024-04-29 Thread Haojian Wu via cfe-commits
https://github.com/hokein created https://github.com/llvm/llvm-project/pull/90466 Having them dump is useful for ad-hoc debugging (context: https://github.com/llvm/llvm-project/issues/90046) >From b584fab7f2283535d4a04bc55efec6ff508870de Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Mon, 29

[clang] [AST] Dump explicit template arguments for UnreslovedLookupExpr. (PR #90466)

2024-04-29 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/90466 >From b584fab7f2283535d4a04bc55efec6ff508870de Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Mon, 29 Apr 2024 15:04:01 +0200 Subject: [PATCH 1/2] [AST] Dump explicit template arguments for UnreslovedLookupExpr.

[clang] [AST] Dump explicit template arguments for UnreslovedLookupExpr. (PR #90466)

2024-04-29 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/90466 >From b584fab7f2283535d4a04bc55efec6ff508870de Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Mon, 29 Apr 2024 15:04:01 +0200 Subject: [PATCH 1/2] [AST] Dump explicit template arguments for UnreslovedLookupExpr.

[clang] [AST] Dump explicit template arguments for UnreslovedLookupExpr. (PR #90466)

2024-04-29 Thread Haojian Wu via cfe-commits
@@ -107,3 +107,17 @@ auto FooFunc(C auto V) -> C decltype(auto) { } } + +namespace dump_unreslove_lookup_arguments { hokein wrote: ah, good catch. I moved to a generic place, ast-dump-templates.cpp. https://github.com/llvm/llvm-project/pull/90466 ___

[clang] [AST] Dump explicit template arguments for UnreslovedLookupExpr. (PR #90466)

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

[clang] [AST] Dump explicit template arguments for UnreslovedLookupExpr. (PR #90466)

2024-04-29 Thread Haojian Wu via cfe-commits
https://github.com/hokein edited https://github.com/llvm/llvm-project/pull/90466 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Add lifetimebound attr to std::span/std::string_view constructor (PR #103716)

2024-08-28 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/103716 >From 24a84b35dba03ca80027efcc87b4628c378991ff Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Wed, 14 Aug 2024 10:18:09 +0200 Subject: [PATCH] [clang] Add lifetimebound attr to std::span/std::string_view constr

[clang] [clang] Add lifetimebound attr to std::span/std::string_view constructor (PR #103716)

2024-08-28 Thread Haojian Wu via cfe-commits
@@ -216,6 +216,59 @@ void Sema::inferGslOwnerPointerAttribute(CXXRecordDecl *Record) { inferGslPointerAttribute(Record, Record); } +void Sema::inferLifetimeBoundAttribute(FunctionDecl *FD) { + if (FD->getNumParams() == 0) +return; + + if (unsigned BuiltinID = FD->getB

[clang] [clang] Add lifetimebound attr to std::span/std::string_view constructor (PR #103716)

2024-08-28 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/103716 >From 24a84b35dba03ca80027efcc87b4628c378991ff Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Wed, 14 Aug 2024 10:18:09 +0200 Subject: [PATCH 1/2] [clang] Add lifetimebound attr to std::span/std::string_view co

[clang] [clang] Add lifetimebound attr to std::span/std::string_view constructor (PR #103716)

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

[clang-tools-extra] [include-cleaner] Mark RecordDecls referenced in UsingDecls as explicit (PR #106430)

2024-08-28 Thread Haojian Wu via cfe-commits
@@ -203,7 +203,7 @@ class ASTWalker : public RecursiveASTVisitor { bool VisitUsingDecl(UsingDecl *UD) { for (const auto *Shadow : UD->shadows()) { auto *TD = Shadow->getTargetDecl(); - auto IsUsed = TD->isUsed() || TD->isReferenced(); + auto IsUsed = TD->i

[clang-tools-extra] [include-cleaner] Mark RecordDecls referenced in UsingDecls as explicit (PR #106430)

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

[clang-tools-extra] [include-cleaner] Mark RecordDecls referenced in UsingDecls as explicit (PR #106430)

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

[clang-tools-extra] [include-cleaner] Mark RecordDecls referenced in UsingDecls as explicit (PR #106430)

2024-08-29 Thread Haojian Wu via cfe-commits
@@ -203,7 +203,7 @@ class ASTWalker : public RecursiveASTVisitor { bool VisitUsingDecl(UsingDecl *UD) { for (const auto *Shadow : UD->shadows()) { auto *TD = Shadow->getTargetDecl(); - auto IsUsed = TD->isUsed() || TD->isReferenced(); + auto IsUsed = TD->i

[clang-tools-extra] [include-cleaner] Report refs for enum constants used through namespace aliases (PR #106706)

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

[clang-tools-extra] [include-cleaner] Report refs for enum constants used through namespace aliases (PR #106706)

2024-08-30 Thread Haojian Wu via cfe-commits
@@ -146,9 +148,24 @@ class ASTWalker : public RecursiveASTVisitor { // // If it's an enum constant, it must be due to prior decl. Report references // to it when qualifier isn't a type. -if (llvm::isa(FD)) { - if (!DRE->getQualifier() || DRE->getQualifier(

[clang] 57ef16c - Fix -Wswitch warning after 4fef204ac42eb84e167d43ce076c9a167eae3be0

2024-09-01 Thread Haojian Wu via cfe-commits
Author: Haojian Wu Date: 2024-09-01T15:40:44+02:00 New Revision: 57ef16c699c274b7f3eee12e5c2896e193f513c4 URL: https://github.com/llvm/llvm-project/commit/57ef16c699c274b7f3eee12e5c2896e193f513c4 DIFF: https://github.com/llvm/llvm-project/commit/57ef16c699c274b7f3eee12e5c2896e193f513c4.diff LO

[clang] 7b2fe84 - Don't run the lifetime analysis for pointer assignment if the warning is

2024-09-01 Thread Haojian Wu via cfe-commits
Author: Haojian Wu Date: 2024-09-01T16:19:18+02:00 New Revision: 7b2fe84ff57b49f6275bc12d47f87a1887919d9e URL: https://github.com/llvm/llvm-project/commit/7b2fe84ff57b49f6275bc12d47f87a1887919d9e DIFF: https://github.com/llvm/llvm-project/commit/7b2fe84ff57b49f6275bc12d47f87a1887919d9e.diff LO

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-09-02 Thread Haojian Wu via cfe-commits
@@ -944,12 +950,67 @@ getRHSTemplateDeclAndArgs(Sema &SemaRef, TypeAliasTemplateDecl *AliasTemplate) { return {Template, AliasRhsTemplateArgs}; } +struct InheritedConstructorDeductionInfo { + TemplateDecl *DerivedClassTemplate; hokein wrote: nit: would be

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-09-02 Thread Haojian Wu via cfe-commits
@@ -944,12 +950,67 @@ getRHSTemplateDeclAndArgs(Sema &SemaRef, TypeAliasTemplateDecl *AliasTemplate) { return {Template, AliasRhsTemplateArgs}; } +struct InheritedConstructorDeductionInfo { + TemplateDecl *DerivedClassTemplate; + TypeSourceInfo *CCType; +}; + +// Build th

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-09-02 Thread Haojian Wu via cfe-commits
@@ -1216,10 +1308,225 @@ void DeclareImplicitDeductionGuidesForTypeAlias( ->getDeductionCandidateKind() == DeductionCandidate::Aggregate) continue; -BuildDeductionGuideForTypeAlias(SemaRef, AliasTemplate, F, Loc); +BuildDeductionGuideForTypeAlias(Sema

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-09-02 Thread Haojian Wu via cfe-commits
@@ -1216,10 +1324,225 @@ void DeclareImplicitDeductionGuidesForTypeAlias( ->getDeductionCandidateKind() == DeductionCandidate::Aggregate) continue; -BuildDeductionGuideForTypeAlias(SemaRef, AliasTemplate, F, Loc); +BuildDeductionGuideForTypeAlias(Sema

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-09-02 Thread Haojian Wu via cfe-commits
@@ -944,12 +950,67 @@ getRHSTemplateDeclAndArgs(Sema &SemaRef, TypeAliasTemplateDecl *AliasTemplate) { return {Template, AliasRhsTemplateArgs}; } +struct InheritedConstructorDeductionInfo { + TemplateDecl *DerivedClassTemplate; + TypeSourceInfo *CCType; +}; + +// Build th

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-09-02 Thread Haojian Wu via cfe-commits
@@ -1216,10 +1308,225 @@ void DeclareImplicitDeductionGuidesForTypeAlias( ->getDeductionCandidateKind() == DeductionCandidate::Aggregate) continue; -BuildDeductionGuideForTypeAlias(SemaRef, AliasTemplate, F, Loc); +BuildDeductionGuideForTypeAlias(Sema

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-09-02 Thread Haojian Wu via cfe-commits
@@ -1216,10 +1324,225 @@ void DeclareImplicitDeductionGuidesForTypeAlias( ->getDeductionCandidateKind() == DeductionCandidate::Aggregate) continue; -BuildDeductionGuideForTypeAlias(SemaRef, AliasTemplate, F, Loc); +BuildDeductionGuideForTypeAlias(Sema

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-09-02 Thread Haojian Wu via cfe-commits
hokein wrote: > The current implementation strictly follows the standard's specification for > replacing the return type of an alias deduction guide. > > However, this approach adds some implicit declarations in the AST (in terms > of the partial class template specialization), which is cumber

[clang] [clang] Respect the lifetimebound in assignment operator. (PR #106997)

2024-09-02 Thread Haojian Wu via cfe-commits
https://github.com/hokein created https://github.com/llvm/llvm-project/pull/106997 Fixes #106372 >From 88600fb5e7395d4eefb6be24689248b7be2d4115 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Wed, 28 Aug 2024 12:11:28 +0200 Subject: [PATCH] [clang] Respect the lifetimebound in user-defined ope

[clang] [clang] Respect the lifetimebound in assignment operator. (PR #106997)

2024-09-03 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/106997 >From 88600fb5e7395d4eefb6be24689248b7be2d4115 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Wed, 28 Aug 2024 12:11:28 +0200 Subject: [PATCH 1/2] [clang] Respect the lifetimebound in user-defined operator. --

[clang] [clang] Respect the lifetimebound in assignment operator. (PR #106997)

2024-09-03 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/106997 >From 88600fb5e7395d4eefb6be24689248b7be2d4115 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Wed, 28 Aug 2024 12:11:28 +0200 Subject: [PATCH 1/3] [clang] Respect the lifetimebound in user-defined operator. --

[clang] [clang] Respect the lifetimebound in assignment operator. (PR #106997)

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

[clang] [clang] Respect the lifetimebound in assignment operator. (PR #106997)

2024-09-03 Thread Haojian Wu via cfe-commits
https://github.com/hokein commented: Thanks for the quick review. https://github.com/llvm/llvm-project/pull/106997 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Respect the lifetimebound in assignment operator. (PR #106997)

2024-09-03 Thread Haojian Wu via cfe-commits
@@ -968,6 +972,23 @@ static bool pathOnlyHandlesGslPointer(IndirectLocalPath &Path) { return false; } +static bool isAssginmentOperatorLifetimeBound(CXXMethodDecl *CMD) { + if (!CMD) +return false; + assert(CMD->getOverloadedOperator() == OverloadedOperatorKind::OO_Eq

[clang] [clang] Respect the lifetimebound in assignment operator. (PR #106997)

2024-09-03 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/106997 >From 040c7646a037652f0c00a97de767a3f96ebbd1d3 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Wed, 28 Aug 2024 12:11:28 +0200 Subject: [PATCH 1/3] [clang] Respect the lifetimebound in user-defined operator. --

[clang] [clang] CTAD: Generate deduction guides for alias templates from non-template explicit deduction guides (PR #96686)

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

[clang] [clang] CTAD: use index and depth to retrieve template parameter for TemplateParamsReferencedInTemplateArgumentList (PR #98013)

2024-07-11 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/98013 >From c9297f8abe8d480fdcd3ba6d6598268fef74ddb4 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Mon, 8 Jul 2024 13:19:13 +0200 Subject: [PATCH 1/2] [clang] CTAD: use index and depth to retrieve template parameters

[clang] [clang] CTAD: use index and depth to retrieve template parameter for TemplateParamsReferencedInTemplateArgumentList (PR #98013)

2024-07-11 Thread Haojian Wu via cfe-commits
https://github.com/hokein edited https://github.com/llvm/llvm-project/pull/98013 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] CTAD: use index and depth to retrieve template parameter for TemplateParamsReferencedInTemplateArgumentList (PR #98013)

2024-07-11 Thread Haojian Wu via cfe-commits
@@ -2653,20 +2653,34 @@ struct ConvertConstructorToDeductionGuideTransform { // Find all template parameters that appear in the given DeducedArgs. // Return the indices of the template parameters in the TemplateParams. SmallVector TemplateParamsReferencedInTemplateArgumentList(

[clang] [clang] CTAD: use index and depth to retrieve template parameter for TemplateParamsReferencedInTemplateArgumentList (PR #98013)

2024-07-11 Thread Haojian Wu via cfe-commits
https://github.com/hokein commented: Thanks for the review. https://github.com/llvm/llvm-project/pull/98013 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] CTAD: use index and depth to retrieve template parameter for TemplateParamsReferencedInTemplateArgumentList (PR #98013)

2024-07-11 Thread Haojian Wu via cfe-commits
@@ -99,3 +99,28 @@ BFoo b2(1.0, 2.0); // CHECK-NEXT: | | |-ParmVarDecl {{.*}} 'type-parameter-0-0' // CHECK-NEXT: | | `-ParmVarDecl {{.*}} 'type-parameter-0-0' // CHECK-NEXT: | `-CXXDeductionGuideDecl {{.*}} implicit used 'auto (double, double) -> Foo' implicit_instantiation +

[clang] [clang] CTAD: use index and depth to retrieve template parameter for TemplateParamsReferencedInTemplateArgumentList (PR #98013)

2024-07-11 Thread Haojian Wu via cfe-commits
@@ -2653,20 +2653,34 @@ struct ConvertConstructorToDeductionGuideTransform { // Find all template parameters that appear in the given DeducedArgs. // Return the indices of the template parameters in the TemplateParams. SmallVector TemplateParamsReferencedInTemplateArgumentList(

[clang] [clang] CTAD: use index and depth to retrieve template parameter for TemplateParamsReferencedInTemplateArgumentList (PR #98013)

2024-07-11 Thread Haojian Wu via cfe-commits
@@ -2653,20 +2653,34 @@ struct ConvertConstructorToDeductionGuideTransform { // Find all template parameters that appear in the given DeducedArgs. // Return the indices of the template parameters in the TemplateParams. SmallVector TemplateParamsReferencedInTemplateArgumentList(

[clang] [clang] CTAD: use index and depth to retrieve template parameter for TemplateParamsReferencedInTemplateArgumentList (PR #98013)

2024-07-11 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/98013 >From c9297f8abe8d480fdcd3ba6d6598268fef74ddb4 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Mon, 8 Jul 2024 13:19:13 +0200 Subject: [PATCH 1/3] [clang] CTAD: use index and depth to retrieve template parameters

[clang] [Clang] Extend lifetime bound analysis to support assignments (PR #96475)

2024-07-11 Thread Haojian Wu via cfe-commits
hokein wrote: > We're seeing some -Wdangling-assignment warnings after this change, and they > all seem to be false positives so far: https://crbug.com/350808950 It's not a > huge deal if there are just a few, but figured it's worth mentioning. Thanks for the report. That's interesting. Techni

[clang] [clang] CTAD: use index and depth to retrieve template parameter for TemplateParamsReferencedInTemplateArgumentList (PR #98013)

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

[clang] [clang] Add option to opt out of the missing_dependent_template_keyword diagnostic (PR #98613)

2024-07-12 Thread Haojian Wu via cfe-commits
https://github.com/hokein created https://github.com/llvm/llvm-project/pull/98613 After commit ce4aada6e2135e29839f672a6599db628b53295d, we observed many warnings in our internal codebase. It is infeasible to fix all at once. Currently, there is no way to disable this warning. This patch pro

[clang] [clang] Add option to opt out of the missing_dependent_template_keyword diagnostic (PR #98613)

2024-07-12 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/98613 >From d22741375619b2b134509049aad7958348abcc30 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Fri, 12 Jul 2024 12:26:07 +0200 Subject: [PATCH 1/2] [clang] Allow to opt out the missing_dependent_template_keyword

[clang] [clang] Add option to opt out of the missing_dependent_template_keyword diagnostic (PR #98613)

2024-07-12 Thread Haojian Wu via cfe-commits
hokein wrote: > Reasonable, LGTM. Perhaps a release note should be added? Thanks for the review. Done. https://github.com/llvm/llvm-project/pull/98613 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listi

[clang] [clang] Add option to opt out of the missing_dependent_template_keyword diagnostic (PR #98613)

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

[clang] [clang] Add option to opt out of the missing_dependent_template_keyword diagnostic (PR #98613)

2024-07-13 Thread Haojian Wu via cfe-commits
hokein wrote: It does filter out the `missing-dependent-template-keyword` warnings, but doesn't fix the absl case. With https://github.com/llvm/llvm-project/commit/ce4aada6e2135e29839f672a6599db628b53295d, there is a behavior change in clang. Clang reject the following code which was accepte

[clang] [clang] Refactor: Move CTAD code from SemaTemplate.cpp to a dedicated file, NFC (PR #98524)

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

[clang] [libcxx] [llvm] Reapply "[Clang] Implement resolution for CWG1835 (#92957)" (PR #98547)

2024-07-15 Thread Haojian Wu via cfe-commits
hokein wrote: > @pranavk see #98613. > > edit: sorry, the error recovery that is currently performed will not detect > cases where the template argument list does not contain a a type. i can look > into this monday. Some analysis: given the example `this->StorageT` where `I` is an `int`, the

[clang] [libcxx] [llvm] Reapply "[Clang] Implement resolution for CWG1835 (#92957)" (PR #98547)

2024-07-15 Thread Haojian Wu via cfe-commits
hokein wrote: Summaries of changes after this patch: 1) for type template parameters and template template parameters, clang emits a warning, which can be suppressed by `-Wno-missing-dependent-templat-keyword` (after #98613); 2) for non-type template parameters, clang emits a hard `no_member`

[clang] [libcxx] [llvm] Reapply "[Clang] Implement resolution for CWG1835 (#92957)" (PR #98547)

2024-07-15 Thread Haojian Wu via cfe-commits
hokein wrote: @sdkrystian, I think we need to temporarily revert your patch (and sorry for that), as there is no way to fully preserve the old behavior of clang (our integration has been blocking since last week, and I think other large projects may encounter this issue as well): - The `-Wno-

[clang] [clang] CTAD: fix the aggregate deduction guide for alias templates. (PR #90894)

2024-05-02 Thread Haojian Wu via cfe-commits
https://github.com/hokein created https://github.com/llvm/llvm-project/pull/90894 For alias templates, our current way of constructing their aggregate deduction guides deviates from the standard approach. We should align it with how we handle implicit deduction guides. This patch has a refact

[clang] [clang] CTAD: fix the aggregate deduction guide for alias templates. (PR #90894)

2024-05-02 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/90894 >From 67b790e8a0e3f86155c2569373ced29ddd61c16b Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Thu, 2 May 2024 21:06:15 +0200 Subject: [PATCH 1/2] [clang] CTAD: fix the aggregate deduction guide for alias templat

[clang] [clang] CTAD: fix the aggregate deduction guide for alias templates. (PR #90894)

2024-05-02 Thread Haojian Wu via cfe-commits
@@ -2803,7 +2803,207 @@ getRHSTemplateDeclAndArgs(Sema &SemaRef, TypeAliasTemplateDecl *AliasTemplate) { return {Template, AliasRhsTemplateArgs}; } -// Build deduction guides for a type alias template. +// Build deduction guides for a type alias template from the given unde

[clang] [clang-tools-extra] [clang] Don't preserve the typo expr in the recovery expr for invalid VarDecls (PR #90948)

2024-05-03 Thread Haojian Wu via cfe-commits
https://github.com/hokein created https://github.com/llvm/llvm-project/pull/90948 With the commit d5308949cf884d8e4b971d51a8b4f73584c4adec, we now preserve the initializer for invalid decls with the recovery-expr. However there is a chance that the original init expr is a typo-expr, we should

[clang] [clang] CTAD: fix the aggregate deduction guide for alias templates. (PR #90894)

2024-05-03 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/90894 >From 40365147f7aabeaaefd7e9bf6f2b96d6f7135992 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Fri, 3 May 2024 10:53:54 +0200 Subject: [PATCH 1/2] Refactor: Extract the core deduction-guide construction implement

[clang] [clang] CTAD: fix the aggregate deduction guide for alias templates. (PR #90894)

2024-05-03 Thread Haojian Wu via cfe-commits
@@ -2803,7 +2803,207 @@ getRHSTemplateDeclAndArgs(Sema &SemaRef, TypeAliasTemplateDecl *AliasTemplate) { return {Template, AliasRhsTemplateArgs}; } -// Build deduction guides for a type alias template. +// Build deduction guides for a type alias template from the given unde

[clang] [clang] CTAD: fix the aggregate deduction guide for alias templates. (PR #90894)

2024-05-03 Thread Haojian Wu via cfe-commits
@@ -2803,7 +2803,207 @@ getRHSTemplateDeclAndArgs(Sema &SemaRef, TypeAliasTemplateDecl *AliasTemplate) { return {Template, AliasRhsTemplateArgs}; } -// Build deduction guides for a type alias template. +// Build deduction guides for a type alias template from the given unde

[clang] [clang] CTAD: fix the aggregate deduction guide for alias templates. (PR #90894)

2024-05-03 Thread Haojian Wu via cfe-commits
@@ -261,6 +261,13 @@ AG ag = {1}; // CHECK: | `-BuiltinType {{.*}} 'int' // CHECK: `-ParmVarDecl {{.*}} 'int' +template +using BG = G; +BG bg = {1.0}; +// CHECK-LABEL: Dumping +// CHECK: FunctionTemplateDecl hokein wrote: It is not possible to use the `

[clang] [clang] CTAD: fix the aggregate deduction guide for alias templates. (PR #90894)

2024-05-03 Thread Haojian Wu via cfe-commits
@@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++2a -verify -ast-dump -ast-dump-decl-types -ast-dump-filter "deduction guide" %s | FileCheck %s --strict-whitespace +// RUN: %clang_cc1 -std=c++2a -verify -ast-dump -ast-dump-decl-types -Wno-c++11-narrowing -ast-dump-filter "deduction g

[clang] [clang] CTAD: fix the aggregate deduction guide for alias templates. (PR #90894)

2024-05-03 Thread Haojian Wu via cfe-commits
@@ -2803,7 +2803,207 @@ getRHSTemplateDeclAndArgs(Sema &SemaRef, TypeAliasTemplateDecl *AliasTemplate) { return {Template, AliasRhsTemplateArgs}; } -// Build deduction guides for a type alias template. +// Build deduction guides for a type alias template from the given unde

[clang] [clang-tools-extra] [clang] Don't preserve the typo expr in the recovery expr for invalid VarDecls (PR #90948)

2024-05-06 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/90948 >From 2f29011bae5bf1b285c2ab1700c887d74eaec4b0 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Fri, 3 May 2024 10:06:39 +0200 Subject: [PATCH 1/2] [clang] Don't preserve the typo expr in the recovery expr for inv

<    19   20   21   22   23   24   25   26   27   28   >