[clang] 7939312 - Fix -Wunused-variable in SemaAMDGPU.cpp in release build, NFC

2024-06-06 Thread Haojian Wu via cfe-commits
Author: Haojian Wu Date: 2024-06-06T15:48:23+02:00 New Revision: 79393124ff74aaaf6a43f7c88e67fd76a6e44239 URL: https://github.com/llvm/llvm-project/commit/79393124ff74aaaf6a43f7c88e67fd76a6e44239 DIFF: https://github.com/llvm/llvm-project/commit/79393124ff74aaaf6a43f7c88e67fd76a6e44239.diff LO

[clang] 6fe5428 - [Flang] Handle the newly-added "Reserved" FramePointerKind for 1a5239251ead73ee57f4e2f7fc93433ac7cf18b1

2024-06-07 Thread Haojian Wu via cfe-commits
Author: Haojian Wu Date: 2024-06-07T12:49:41+02:00 New Revision: 6fe5428ecbd18aa263417a244c0850b1271617c0 URL: https://github.com/llvm/llvm-project/commit/6fe5428ecbd18aa263417a244c0850b1271617c0 DIFF: https://github.com/llvm/llvm-project/commit/6fe5428ecbd18aa263417a244c0850b1271617c0.diff LO

[clang-tools-extra] [clangd] Use clang_target_link_libraries() for clang libs (PR #94937)

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

[clang] [Clang] Substitute for the type aliases inside of a CTAD guide (PR #94740)

2024-06-11 Thread Haojian Wu via cfe-commits
@@ -2220,23 +2220,103 @@ namespace { class ExtractTypeForDeductionGuide : public TreeTransform { llvm::SmallVectorImpl &MaterializedTypedefs; + ClassTemplateDecl *NestedPattern; + const MultiLevelTemplateArgumentList *OuterInstantiationArgs; public: typedef TreeTran

[clang] [Clang] Substitute for the type aliases inside of a CTAD guide (PR #94740)

2024-06-11 Thread Haojian Wu via cfe-commits
@@ -16,3 +16,73 @@ using T = A::B; using Copy = decltype(copy); using Copy = A::B; + +namespace GH94614 { + +template struct S {}; hokein wrote: I wonder whether it is feasible to add an ast-dump test for this issue, I find seeing and verifying the shape of

[clang] [Clang] Substitute for the type aliases inside of a CTAD guide (PR #94740)

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

[clang] [Clang] Substitute for the type aliases inside of a CTAD guide (PR #94740)

2024-06-11 Thread Haojian Wu via cfe-commits
https://github.com/hokein commented: Looks roughly good to me. https://github.com/llvm/llvm-project/pull/94740 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Substitute for the type aliases inside of a CTAD guide (PR #94740)

2024-06-11 Thread Haojian Wu via cfe-commits
@@ -2220,23 +2220,103 @@ namespace { class ExtractTypeForDeductionGuide : public TreeTransform { llvm::SmallVectorImpl &MaterializedTypedefs; + ClassTemplateDecl *NestedPattern; + const MultiLevelTemplateArgumentList *OuterInstantiationArgs; public: typedef TreeTran

[clang] [Clang] Substitute for the type aliases inside of a CTAD guide (PR #94740)

2024-06-11 Thread Haojian Wu via cfe-commits
@@ -2220,23 +2220,103 @@ namespace { class ExtractTypeForDeductionGuide : public TreeTransform { llvm::SmallVectorImpl &MaterializedTypedefs; + ClassTemplateDecl *NestedPattern; + const MultiLevelTemplateArgumentList *OuterInstantiationArgs; public: typedef TreeTran

[clang] [Clang] Substitute for the type aliases inside of a CTAD guide (PR #94740)

2024-06-11 Thread Haojian Wu via cfe-commits
@@ -2630,7 +2711,8 @@ struct ConvertConstructorToDeductionGuideTransform { ParmVarDecl *transformFunctionTypeParam( ParmVarDecl *OldParam, MultiLevelTemplateArgumentList &Args, - llvm::SmallVectorImpl &MaterializedTypedefs) { + llvm::SmallVectorImpl &Material

[clang] [Clang] Fix handling of brace ellison when building deduction guides (PR #94889)

2024-06-11 Thread Haojian Wu via cfe-commits
@@ -10918,22 +10944,24 @@ QualType Sema::DeduceTemplateSpecializationFromInitializer( if (!(RD->getDefinition() && RD->isAggregate())) return; QualType Ty = Context.getRecordType(RD); - SmallVector ElementTypes; - - InitListChecker CheckInitList(*

[clang] [Clang] Fix handling of brace ellison when building deduction guides (PR #94889)

2024-06-11 Thread Haojian Wu via cfe-commits
@@ -305,14 +305,32 @@ namespace { /// structured list even in 'verify only' mode, so that we can track which /// elements need 'empty' initializtion. class InitListChecker { +public: + struct CandidateParamTypesForAggregateDeduction { hokein wrote: nit: inste

[clang] [Clang] Fix handling of brace ellison when building deduction guides (PR #94889)

2024-06-11 Thread Haojian Wu via cfe-commits
@@ -10918,22 +10944,24 @@ QualType Sema::DeduceTemplateSpecializationFromInitializer( if (!(RD->getDefinition() && RD->isAggregate())) return; QualType Ty = Context.getRecordType(RD); - SmallVector ElementTypes; - - InitListChecker CheckInitList(*

[clang] [Clang] Fix handling of brace ellison when building deduction guides (PR #94889)

2024-06-11 Thread Haojian Wu via cfe-commits
@@ -335,3 +335,73 @@ namespace TTP { // CHECK-NEXT: `-TemplateArgument type 'T':'type-parameter-0-0'{{$}} // CHECK-NEXT:`-TemplateTypeParmType {{.+}} 'T' dependent depth 0 index 0{{$}} // CHECK-NEXT: `-TemplateTypeParm {{.+}} 'T'{{$}} + +namespace GH64625

[clang] [Clang] Fix handling of brace ellison when building deduction guides (PR #94889)

2024-06-11 Thread Haojian Wu via cfe-commits
@@ -335,3 +335,73 @@ namespace TTP { // CHECK-NEXT: `-TemplateArgument type 'T':'type-parameter-0-0'{{$}} // CHECK-NEXT:`-TemplateTypeParmType {{.+}} 'T' dependent depth 0 index 0{{$}} // CHECK-NEXT: `-TemplateTypeParm {{.+}} 'T'{{$}} + +namespace GH64625

[clang] [clang] Don't print extra space when dumping template names (PR #95213)

2024-06-12 Thread Haojian Wu via cfe-commits
https://github.com/hokein created https://github.com/llvm/llvm-project/pull/95213 None >From c5f5d784a8cab287d3ec826a2636874ad9498563 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Wed, 12 Jun 2024 11:24:10 +0200 Subject: [PATCH] [clang] Don't print extra blank when dump the template name. -

[clang] [clang] fix broken canonicalization of DeducedTemplateSpecializationType (PR #95202)

2024-06-12 Thread Haojian Wu via cfe-commits
https://github.com/hokein commented: good catch, the fix looks good to me overall, I will leave the final stamp to @ChuanqiXu9. (I agree that it would be nice to have a regression test if it is not too hard to reduce from libcxx) https://github.com/llvm/llvm-project/pull/95202 ___

[clang] [clang] Don't print extra space when dumping template names (PR #95213)

2024-06-12 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/95213 >From 3c96bf1b16360f52b235d31c08644a2749e7c808 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Wed, 12 Jun 2024 11:24:10 +0200 Subject: [PATCH] [clang] Don't print extra blank when dump the template name. --- cl

[clang] [Clang] Fix handling of brace ellison when building deduction guides (PR #94889)

2024-06-12 Thread Haojian Wu via cfe-commits
@@ -10918,22 +10944,24 @@ QualType Sema::DeduceTemplateSpecializationFromInitializer( if (!(RD->getDefinition() && RD->isAggregate())) return; QualType Ty = Context.getRecordType(RD); - SmallVector ElementTypes; - - InitListChecker CheckInitList(*

[clang] [Clang] Fix handling of brace ellison when building deduction guides (PR #94889)

2024-06-12 Thread Haojian Wu via cfe-commits
@@ -1449,7 +1449,10 @@ void InitListChecker::CheckSubElementType(const InitializedEntity &Entity, // dependent non-array type or an array type with a value-dependent // bound assert(AggrDeductionCandidateParamTypes); - if (!isa_and_nonnull( + //

[clang] [clang] Don't print extra space when dumping template names (PR #95213)

2024-06-12 Thread Haojian Wu via cfe-commits
hokein wrote: Thanks for the review, I'd go with the current fix. https://github.com/llvm/llvm-project/pull/95213 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Don't print extra space when dumping template names (PR #95213)

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

[clang] [Clang] Fix handling of brace ellison when building deduction guides (PR #94889)

2024-06-13 Thread Haojian Wu via cfe-commits
@@ -10918,22 +10944,24 @@ QualType Sema::DeduceTemplateSpecializationFromInitializer( if (!(RD->getDefinition() && RD->isAggregate())) return; QualType Ty = Context.getRecordType(RD); - SmallVector ElementTypes; - - InitListChecker CheckInitList(*

[clang] [clang][HeaderSearch] Fix handling of relative file-paths in suggestPathToFileForDiagnostics (PR #95121)

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

[clang] [clang-tools-extra] [include-cleaner] Pass WorkingDir to suggestPathToFileForDiagnostics (PR #95114)

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

[clang] [Sema][CTAD] Allow user defined conversion for copy-list-initialization (PR #94752)

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

[clang] [Sema][CTAD] Allow user defined conversion for copy-list-initialization (PR #94752)

2024-06-17 Thread Haojian Wu via cfe-commits
@@ -0,0 +1,65 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -Wno-unused-value -std=c++20 %s + +namespace std { + typedef decltype(sizeof(int)) size_t; + + template + struct initializer_list + { +const E *p; +size_t n; +initializer_list(const E *p, size_t n) : p(p),

[clang] [Sema][CTAD] Allow user defined conversion for copy-list-initialization (PR #94752)

2024-06-17 Thread Haojian Wu via cfe-commits
https://github.com/hokein commented: The change looks good to me. Please add a note in `llvm-project/clang/docs/ReleaseNotes.rst`. https://github.com/llvm/llvm-project/pull/94752 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.ll

[clang] [Sema][CTAD] Allow user defined conversion for copy-list-initialization (PR #94752)

2024-06-17 Thread Haojian Wu via cfe-commits
@@ -0,0 +1,65 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -Wno-unused-value -std=c++20 %s hokein wrote: nit: please format the test file. https://github.com/llvm/llvm-project/pull/94752 ___ cfe-commits mailing list cf

[clang] [Sema][CTAD] Allow user defined conversion for copy-list-initialization (PR #94752)

2024-06-17 Thread Haojian Wu via cfe-commits
@@ -0,0 +1,65 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -Wno-unused-value -std=c++20 %s + +namespace std { + typedef decltype(sizeof(int)) size_t; + + template + struct initializer_list + { +const E *p; +size_t n; +initializer_list(const E *p, size_t n) : p(p),

[clang] [Sema][CTAD] Allow user defined conversion for copy-list-initialization (PR #94752)

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

[clang] [Sema][CTAD] Allow user defined conversion for copy-list-initialization (PR #94752)

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

[clang] [Sema][CTAD] Allow user defined conversion for copy-list-initialization (PR #94752)

2024-06-18 Thread Haojian Wu via cfe-commits
@@ -0,0 +1,65 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -Wno-unused-value -std=c++20 %s hokein wrote: yeah, that's expected, we disable the clang-format for all lit test files (see the `clang/test/.clang-format`). https://github.com/llvm/llvm-project/pull/94

[clang] [Clang] Clarify diagnostic notes for implicitly generated deduction guides (PR #96084)

2024-06-21 Thread Haojian Wu via cfe-commits
hokein wrote: Thanks for the patch! +1 on the idea of printing deduction guides in diagnostics. This improves the experience for both users and compiler developers. This is https://github.com/llvm/llvm-project/issues/92393 :) > Perhaps an approach more similar to what we display for ambiguous

[clang] [Clang] Clarify diagnostic notes for implicitly generated deduction guides (PR #96084)

2024-06-21 Thread Haojian Wu via cfe-commits
@@ -12114,6 +12115,35 @@ static void NoteFunctionCandidate(Sema &S, OverloadCandidate *Cand, return; } + // If this is an implicit deduction guide against an implicitly defined + // constructor, add a note for it. Neither these deduction guides nor their + // corresp

[clang] [Clang] Clarify diagnostic notes for implicitly generated deduction guides (PR #96084)

2024-06-21 Thread Haojian Wu via cfe-commits
@@ -12114,6 +12115,35 @@ static void NoteFunctionCandidate(Sema &S, OverloadCandidate *Cand, return; } + // If this is an implicit deduction guide against an implicitly defined + // constructor, add a note for it. Neither these deduction guides nor their + // corresp

[clang] [clang] CTAD alias: fix transformation for require-clause expr Part2. (PR #93533)

2024-05-28 Thread Haojian Wu via cfe-commits
https://github.com/hokein created https://github.com/llvm/llvm-project/pull/93533 In the https://github.com/llvm/llvm-project/pull/90961 fix, we miss a case where the undeduced template parameters of the underlying deduction guide are not transformed, which leaves incorrect depth/index informa

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

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

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

2024-05-29 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-29 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/86512 >From 011d6bbb434bdb46efe92891fe356885f82c4445 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Mon, 25 Mar 2024 15:10:51 +0100 Subject: [PATCH] ination of 2 commits. [clang] Implement a bitwise_copyable builtin t

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

2024-05-29 Thread Haojian Wu via cfe-commits
@@ -1120,6 +1120,14 @@ class QualType { /// Return true if this is a trivially copyable type (C++0x [basic.types]p9) bool isTriviallyCopyableType(const ASTContext &Context) const; + /// Return true if the type is safe to bitwise copy by memcpy. + /// + /// This is an ex

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

2024-05-29 Thread Haojian Wu via cfe-commits
@@ -2749,6 +2749,17 @@ bool QualType::isTriviallyCopyableType(const ASTContext &Context) const { /*IsCopyConstructible=*/false); } +bool QualType::isBitwiseCloneableType(const ASTContext & Context) const { + if (const auto *RD = getCanoni

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

2024-05-29 Thread Haojian Wu via cfe-commits
@@ -4016,6 +4016,34 @@ 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 safe

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

2024-05-29 Thread Haojian Wu via cfe-commits
hokein wrote: > Could we rewrite the description and documentation to capture what the type > trait is doing now? We have a lot of references to the > `is_trivially_copyable`, which is almost fully irrelevant to the current > implementation. Thanks, I updated the PR description and documentat

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

2024-05-29 Thread Haojian Wu via cfe-commits
hokein wrote: Add @eugenis as a reviewer, could you take a look on the sanitizer bit? 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] NFCI: remove obsolete workaround for template default arguments (PR #94311)

2024-06-04 Thread Haojian Wu via cfe-commits
https://github.com/hokein approved this pull request. Thanks for the cleanup, this looks good to me. https://github.com/llvm/llvm-project/pull/94311 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo

[clang] [Driver] Make the FileCheck less strict for some tests. (PR #94349)

2024-06-04 Thread Haojian Wu via cfe-commits
https://github.com/hokein created https://github.com/llvm/llvm-project/pull/94349 We see some tests are failing internally after 12949c952c4fbad776a860c003ccf176973278a0. In CAS systems, we might not see the exact binary name (clang), this patch removes the binary name in the FileCheck conten

[clang] [Driver] Make the FileCheck less strict for some tests. (PR #94349)

2024-06-04 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/94349 >From fa0880d477439e4af3f0b1b057dc1c66a2ccbc1e Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Tue, 4 Jun 2024 14:51:10 +0200 Subject: [PATCH] [Driver] Make the FileCheck less strict for some tests. We see some t

[clang] [Driver] Make the FileCheck less strict for some tests. (PR #94349)

2024-06-04 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/94349 >From b9bd6c36196c7f1fdf6ec7a56260425e0b7255f7 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Tue, 4 Jun 2024 14:51:10 +0200 Subject: [PATCH] [Driver] Dont use absolute paths for invoking subcommands for driver

[clang] [Driver] Make the FileCheck less strict for some tests. (PR #94349)

2024-06-04 Thread Haojian Wu via cfe-commits
@@ -12,7 +12,7 @@ // RUN: --sysroot=%S/Inputs/mips_mti_linux/sysroot \ // RUN: | FileCheck --check-prefix=CHECK-BE-HF-32R2 %s // -// CHECK-BE-HF-32R2: "{{[^"]*}}clang{{[^"]*}}" {{.*}} "-triple" "mips-mti-linux" hokein wrote: Thanks, I wasn't aware of th

[clang] [Driver][test] Make the FileCheck less strict for some tests. (PR #94349)

2024-06-04 Thread Haojian Wu via cfe-commits
https://github.com/hokein closed https://github.com/llvm/llvm-project/pull/94349 ___ 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-04-16 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/86512 >From 10d4b9e505d5ad7476071153d2d13799f5b5cf1f Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Mon, 25 Mar 2024 15:10:51 +0100 Subject: [PATCH 1/2] [clang] Implement a bitwise_copyable builtin type trait. This pa

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

2024-04-16 Thread Haojian Wu via cfe-commits
@@ -2667,6 +2667,29 @@ bool QualType::isTriviallyCopyableType(const ASTContext &Context) const { /*IsCopyConstructible=*/false); } +bool QualType::isBitwiseCopyableType(const ASTContext & Context) const { + QualType CanonicalType = getCan

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

2024-04-16 Thread Haojian Wu via cfe-commits
@@ -526,6 +526,7 @@ TYPE_TRAIT_2(__is_layout_compatible, IsLayoutCompatible, KEYCXX) #include "clang/Basic/TransformTypeTraits.def" // Clang-only C++ Type Traits +TYPE_TRAIT_1(__is_bitwise_copyable, IsBitwiseCopyable, KEYCXX) hokein wrote: OK, renamed to `__

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

2024-04-16 Thread Haojian Wu via cfe-commits
@@ -5056,6 +5056,8 @@ static bool CheckUnaryTypeTraitTypeCompleteness(Sema &S, TypeTrait UTT, case UTT_IsStandardLayout: case UTT_IsPOD: case UTT_IsLiteral: + // Clang extension: hokein wrote: Removed. https://github.com/llvm/llvm-project/pull/86512

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

2024-04-16 Thread Haojian Wu via cfe-commits
@@ -2667,6 +2667,29 @@ bool QualType::isTriviallyCopyableType(const ASTContext &Context) const { /*IsCopyConstructible=*/false); } +bool QualType::isBitwiseCopyableType(const ASTContext & Context) const { + QualType CanonicalType = getCan

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

2024-04-16 Thread Haojian Wu via cfe-commits
@@ -0,0 +1,26 @@ +// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify %s + +// Scalar types are bitwise copyable. +static_assert(__is_bitwise_copyable(int)); +static_assert(__is_bitwise_copyable(int*)); +// array +static_assert(__is_bitwise_copyable(int[10])); + + +struct Forward;

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

2024-04-16 Thread Haojian Wu via cfe-commits
@@ -526,6 +526,7 @@ TYPE_TRAIT_2(__is_layout_compatible, IsLayoutCompatible, KEYCXX) #include "clang/Basic/TransformTypeTraits.def" // Clang-only C++ Type Traits +TYPE_TRAIT_1(__is_bitwise_copyable, IsBitwiseCopyable, KEYCXX) hokein wrote: switched to `KEYAL

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

2024-04-16 Thread Haojian Wu via cfe-commits
@@ -917,6 +917,18 @@ class QualType { /// Return true if this is a trivially copyable type (C++0x [basic.types]p9) bool isTriviallyCopyableType(const ASTContext &Context) const; + /// Return true if this is a bitwise copyable type. + /// + /// This is an extension in cl

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

2024-04-16 Thread Haojian Wu via cfe-commits
@@ -526,6 +526,7 @@ TYPE_TRAIT_2(__is_layout_compatible, IsLayoutCompatible, KEYCXX) #include "clang/Basic/TransformTypeTraits.def" // Clang-only C++ Type Traits +TYPE_TRAIT_1(__is_bitwise_copyable, IsBitwiseCopyable, KEYCXX) hokein wrote: Done, added one, p

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

2024-04-16 Thread Haojian Wu via cfe-commits
@@ -917,6 +917,18 @@ class QualType { /// Return true if this is a trivially copyable type (C++0x [basic.types]p9) bool isTriviallyCopyableType(const ASTContext &Context) const; + /// Return true if this is a bitwise copyable type. + /// + /// This is an extension in cl

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

2024-04-16 Thread Haojian Wu via cfe-commits
@@ -2667,6 +2667,29 @@ bool QualType::isTriviallyCopyableType(const ASTContext &Context) const { /*IsCopyConstructible=*/false); } +bool QualType::isBitwiseCopyableType(const ASTContext & Context) const { + QualType CanonicalType = getCan

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

2024-04-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] Fix a "!CodeSynthesisContexts.empty()" assertion failure when constructing aggregate deduction guides. (PR #89227)

2024-04-18 Thread Haojian Wu via cfe-commits
https://github.com/hokein created https://github.com/llvm/llvm-project/pull/89227 We were missing to push an record to the instantiation stack in `DeclareAggregateDeductionGuideForTypeAlias`. This patch fixes that. >From 04c5dfa09f78fa52b31378295a8d27a20278498a Mon Sep 17 00:00:00 2001 From:

[clang] [clang] Fix a "!CodeSynthesisContexts.empty()" assertion failure when constructing aggregate deduction guides. (PR #89227)

2024-04-18 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/89227 >From 04c5dfa09f78fa52b31378295a8d27a20278498a Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Thu, 18 Apr 2024 14:50:51 +0200 Subject: [PATCH 1/2] [clang] Fix a "!CodeSynthesisContexts.empty()" assertion failure

[clang] [clang] Fix a "!CodeSynthesisContexts.empty()" assertion failure when constructing aggregate deduction guides. (PR #89227)

2024-04-18 Thread Haojian Wu via cfe-commits
https://github.com/hokein closed https://github.com/llvm/llvm-project/pull/89227 ___ 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-19 Thread Haojian Wu via cfe-commits
https://github.com/hokein created https://github.com/llvm/llvm-project/pull/89358 Fixes https://github.com/llvm/llvm-project/issues/85192 Fixes https://github.com/llvm/llvm-project/issues/84492 This patch implements the "IsDeducible" constraint where the template arguments of the alias templat

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

2024-04-19 Thread Haojian Wu via cfe-commits
hokein wrote: Regarding the __is_deducible type trait, GCC also provides one, but it was hidden from users and only used for internal CTAD implementation. I'm not sure if we should follow the same strategy in clang, ideas? https://github.com/llvm/llvm-project/pull/89358 __

[clang] [AST] Dump argument types for TypeTraitExpr. (PR #89370)

2024-04-19 Thread Haojian Wu via cfe-commits
https://github.com/hokein created https://github.com/llvm/llvm-project/pull/89370 The argument types are not modeled as children of TypeTraitExpr, therefore they are not dumped with the default implementation. Dumping them is really useful for ad-hoc debugging, context #89358 >From e8a9fcfa4

[clang] [clang] CTAD: Fix require-clause is not transformed. (PR #89378)

2024-04-19 Thread Haojian Wu via cfe-commits
https://github.com/hokein created https://github.com/llvm/llvm-project/pull/89378 Fixes https://github.com/llvm/llvm-project/issues/89013 When building the deduction guide, we use the TemplateArgsForBuildingFPrime to transform the require-clause from the underlying class deduction guide. Howe

[clang] [clang] CTAD: Fix require-clause is not transformed. (PR #89378)

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

[clang] [clang] CTAD: Fix require-clause is not transformed. (PR #89378)

2024-04-22 Thread Haojian Wu via cfe-commits
hokein wrote: > This seems to have broken the bot: #89476 (you should have had an email?) > > I reverted in #89476 sorry, and thanks for the revert. I will take a further look. https://github.com/llvm/llvm-project/pull/89378 ___ cfe-commits mailing

[clang] 57c24eb - Reland "[clang] CTAD: Fix require-clause is not transformed." (#89476)

2024-04-22 Thread Haojian Wu via cfe-commits
Author: Haojian Wu Date: 2024-04-22T10:04:55+02:00 New Revision: 57c24eb0a7482ca7f661a2a9cb45249f1553d6d2 URL: https://github.com/llvm/llvm-project/commit/57c24eb0a7482ca7f661a2a9cb45249f1553d6d2 DIFF: https://github.com/llvm/llvm-project/commit/57c24eb0a7482ca7f661a2a9cb45249f1553d6d2.diff LO

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

2024-04-22 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/89358 >From 9583811bfa66ff058f5e33012cd77501ce3e5e23 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-04-22 Thread Haojian Wu via cfe-commits
@@ -3207,6 +3241,59 @@ 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-04-22 Thread Haojian Wu via cfe-commits
@@ -6100,6 +6100,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-04-22 Thread Haojian Wu via cfe-commits
hokein wrote: > Needs a release note, and I think we actually DO have to do those diagnostics > here. Added a release note for the new builtin. https://github.com/llvm/llvm-project/pull/89358 ___ cfe-commits mailing list cfe-commits@lists.llvm.org h

[clang] [AST] Dump argument types for TypeTraitExpr. (PR #89370)

2024-04-22 Thread Haojian Wu via cfe-commits
hokein wrote: > It seems to me that exposing these as children is the better option here, > right? That way it would better model a CallExpr or template type-trait, and > would work in our StmtProfiler et-al. Agree that exposing them as children is better. However, we encounter an implementat

[clang] [AST] Dump argument types for TypeTraitExpr. (PR #89370)

2024-04-22 Thread Haojian Wu via cfe-commits
https://github.com/hokein closed https://github.com/llvm/llvm-project/pull/89370 ___ 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-23 Thread Haojian Wu via cfe-commits
hokein wrote: > > > Regarding the __is_deducible type trait, GCC also provides one, but it > > > was hidden from users and only used for internal CTAD implementation. I'm > > > not sure if we should follow the same strategy in clang, ideas? > > > > > > I have mixed feeling. What do you think

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

2024-04-23 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] cororoutine: generate valid mangled name in CodeGenFunction::generateAwaitSuspendWrapper (PR #89731)

2024-04-23 Thread Haojian Wu via cfe-commits
https://github.com/hokein created https://github.com/llvm/llvm-project/pull/89731 Fixes https://github.com/llvm/llvm-project/issues/89723 >From 6d292f1d3bddb5a52ca63babd4bb785266277674 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Tue, 23 Apr 2024 11:48:12 +0200 Subject: [PATCH] [clang] coro

[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 edited 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] Enable the -Wdangling-assignment-gsl diagnostic by default. (PR #100708)

2024-07-26 Thread Haojian Wu via cfe-commits
https://github.com/hokein created https://github.com/llvm/llvm-project/pull/100708 None >From 69670cf28f04d82adde27be86af6b8ce40e7a01c Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Fri, 26 Jul 2024 09:17:50 +0200 Subject: [PATCH] [clang] Enable the -Wdangling-assignment-gsl diagnostic by de

[clang] [clang] Enable the -Wdangling-assignment-gsl diagnostic by default. (PR #100708)

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

[clang] 5d2c324 - Remove a leftover debug-only statement in CheckExprLifetime.cpp

2024-07-29 Thread Haojian Wu via cfe-commits
Author: Haojian Wu Date: 2024-07-29T09:22:03+02:00 New Revision: 5d2c324fea2d7cf86ec50e4bb6b680acf89b2ed5 URL: https://github.com/llvm/llvm-project/commit/5d2c324fea2d7cf86ec50e4bb6b680acf89b2ed5 DIFF: https://github.com/llvm/llvm-project/commit/5d2c324fea2d7cf86ec50e4bb6b680acf89b2ed5.diff LO

[clang] [clang] Refactor: Introduce a new LifetimeKind for the assignment case, NFC (PR #99005)

2024-07-16 Thread Haojian Wu via cfe-commits
https://github.com/hokein created https://github.com/llvm/llvm-project/pull/99005 The current implementation for the assignment case uses a combination of the `LK_Extended` lifetime kind and the validity of `AEntity`, which is somewhat messy and doesn't align well with the intended mental mode

[clang] [clang] Refactor: Introduce a new LifetimeKind for the assignment case, NFC (PR #99005)

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

[clang] [clang] Refactor: Introduce a new LifetimeKind for the assignment case, NFC (PR #99005)

2024-07-16 Thread Haojian Wu via cfe-commits
hokein wrote: Thanks! https://github.com/llvm/llvm-project/pull/99005 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-07-16 Thread Haojian Wu via cfe-commits
https://github.com/hokein created https://github.com/llvm/llvm-project/pull/99032 This is a follow-up patch to #96475 to detect dangling assignments for C++ pointer-like objects (classes annotated with the `[[gsl::Pointer]]`). Fixes #63310. Similar to the behavior for built-in pointer types,

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

2024-07-17 Thread Haojian Wu via cfe-commits
hokein wrote: Thanks for implementing it! I haven't looked into the implementation details yet. Before doing so, I want to ensure I understand the standard correctly (the standard's wording is a bit hard to follow). Per C++ [over.match.class.deduct#1.10](https://eel.is/c++draft/over.match.cl

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

2024-07-17 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/99032 >From 9ac7a9543878fc93ea036cfa533c25bbbceeddf2 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Tue, 16 Jul 2024 12:29:35 +0200 Subject: [PATCH 1/2] [clang] Extend lifetime analysis to detect dangling assignments

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

2024-07-17 Thread Haojian Wu via cfe-commits
https://github.com/hokein edited 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] Extend lifetime analysis to support assignments for pointer-like objects. (PR #99032)

2024-07-17 Thread Haojian Wu via cfe-commits
@@ -966,7 +969,8 @@ static bool pathOnlyInitializesGslPointer(IndirectLocalPath &Path) { if (It.Kind == IndirectLocalPathEntry::LifetimeBoundCall) continue; return It.Kind == IndirectLocalPathEntry::GslPointerInit || - It.Kind == IndirectLocalPathEntry:

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

2024-07-17 Thread Haojian Wu via cfe-commits
@@ -1073,14 +1078,16 @@ static void checkExprLifetimeImpl(Sema &SemaRef, } case LK_Assignment: { - if (!MTE) + if (!MTE || pathContainsInit(Path)) return false; assert(shouldLifetimeExtendThroughPath(Path) == PathLifetimeKind

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

2024-07-17 Thread Haojian Wu via cfe-commits
https://github.com/hokein commented: Thanks for the review. 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] Extend lifetime analysis to support assignments for pointer-like objects. (PR #99032)

2024-07-17 Thread Haojian Wu via cfe-commits
@@ -1284,16 +1294,26 @@ void checkExprLifetime(Sema &SemaRef, const InitializedEntity &Entity, auto LTResult = getEntityLifetime(&Entity); LifetimeKind LK = LTResult.getInt(); const InitializedEntity *ExtendingEntity = LTResult.getPointer(); - checkExprLifetimeImpl(Sema

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

2024-07-17 Thread Haojian Wu via cfe-commits
@@ -1284,16 +1294,26 @@ void checkExprLifetime(Sema &SemaRef, const InitializedEntity &Entity, auto LTResult = getEntityLifetime(&Entity); LifetimeKind LK = LTResult.getInt(); const InitializedEntity *ExtendingEntity = LTResult.getPointer(); - checkExprLifetimeImpl(Sema

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

2024-07-17 Thread Haojian Wu via cfe-commits
@@ -966,7 +969,8 @@ static bool pathOnlyInitializesGslPointer(IndirectLocalPath &Path) { if (It.Kind == IndirectLocalPathEntry::LifetimeBoundCall) hokein wrote: Rewrote the `if` with the `switch`. https://github.com/llvm/llvm-project/pull/99032 __

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

2024-07-18 Thread Haojian Wu via cfe-commits
@@ -34,6 +34,6 @@ struct basic_string { }; } // namespace std void test(const char* a) { - // verify we're emitting the `-Wdangling-assignment` warning. + // verify we're emitting the `-Wdangling-assignment-gsl` warning. a = std::basic_string().c_str(); // expected-warnin

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