[clang] [clang] CTAD alias: Fix missing template arg packs during the transformation (PR #92535)

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

[clang] [Sema] Fix an out-of-bounds crash when diagnosing bad conversion for a function with a parameter pack. (PR #92721)

2024-05-20 Thread Haojian Wu via cfe-commits
https://github.com/hokein created https://github.com/llvm/llvm-project/pull/92721 None >From 2aa2caf15282d28e9fda99d51776d842d3d57e95 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Sun, 19 May 2024 22:47:14 +0200 Subject: [PATCH] [Sema] Fix an out-of-bounds crash when diagnosing bad

[clang] [clang][AST] Fix end location of DeclarationNameInfo on instantiated methods (PR #92654)

2024-05-20 Thread Haojian Wu via cfe-commits
https://github.com/hokein approved this pull request. nit: add a note in `clang/docs/ReleaseNotes.rst` https://github.com/llvm/llvm-project/pull/92654 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [clang] CTAD alias: Fix missing template arg packs during the transformation (PR #92535)

2024-05-17 Thread Haojian Wu via cfe-commits
https://github.com/hokein created https://github.com/llvm/llvm-project/pull/92535 clang rejects some valid code (see testcases) because of an incorrect transformed deduction guides. This patch fixes it. We miss the template argument packs during the transformation (`auto

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

2024-05-17 Thread Haojian Wu via cfe-commits
@@ -0,0 +1,41 @@ +// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify %s + +// Scalar types are bitwise clonable. +static_assert(__is_bitwise_cloneable(int)); +static_assert(__is_bitwise_cloneable(int*)); +// array +static_assert(__is_bitwise_cloneable(int[10])); + +// non-scalar

[clang] [clang] CTAD alias: Emit a more descriptive diagnostic message when is_deducible constraint is evaluated to false. (PR #92389)

2024-05-17 Thread Haojian Wu via cfe-commits
hokein wrote: Thanks @mizvekov for the quick fix. https://github.com/llvm/llvm-project/pull/92389 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] CTAD alias: Emit a more descriptive diagnostic message when is_deducible constraint is evaluated to false. (PR #92389)

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

[clang] [clang] CTAD alias: Emit a more descriptive diagnostic message when is_deducible constraint is evaluated to false. (PR #92389)

2024-05-16 Thread Haojian Wu via cfe-commits
@@ -111,7 +111,7 @@ struct Foo { template using Bar = Foo; // expected-note {{candidate template ignored: couldn't infer template argument 'X'}} \ // expected-note {{candidate template ignored: constraints not satisfied [with X = int]}} \ -

[clang] [clang] CTAD alias: Emit a more descriptive diagnostic message when is_deducible constraint is evaluated to false. (PR #92389)

2024-05-16 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/92389 >From ada7f47eae6ef66a51cdeb91ab5aca0e188e5704 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Thu, 16 May 2024 14:05:57 +0200 Subject: [PATCH] [clang] CTAD alias: Emit a more descriptive diagnostic message when

[clang] [clang] CTAD alias: Emit a more descriptive diagnostic message when is_deducible constraint is evaluated to false. (PR #92389)

2024-05-16 Thread Haojian Wu via cfe-commits
https://github.com/hokein created https://github.com/llvm/llvm-project/pull/92389 Fixes https://github.com/llvm/llvm-project/issues/92225 >From 20294489121be7a68519280da8e144c2b9be398c Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Thu, 16 May 2024 14:05:57 +0200 Subject: [PATCH] [clang]

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

2024-05-16 Thread Haojian Wu via cfe-commits
https://github.com/hokein closed 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/cfe-commits

[clang] [AST] RecursiveASTVisitor: Don't traverse the alias deduction guides in the default mode. (PR #91454)

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

[clang] [clang-tools-extra] [clang] Fix CXXNewExpr end source location for 'new struct S' (PR #92266)

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

[clang] [clang-tools-extra] [clang] Fix CXXNewExpr end source location for 'new struct S' (PR #92266)

2024-05-16 Thread Haojian Wu via cfe-commits
@@ -583,3 +583,8 @@ void NonADLCall3() { f(x); } } // namespace test_adl_call_three + hokein wrote: nit: wrap the code within `namespace GH35300 { ...}`. https://github.com/llvm/llvm-project/pull/92266 ___

[clang] [clang-tools-extra] [clang] Fix CXXNewExpr end source location for 'new struct S' (PR #92266)

2024-05-16 Thread Haojian Wu via cfe-commits
https://github.com/hokein approved this pull request. thanks, still good. https://github.com/llvm/llvm-project/pull/92266 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [AST] RecursiveASTVisitor: Don't traverse the alias deduction guides in the default mode. (PR #91454)

2024-05-16 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/91454 >From e560fe2bf2d4bdc07a71682aa4d3a4bee8730b80 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Wed, 8 May 2024 12:11:10 +0200 Subject: [PATCH 1/2] [AST] RecursiveASTVisitor: Don't traverse the alias deduction

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

2024-05-16 Thread Haojian Wu via cfe-commits
@@ -0,0 +1,41 @@ +// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify %s + +// Scalar types are bitwise clonable. +static_assert(__is_bitwise_cloneable(int)); +static_assert(__is_bitwise_cloneable(int*)); +// array +static_assert(__is_bitwise_cloneable(int[10])); + +// non-scalar

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

2024-05-16 Thread Haojian Wu via cfe-commits
@@ -0,0 +1,41 @@ +// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify %s + +// Scalar types are bitwise clonable. +static_assert(__is_bitwise_cloneable(int)); +static_assert(__is_bitwise_cloneable(int*)); +// array +static_assert(__is_bitwise_cloneable(int[10])); + +// non-scalar

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

2024-05-16 Thread Haojian Wu via cfe-commits
@@ -2718,6 +2718,36 @@ bool QualType::isTriviallyCopyableType(const ASTContext ) const { /*IsCopyConstructible=*/false); } +bool QualType::isBitwiseCloneableType(const ASTContext & Context) const { + QualType CanonicalType =

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

2024-05-16 Thread Haojian Wu via cfe-commits
@@ -2718,6 +2718,36 @@ bool QualType::isTriviallyCopyableType(const ASTContext ) const { /*IsCopyConstructible=*/false); } +bool QualType::isBitwiseCloneableType(const ASTContext & Context) const { + QualType CanonicalType =

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

2024-05-16 Thread Haojian Wu via cfe-commits
https://github.com/hokein commented: thanks for the 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] Implement a bitwise_copyable builtin type trait. (PR #86512)

2024-05-16 Thread Haojian Wu via cfe-commits
@@ -3958,6 +3958,50 @@ Note that the `size` argument must be a compile time constant. Note that this intrinsic cannot yet be called in a ``constexpr`` context. +``__is_bitwise_cloneable`` +- + +A type trait is used to check whether a type can be

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

2024-05-16 Thread Haojian Wu via cfe-commits
https://github.com/hokein edited 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] Implement a bitwise_copyable builtin type trait. (PR #86512)

2024-05-16 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/86512 >From 10d06e728d836f4aaad7dbf1a6b06b57e4092bb1 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Mon, 25 Mar 2024 15:10:51 +0100 Subject: [PATCH 1/3] [clang] Implement a bitwise_copyable builtin type trait. This

[clang] [clang-tools-extra] [clang] Fix CXXNewExpr end source location for 'new struct S' (PR #92266)

2024-05-15 Thread Haojian Wu via cfe-commits
@@ -0,0 +1,5 @@ +// RUN: %clang_cc1 -ast-dump %s 2>&1 | FileCheck %s hokein wrote: For ast-dump lit tests, we usually place them in `clang/test/AST/` dir with name `ast-dump*.cpp` (or we can add it to the existing `ast-dump-expr.cpp`).

[clang] [clang-tools-extra] [clang] Fix CXXNewExpr end source location for 'new struct S' (PR #92266)

2024-05-15 Thread Haojian Wu via cfe-commits
https://github.com/hokein approved this pull request. thanks, this looks good to me, a small nit. https://github.com/llvm/llvm-project/pull/92266 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [clang-tools-extra] [clang] Fix CXXNewExpr end source location for 'new struct S' (PR #92266)

2024-05-15 Thread Haojian Wu via cfe-commits
https://github.com/hokein edited https://github.com/llvm/llvm-project/pull/92266 ___ 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-05-15 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/89358 >From 659cf5b5c1216ab9f6a8dbb63b4f93de41cd173d Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Fri, 19 Apr 2024 10:54:12 +0200 Subject: [PATCH 1/2] [clang] CTAD: implement the missing IsDeducible constraint for

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

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

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

2024-05-15 Thread Haojian Wu via cfe-commits
https://github.com/hokein edited 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/cfe-commits

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

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

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

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

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

2024-05-15 Thread Haojian Wu via cfe-commits
@@ -2774,6 +2775,41 @@ Expr *transformRequireClause(Sema , FunctionTemplateDecl *FTD, return E.getAs(); } +// Build the associated constraints for the alias deduction guides. +// C++ [over.match.class.deduct]p3.3: +// The associated constraints ([temp.constr.decl]) are

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

2024-05-15 Thread Haojian Wu via cfe-commits
hokein wrote: Thanks for the review. > I'll approve that modulo nit but i think we want > > * An issue to keep track of the duplication in > `FinishTemplateArgumentDeduction` Filed #92224. > * A follow up PR to improve diagnostics Filed #92225, and assigned to myself. Will do it. >

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

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

[clang] [clang-tools-extra] [Clang] Retain the angle loci for invented template parameters of constraints (PR #92104)

2024-05-14 Thread Haojian Wu via cfe-commits
https://github.com/hokein approved this pull request. Thanks! https://github.com/llvm/llvm-project/pull/92104 ___ 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-05-13 Thread Haojian Wu via cfe-commits
@@ -2774,6 +2775,41 @@ Expr *transformRequireClause(Sema , FunctionTemplateDecl *FTD, return E.getAs(); } +// Build the associated constraints for the alias deduction guides. +// C++ [over.match.class.deduct]p3.3: +// The associated constraints ([temp.constr.decl]) are

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

2024-05-13 Thread Haojian Wu via cfe-commits
@@ -6116,6 +6116,17 @@ static bool EvaluateBinaryTypeTrait(Sema , TypeTrait BTT, const TypeSourceI tok::kw___is_pointer_interconvertible_base_of); return Self.IsPointerInterconvertibleBaseOf(Lhs, Rhs); + } + case BTT_IsDeducible: { +if

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

2024-05-13 Thread Haojian Wu via cfe-commits
@@ -27,7 +27,8 @@ enum TypeTrait { , #define TYPE_TRAIT_2(Spelling, Name, Key) BTT_##Name, #include "clang/Basic/TokenKinds.def" - BTT_Last = UTT_Last // BTT_Last == last BTT_XX in the enum. + BTT_Last = UTT_Last hokein wrote: Reverted the change.

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

2024-05-13 Thread Haojian Wu via cfe-commits
@@ -18,6 +18,7 @@ #include "clang/AST/ExprCXX.h" #include "clang/AST/RecursiveASTVisitor.h" #include "clang/AST/TemplateName.h" +#include "clang/AST/Type.h" hokein wrote: Done. https://github.com/llvm/llvm-project/pull/89358

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

2024-05-13 Thread Haojian Wu via cfe-commits
@@ -190,13 +196,15 @@ template struct Foo { Foo(T); }; template using AFoo = Foo; template concept False = false; -template using BFoo = AFoo; +template +using BFoo = AFoo; // expected-note {{candidate template ignored: constraints not satisfied [with V = int]}} \ +

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

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

[clang] [clang] CTAD alias: fix the transformation for the require-clause expr (PR #90961)

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

[clang] [clang] CTAD alias: fix the transformation for the require-clause expr (PR #90961)

2024-05-13 Thread Haojian Wu via cfe-commits
hokein wrote: I'm merging it now (happy to address any post-comments). https://github.com/llvm/llvm-project/pull/90961 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] CTAD alias: fix the transformation for the require-clause expr (PR #90961)

2024-05-13 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/90961 >From 0bdb18c0ffc37b38e81487b45e0e00e4480473aa Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Fri, 3 May 2024 11:04:21 +0200 Subject: [PATCH 1/2] [clang] CTAD alias: refine the transformation for the

[clang] 2b38688 - Reland: [clang] Use getDefaultArgRange instead of getDefaultArg to retrieve

2024-05-11 Thread Haojian Wu via cfe-commits
Author: Haojian Wu Date: 2024-05-11T22:07:21+02:00 New Revision: 2b386888b78327db4906b12401e1a89438471548 URL: https://github.com/llvm/llvm-project/commit/2b386888b78327db4906b12401e1a89438471548 DIFF: https://github.com/llvm/llvm-project/commit/2b386888b78327db4906b12401e1a89438471548.diff

[clang] [clang] CTAD alias: fix the transformation for the require-clause expr (PR #90961)

2024-05-10 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/90961 >From 9cc438e2def2fa98af71ba79eb82e033f3d5905a Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Fri, 3 May 2024 11:04:21 +0200 Subject: [PATCH] [clang] CTAD alias: refine the transformation for the require-clause

[clang] [clang] CTAD alias: fix the transformation for the require-clause expr (PR #90961)

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

[clang] [llvm] [AST] Print the separator "," for template arguments in ConceptReference::print (PR #91750)

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

[clang] [llvm] [AST] Print the separator "," for template arguments in ConceptReference::print (PR #91750)

2024-05-10 Thread Haojian Wu via cfe-commits
@@ -24,6 +24,7 @@ add_clang_unittest(ASTTests CommentLexer.cpp CommentParser.cpp CommentTextTest.cpp + ConceptPrinterTest.cpp hokein wrote: Done (we're not required to update gn build files, and there's a bot that can automate the porting).

[clang] [llvm] [AST] Print the separator "," for template arguments in ConceptReference::print (PR #91750)

2024-05-10 Thread Haojian Wu via cfe-commits
@@ -106,9 +106,15 @@ void ConceptReference::print(llvm::raw_ostream , ConceptName.printName(OS, Policy); if (hasExplicitTemplateArgs()) { OS << "<"; +bool First = true; // FIXME: Find corresponding parameter for argument -for (auto :

[clang] [llvm] [AST] Print the separator "," for template arguments in ConceptReference::print (PR #91750)

2024-05-10 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/91750 >From e7b23e02e9b4c98d9e24dd1debcdefada7a16004 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Fri, 10 May 2024 16:31:20 +0200 Subject: [PATCH 1/2] [AST] Print the separator , for template arguments in

[clang] [AST] Print the separator "," for template arguments in ConceptReference::print (PR #91750)

2024-05-10 Thread Haojian Wu via cfe-commits
https://github.com/hokein created https://github.com/llvm/llvm-project/pull/91750 None >From e7b23e02e9b4c98d9e24dd1debcdefada7a16004 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Fri, 10 May 2024 16:31:20 +0200 Subject: [PATCH] [AST] Print the separator , for template arguments in

[clang] [Clang][Sema] Revise the transformation of CTAD parameters of nested class templates (PR #91628)

2024-05-10 Thread Haojian Wu via cfe-commits
@@ -2583,11 +2580,27 @@ struct ConvertConstructorToDeductionGuideTransform { //-- The types of the function parameters are those of the constructor. for (auto *OldParam : TL.getParams()) { - ParmVarDecl *NewParam = -

[clang] [Clang][Sema] Revise the transformation of CTAD parameters of nested class templates (PR #91628)

2024-05-10 Thread Haojian Wu via cfe-commits
@@ -84,3 +84,17 @@ nested_init_list::concept_fail nil_invalid{1, ""}; // expected-note@#INIT_LIST_INNER_INVALID {{candidate template ignored: substitution failure [with F = const char *]: constraints not satisfied for class template 'concept_fail' [with F = const char *]}} //

[clang] [Clang][Sema] Revise the transformation of CTAD parameters of nested class templates (PR #91628)

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

[clang] [Clang][Sema] Revise the transformation of CTAD parameters of nested class templates (PR #91628)

2024-05-10 Thread Haojian Wu via cfe-commits
https://github.com/hokein commented: The fix looks good to me, and thanks for the comprehensive explanation in the description. https://github.com/llvm/llvm-project/pull/91628 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

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

2024-05-08 Thread Haojian Wu via cfe-commits
https://github.com/hokein commented: Replied some review comments. I haven't updated the code yet (plan to do it after #90961) https://github.com/llvm/llvm-project/pull/89358 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

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

2024-05-08 Thread Haojian Wu via cfe-commits
@@ -3307,6 +3341,58 @@ Sema::DeduceTemplateArguments(VarTemplatePartialSpecializationDecl *Partial, return ::DeduceTemplateArguments(*this, Partial, TemplateArgs, Info); } +TemplateDeductionResult +Sema::DeduceTemplateArgumentsFromType(TemplateDecl *TD, QualType FromType,

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

2024-05-08 Thread Haojian Wu via cfe-commits
@@ -190,13 +196,15 @@ template struct Foo { Foo(T); }; template using AFoo = Foo; template concept False = false; -template using BFoo = AFoo; +template +using BFoo = AFoo; // expected-note {{candidate template ignored: constraints not satisfied [with V = int]}} \ +

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

2024-05-08 Thread Haojian Wu via cfe-commits
@@ -27,7 +27,8 @@ enum TypeTrait { , #define TYPE_TRAIT_2(Spelling, Name, Key) BTT_##Name, #include "clang/Basic/TokenKinds.def" - BTT_Last = UTT_Last // BTT_Last == last BTT_XX in the enum. + BTT_Last = UTT_Last hokein wrote: oops, this is not intended.

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

2024-05-08 Thread Haojian Wu via cfe-commits
@@ -3239,6 +3239,40 @@ static TemplateDeductionResult FinishTemplateArgumentDeduction( return TemplateDeductionResult::Success; } +/// Complete template argument deduction for DeduceTemplateArgumentsFromType. +/// FIXME: this is mostly duplicated with the above two

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

2024-05-08 Thread Haojian Wu via cfe-commits
https://github.com/hokein edited 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/cfe-commits

[clang] [AST] RecursiveASTVisitor: Don't traverse the alias deduction guides in the default mode. (PR #91454)

2024-05-08 Thread Haojian Wu via cfe-commits
https://github.com/hokein created https://github.com/llvm/llvm-project/pull/91454 By default (`shouldVisitImplicitCode()` returns `false`), RAV should not traverse AST nodes that are not spelled in the source code. Deduction guides for alias templates are always synthesized, so they should

[clang] [Coro] Relax a debug-info test (PR #91401)

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

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

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

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

2024-05-07 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 {{.*}} implicit +// CHECK: |-CXXDeductionGuideDecl {{.*}}

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

2024-05-07 Thread Haojian Wu via cfe-commits
hokein wrote: > > I agree with you -- having a well-described diagnostic message is better > > and clearer. I'm happy to improve it once we settle on the final > > implementation approach (the current diagnostic because > > '__is_deducible(AFoo, Foo)' evaluated to false seems okay to me. GCC

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

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

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

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

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

2024-05-07 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 {{.*}} implicit +// CHECK: |-CXXDeductionGuideDecl {{.*}}

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

2024-05-07 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/3] Refactor: Extract the core deduction-guide construction

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

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

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

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

[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
@@ -13530,9 +13530,12 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init, bool DirectInit) { } if (VDecl->isInvalidDecl()) { -CorrectDelayedTyposInExpr(Init, VDecl); +ExprResult Res = CorrectDelayedTyposInExpr(Init, VDecl); +std::vector SubExprs;

[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

[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 , TypeAliasTemplateDecl *AliasTemplate) { return {Template, AliasRhsTemplateArgs}; } -// Build deduction guides for a type alias template. +// Build deduction guides for a type alias template from the given underlying

[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

[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
@@ -2803,7 +2803,207 @@ getRHSTemplateDeclAndArgs(Sema , TypeAliasTemplateDecl *AliasTemplate) { return {Template, AliasRhsTemplateArgs}; } -// Build deduction guides for a type alias template. +// Build deduction guides for a type alias template from the given underlying

[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 , TypeAliasTemplateDecl *AliasTemplate) { return {Template, AliasRhsTemplateArgs}; } -// Build deduction guides for a type alias template. +// Build deduction guides for a type alias template from the given underlying

[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

[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-02 Thread Haojian Wu via cfe-commits
@@ -2803,7 +2803,207 @@ getRHSTemplateDeclAndArgs(Sema , TypeAliasTemplateDecl *AliasTemplate) { return {Template, AliasRhsTemplateArgs}; } -// Build deduction guides for a type alias template. +// Build deduction guides for a type alias template from the given underlying

[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

[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

[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] [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
@@ -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 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

[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

[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,

[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] [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] 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 >

[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-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

[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

[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

[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

  1   2   3   4   5   6   7   8   9   10   >