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

[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 {{.*}} 'a

[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 &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: 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 a

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

[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 {{.*}} 'a

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

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

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

[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
@@ -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
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 https://lists.llvm.o

[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 https://lists.llvm.

[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
@@ -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
@@ -2583,11 +2580,27 @@ struct ConvertConstructorToDeductionGuideTransform { //-- The types of the function parameters are those of the constructor. for (auto *OldParam : TL.getParams()) { - ParmVarDecl *NewParam = - transformFunctionTypeParam(OldPara

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

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

[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 &OS, ConceptName.printName(OS, Policy); if (hasExplicitTemplateArgs()) { OS << "<"; +bool First = true; // FIXME: Find corresponding parameter for argument -for (auto &ArgLoc : ArgsAsWritte

[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). https://gi

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

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

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

[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
@@ -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
@@ -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. https:/

[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 &Self, TypeTrait BTT, const TypeSourceI tok::kw___is_pointer_interconvertible_base_of); return Self.IsPointerInterconvertibleBaseOf(Lhs, Rhs); + } + case BTT_IsDeducible: { +

[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 &SemaRef, 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]

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

[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. > Thanks!

[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 &SemaRef, 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]

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

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

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

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

[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-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 https://lists.llvm.org/cgi-bin/mailman/listinfo/cf

[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`). https://github.com/llvm/

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

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

[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
@@ -2718,6 +2718,36 @@ bool QualType::isTriviallyCopyableType(const ASTContext &Context) const { /*IsCopyConstructible=*/false); } +bool QualType::isBitwiseCloneableType(const ASTContext & Context) const { + QualType CanonicalType = getCa

[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 &Context) const { /*IsCopyConstructible=*/false); } +bool QualType::isBitwiseCloneableType(const ASTContext & Context) const { + QualType CanonicalType = getCa

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

[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] [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 ___ cfe-com

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

[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
@@ -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 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-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] 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: 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 (type-parameter-0-0..

[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 https://lists.llvm.org/cgi-bin/mailman/listi

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

[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-27 Thread Haojian Wu via cfe-commits
https://github.com/hokein edited https://github.com/llvm/llvm-project/pull/92721 ___ 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-27 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/92721 >From e2dc2cecee5891b88ff4c2e473220cc9fd36df34 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Sun, 19 May 2024 22:47:14 +0200 Subject: [PATCH 1/2] [Sema] Fix an out-of-bounds crash when diagnosing bad conversion

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

2024-05-27 Thread Haojian Wu via cfe-commits
@@ -11298,8 +11298,14 @@ static void DiagnoseBadConversion(Sema &S, OverloadCandidate *Cand, Expr *FromExpr = Conv.Bad.FromExpr; QualType FromTy = Conv.Bad.getFromType(); QualType ToTy = Conv.Bad.getToType(); - SourceRange ToParamRange = - !isObjectArgument ? Fn->g

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

2024-05-27 Thread Haojian Wu via cfe-commits
@@ -11298,8 +11298,14 @@ static void DiagnoseBadConversion(Sema &S, OverloadCandidate *Cand, Expr *FromExpr = Conv.Bad.FromExpr; QualType FromTy = Conv.Bad.getFromType(); QualType ToTy = Conv.Bad.getToType(); - SourceRange ToParamRange = - !isObjectArgument ? Fn->g

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

2024-05-27 Thread Haojian Wu via cfe-commits
https://github.com/hokein closed https://github.com/llvm/llvm-project/pull/92721 ___ 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-27 Thread Haojian Wu via cfe-commits
hokein wrote: The crash is already fixed by https://github.com/llvm/llvm-project/commit/7a28a5b3fee6c78ad59af79a3d03c00db153c49f https://github.com/llvm/llvm-project/pull/92721 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm

[clang] 31bb759 - Fix an unused variable and -Wswitch warning after a42e515e3a9f3bb4e44389c097b89104d95b9b29

2024-08-05 Thread Haojian Wu via cfe-commits
Author: Haojian Wu Date: 2024-08-05T14:05:14+02:00 New Revision: 31bb759d78576bec4c5b844edd52686eb6cc9fc3 URL: https://github.com/llvm/llvm-project/commit/31bb759d78576bec4c5b844edd52686eb6cc9fc3 DIFF: https://github.com/llvm/llvm-project/commit/31bb759d78576bec4c5b844edd52686eb6cc9fc3.diff LO

[clang] 69c6a3f - More -Wswitch warning fixes for a42e515e3a9f3bb4e44389c097b89104d95b9b29

2024-08-05 Thread Haojian Wu via cfe-commits
Author: Haojian Wu Date: 2024-08-05T14:21:34+02:00 New Revision: 69c6a3faafe8fa3fa8d7554e0ebe64aae3c3d10b URL: https://github.com/llvm/llvm-project/commit/69c6a3faafe8fa3fa8d7554e0ebe64aae3c3d10b DIFF: https://github.com/llvm/llvm-project/commit/69c6a3faafe8fa3fa8d7554e0ebe64aae3c3d10b.diff LO

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

2024-08-07 Thread Haojian Wu via cfe-commits
https://github.com/hokein commented: 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), wh

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

2024-08-07 Thread Haojian Wu via cfe-commits
@@ -944,12 +950,63 @@ 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-08-07 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-08-07 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-08-07 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-08-07 Thread Haojian Wu via cfe-commits
@@ -1388,6 +1695,33 @@ 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-08-07 Thread Haojian Wu via cfe-commits
@@ -944,12 +950,63 @@ 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-08-07 Thread Haojian Wu via cfe-commits
@@ -944,12 +950,63 @@ 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-08-07 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-08-07 Thread Haojian Wu via cfe-commits
@@ -944,12 +950,63 @@ 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-08-07 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-08-07 Thread Haojian Wu via cfe-commits
@@ -1388,6 +1695,33 @@ void Sema::DeclareImplicitDeductionGuides(TemplateDecl *Template, if (!AddedAny) Transform.buildSimpleDeductionGuide(std::nullopt); + // FIXME: Handle explicit deduction guides from inherited constructors hokein wrote: I think i

[clang-tools-extra] fd598e1 - [clangd] Bring back early-claim approach to fix a selection-tree regression.

2022-01-18 Thread Haojian Wu via cfe-commits
Author: Haojian Wu Date: 2022-01-18T10:22:26+01:00 New Revision: fd598e185972f76a50c45e1402ab3b0fd70664b9 URL: https://github.com/llvm/llvm-project/commit/fd598e185972f76a50c45e1402ab3b0fd70664b9 DIFF: https://github.com/llvm/llvm-project/commit/fd598e185972f76a50c45e1402ab3b0fd70664b9.diff LO

[clang-tools-extra] 6c78703 - [AST] Fix the incorrect auto-keyword loc for constrained auto type loc.

2022-01-19 Thread Haojian Wu via cfe-commits
Author: Haojian Wu Date: 2022-01-19T14:18:38+01:00 New Revision: 6c78703e3abcd9c76aefbf066869fe6a32d59516 URL: https://github.com/llvm/llvm-project/commit/6c78703e3abcd9c76aefbf066869fe6a32d59516 DIFF: https://github.com/llvm/llvm-project/commit/6c78703e3abcd9c76aefbf066869fe6a32d59516.diff LO

[clang-tools-extra] 55b702c - [clangd] NFC, emit source ranges in selection debug messages.

2022-01-19 Thread Haojian Wu via cfe-commits
Author: Haojian Wu Date: 2022-01-19T16:06:58+01:00 New Revision: 55b702c37b7e8b5fde04b6a60b5bb12806bdb697 URL: https://github.com/llvm/llvm-project/commit/55b702c37b7e8b5fde04b6a60b5bb12806bdb697 DIFF: https://github.com/llvm/llvm-project/commit/55b702c37b7e8b5fde04b6a60b5bb12806bdb697.diff LO

[clang-tools-extra] 4cb1686 - [clangd] Fix a selection tree crash for unmatched-bracket code.

2022-01-27 Thread Haojian Wu via cfe-commits
Author: Haojian Wu Date: 2022-01-27T21:21:40+01:00 New Revision: 4cb1686bfe8ef847b583922bb5650c33453ad096 URL: https://github.com/llvm/llvm-project/commit/4cb1686bfe8ef847b583922bb5650c33453ad096 DIFF: https://github.com/llvm/llvm-project/commit/4cb1686bfe8ef847b583922bb5650c33453ad096.diff LO

[clang-tools-extra] 0cf75aa - [clangd] Enable hover on character literal.

2022-01-27 Thread Haojian Wu via cfe-commits
Author: Haojian Wu Date: 2022-01-27T21:22:03+01:00 New Revision: 0cf75aac42eb6bd800405d152dfe7414a9ab6d99 URL: https://github.com/llvm/llvm-project/commit/0cf75aac42eb6bd800405d152dfe7414a9ab6d99 DIFF: https://github.com/llvm/llvm-project/commit/0cf75aac42eb6bd800405d152dfe7414a9ab6d99.diff LO

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