[clang] [Clang][Sema] Apply CWG400 'Using-declarations and the "struct hack"' to C++98 mode (PR #143492)

2025-06-12 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis edited https://github.com/llvm/llvm-project/pull/143492 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [-Wunterminated-string-initialization] Handle C string literals ending with explicit '\0' (PR #143487)

2025-06-10 Thread Yanzuo Liu via cfe-commits
@@ -0,0 +1,28 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -Wunterminated-string-initialization %s -x c +// RUN: %clang_cc1 -fsyntax-only -verify -Wunterminated-string-initialization %s -x c++ + + +// In C, the following examples are fine: +#if __cplusplus zwuis

[clang] [Clang][Sema] Apply CWG400 'Using-declarations and the "struct hack"' to C++98 mode (PR #143492)

2025-06-10 Thread Yanzuo Liu via cfe-commits
zwuis wrote: I'm not sure if I should modify CWG400 implementation status to "Clang 21". CC @Endilll https://github.com/llvm/llvm-project/pull/143492 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listi

[clang] [Clang][Sema] Apply CWG400 'Using-declarations and the "struct hack"' to C++98 mode (PR #143492)

2025-06-10 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis created https://github.com/llvm/llvm-project/pull/143492 It seems that we applied CWG400 to C++11 and newer version. But CWG400 should also be applied to C++98. >From 658f3d3cb72ff9fbdb2315f894f39956eeabf135 Mon Sep 17 00:00:00 2001 From: Yanzuo Liu Date: Tue, 10 Jun

[clang] [Clang][NFC] Add test for CWG2289 "Uniqueness of structured binding names" (PR #131054)

2025-06-09 Thread Yanzuo Liu via cfe-commits
zwuis wrote: Ping. https://github.com/llvm/llvm-project/pull/131054 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][NFC] Refactor replaceExternalDecls to use llvm::any_of (PR #143275)

2025-06-07 Thread Yanzuo Liu via cfe-commits
zwuis wrote: IIUC the `FIXME` comment means that the time complexity of this part of code is not good enough and we can make it faster. https://github.com/llvm/llvm-project/pull/143275 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://li

[clang] [Clang][Parse][NFC] Use `llvm::function_ref<>` instead of `std::optional>` (PR #142906)

2025-06-07 Thread Yanzuo Liu via cfe-commits
zwuis wrote: Yes. I still don't have commit access. Thank you! https://github.com/llvm/llvm-project/pull/142906 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2025-06-03 Thread Yanzuo Liu via cfe-commits
@@ -745,6 +755,16 @@ class alignas(void *) Stmt { unsigned TemplateDepth; }; + class ChooseExprBitfields { +friend class ASTStmtReader; +friend class ChooseExpr; + +LLVM_PREFERRED_TYPE(ExprBitfields) +unsigned : NumExprBits; + +bool CondIsTrue : 1; -

[clang] [Clang] add fix-it hints for unknown attributes (PR #141305)

2025-05-23 Thread Yanzuo Liu via cfe-commits
zwuis wrote: Can you handle this case `[[using gnu : deprected]]`? https://github.com/llvm/llvm-project/pull/141305 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] Reject array prvalue operands (PR #140702)

2025-05-21 Thread Yanzuo Liu via cfe-commits
@@ -7639,6 +7639,8 @@ def warn_param_mismatched_alignment : Warning< def err_objc_object_assignment : Error< "cannot assign to class object (%0 invalid)">; +def err_typecheck_array_prvalue_operand : Error< + "array prvalue is not permitted">; zwuis wrote:

[clang] [Clang][Sema] Reject array prvalue operands (PR #140702)

2025-05-21 Thread Yanzuo Liu via cfe-commits
@@ -7639,6 +7639,8 @@ def warn_param_mismatched_alignment : Warning< def err_objc_object_assignment : Error< "cannot assign to class object (%0 invalid)">; +def err_typecheck_array_prvalue_operand : Error< + "array prvalue is not permitted">; zwuis wrote:

[clang] [Clang][Sema] Reject array prvalue operands (PR #140702)

2025-05-20 Thread Yanzuo Liu via cfe-commits
zwuis wrote: This is related to CWG2548. CC @Endilll https://github.com/llvm/llvm-project/pull/140702 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Add avoid-pragma-once. (PR #140388)

2025-05-17 Thread Yanzuo Liu via cfe-commits
@@ -0,0 +1,5 @@ +// RUN: %check_clang_tidy %s portability-avoid-pragma-once %t \ +// RUN: -- -- -isystem %S/Inputs/avoid-pragma-once + +#include +// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: Avoid pragma once. [portability-avoid-pragma-once] zwuis wrote: You c

[clang-tools-extra] [clangd] Add tweak to add pure virtual overrides (PR #139348)

2025-05-15 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis commented: LGTM if HighCommander4 is happy. https://github.com/llvm/llvm-project/pull/139348 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Fix parsing of expressions of the form (T())[/*...*/] (PR #140053)

2025-05-15 Thread Yanzuo Liu via cfe-commits
@@ -710,6 +710,7 @@ Bug Fixes to C++ Support - Clang now correctly parses arbitrary order of ``[[]]``, ``__attribute__`` and ``alignas`` attributes for declarations (#GH133107) - Fixed a crash when forming an invalid function type in a dependent context. (#GH138657) (#GH115725

[clang] [Clang][Sema] Disable checking invalid template id in initializer of primary variable template `std::format_kind` with libstdc++ (PR #139560)

2025-05-14 Thread Yanzuo Liu via cfe-commits
zwuis wrote: @cor3ntin I don't have commit access. Please help me land this. By the way, should I request commit access? https://github.com/llvm/llvm-project/pull/139560 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cg

[clang] Revert "[Clang][Sema] Handle invalid variable template specialization whose type depends on itself (#134522)" (PR #139539)

2025-05-13 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis closed https://github.com/llvm/llvm-project/pull/139539 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] Disable checking invalid template id in initializer of primary variable template `std::format_kind` with libstdc++ (PR #139560)

2025-05-13 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis edited https://github.com/llvm/llvm-project/pull/139560 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] Disable checking invalid template id in initializer of primary variable template `std::format_kind` with libstdc++ (PR #139560)

2025-05-13 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis updated https://github.com/llvm/llvm-project/pull/139560 Rate limit · GitHub body { background-color: #f6f8fa; color: #24292e; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-ser

[clang] [Clang][Sema] Disable checking invalid template id in initializer of primary variable template `std::format_kind` with libstdc++ (PR #139560)

2025-05-12 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis created https://github.com/llvm/llvm-project/pull/139560 Fixes #139067 Rate limit · GitHub body { background-color: #f6f8fa; color: #24292e; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica

[clang] Revert "[Clang][Sema] Handle invalid variable template specialization whose type depends on itself (#134522)" (PR #139539)

2025-05-12 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis converted_to_draft https://github.com/llvm/llvm-project/pull/139539 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] Disable checking invalid template id in primary variable template initializer (PR #139490)

2025-05-12 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis closed https://github.com/llvm/llvm-project/pull/139490 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Revert "[Clang][Sema] Handle invalid variable template specialization whose type depends on itself (#134522)" (PR #139539)

2025-05-12 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis created https://github.com/llvm/llvm-project/pull/139539 #134522 triggers compilation error with libstdc++. See #139067 or . This reverts commit 91f1830cb69cab96201adba6378d64095e251f95. >From 4878337bb6b2d6152fc531

[clang] Fix missing initializer for inline static template member with auto caused by delayed template instantiation. (PR #138122)

2025-05-11 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis commented: LGTM https://github.com/llvm/llvm-project/pull/138122 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clangd] Add tweak to add pure virtual overrides (PR #139348)

2025-05-11 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis edited https://github.com/llvm/llvm-project/pull/139348 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clangd] Add tweak to add pure virtual overrides (PR #139348)

2025-05-11 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis edited https://github.com/llvm/llvm-project/pull/139348 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clangd] Add tweak to add pure virtual overrides (PR #139348)

2025-05-11 Thread Yanzuo Liu via cfe-commits
@@ -0,0 +1,296 @@ +//===--- OverridePureVirtuals.cpp *- C++-*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Ap

[clang-tools-extra] [clangd] Add tweak to add pure virtual overrides (PR #139348)

2025-05-11 Thread Yanzuo Liu via cfe-commits
@@ -0,0 +1,296 @@ +//===--- OverridePureVirtuals.cpp *- C++-*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Ap

[clang-tools-extra] [clangd] Add tweak to add pure virtual overrides (PR #139348)

2025-05-11 Thread Yanzuo Liu via cfe-commits
@@ -0,0 +1,296 @@ +//===--- OverridePureVirtuals.cpp *- C++-*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Ap

[clang-tools-extra] [clangd] Add tweak to add pure virtual overrides (PR #139348)

2025-05-11 Thread Yanzuo Liu via cfe-commits
@@ -0,0 +1,296 @@ +//===--- OverridePureVirtuals.cpp *- C++-*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Ap

[clang] [Clang][Sema] Disable checking invalid template id in primary variable template initializer (PR #139490)

2025-05-11 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis created https://github.com/llvm/llvm-project/pull/139490 Workaround for #139067 >From c5a9cda3e5c3aa2b07281e373e9736045a01643b Mon Sep 17 00:00:00 2001 From: Yanzuo Liu Date: Mon, 12 May 2025 11:08:50 +0800 Subject: [PATCH] Disable checking invalid template id in prima

[clang] Better diagnostics when assertion fails in `consteval` (PR #130458)

2025-05-11 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis commented: LGTM https://github.com/llvm/llvm-project/pull/130458 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clangd] Add tweak to add pure virtual overrides (PR #139348)

2025-05-10 Thread Yanzuo Liu via cfe-commits
@@ -0,0 +1,349 @@ +//===--- AddPureVirtualOverride.cpp --*- C++-*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Ap

[clang-tools-extra] [clangd] Add tweak to add pure virtual overrides (PR #139348)

2025-05-10 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis commented: Thank you for you work! Please add a release note in `clang-tools-extra/docs/ReleaseNotes.rst`. Please read and follow requirements/suggestions in this document such as preferring `llvm::SmallVector` and not usin

[clang-tools-extra] [clangd] Add tweak to add pure virtual overrides (PR #139348)

2025-05-10 Thread Yanzuo Liu via cfe-commits
@@ -0,0 +1,349 @@ +//===--- AddPureVirtualOverride.cpp --*- C++-*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Ap

[clang-tools-extra] [clangd] Add tweak to add pure virtual overrides (PR #139348)

2025-05-10 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis edited https://github.com/llvm/llvm-project/pull/139348 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clangd] Add tweak to add pure virtual overrides (PR #139348)

2025-05-10 Thread Yanzuo Liu via cfe-commits
@@ -0,0 +1,349 @@ +//===--- AddPureVirtualOverride.cpp --*- C++-*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Ap

[clang-tools-extra] [clangd] Add tweak to add pure virtual overrides (PR #139348)

2025-05-10 Thread Yanzuo Liu via cfe-commits
@@ -0,0 +1,349 @@ +//===--- AddPureVirtualOverride.cpp --*- C++-*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Ap

[clang-tools-extra] [clangd] Add tweak to add pure virtual overrides (PR #139348)

2025-05-10 Thread Yanzuo Liu via cfe-commits
@@ -0,0 +1,349 @@ +//===--- AddPureVirtualOverride.cpp --*- C++-*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Ap

[clang-tools-extra] [clangd] Add tweak to add pure virtual overrides (PR #139348)

2025-05-10 Thread Yanzuo Liu via cfe-commits
@@ -0,0 +1,349 @@ +//===--- AddPureVirtualOverride.cpp --*- C++-*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Ap

[clang-tools-extra] [clangd] Add tweak to add pure virtual overrides (PR #139348)

2025-05-10 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis edited https://github.com/llvm/llvm-project/pull/139348 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Better diagnostics when assertion fails in `consteval` (PR #130458)

2025-05-09 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis edited https://github.com/llvm/llvm-project/pull/130458 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Better diagnostics when assertion fails in `consteval` (PR #130458)

2025-05-09 Thread Yanzuo Liu via cfe-commits
@@ -5975,9 +5975,15 @@ static bool CheckConstexprFunction(EvalInfo &Info, SourceLocation CallLoc, Definition->hasAttr( return true; - if (Info.getLangOpts().CPlusPlus11) { -const FunctionDecl *DiagDecl = Definition ? Defin

[clang] Better diagnostics when assertion fails in `consteval` (PR #130458)

2025-05-09 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis commented: LGTM module nit. Are you happy with the current state? @cor3ntin @Sirraide https://github.com/llvm/llvm-project/pull/130458 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mai

[clang] Better diagnostics when assertion fails in `consteval` (PR #130458)

2025-05-09 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis edited https://github.com/llvm/llvm-project/pull/130458 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [Clang-Tidy][NFC] Simplify check cppcoreguidelines-missing-std-forward (PR #138504)

2025-05-07 Thread Yanzuo Liu via cfe-commits
zwuis wrote: Thank you for your review! I don't have commit access. Please help me merge this PR if it's ready. https://github.com/llvm/llvm-project/pull/138504 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mai

[clang] [Clang][Sema] Handle invalid variable template specialization whose type depends on itself (PR #134522)

2025-05-06 Thread Yanzuo Liu via cfe-commits
zwuis wrote: Yes. Please help me merge this PR. Thank you for your review! https://github.com/llvm/llvm-project/pull/134522 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] Handle invalid variable template specialization whose type depends on itself (PR #134522)

2025-05-06 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis updated https://github.com/llvm/llvm-project/pull/134522 >From ccab3dc1f18ffeda9acb07c0bd5f80f65cc788b9 Mon Sep 17 00:00:00 2001 From: Yanzuo Liu Date: Sun, 6 Apr 2025 15:06:56 +0800 Subject: [PATCH 1/4] Handle invalid variable template specialization whose type depend

[clang-tools-extra] [Clang-Tidy][NFC] Simplify check cppcoreguidelines-missing-std-forward (PR #138504)

2025-05-06 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis commented: > Strange, can you explain why that's the case? `CaptureInCopy` matches lambda expressions whose default capture kind is copy and which have an explicit capture referencing function parameter. `CaptureByRefExplicit` matches lambda expressions which have an e

[clang-tools-extra] [Clang-Tidy][NFC] Simplify check cppcoreguidelines-missing-std-forward (PR #138504)

2025-05-06 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis edited https://github.com/llvm/llvm-project/pull/138504 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] Handle invalid variable template specialization whose type depends on itself (PR #134522)

2025-05-05 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis updated https://github.com/llvm/llvm-project/pull/134522 Rate limit · GitHub body { background-color: #f6f8fa; color: #24292e; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-ser

[clang-tools-extra] [Clang-Tidy][NFC] Simplify check cppcoreguidelines-missing-std-forward (PR #138504)

2025-05-05 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis edited https://github.com/llvm/llvm-project/pull/138504 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [Clang-Tidy][NFC] Simplify check cppcoreguidelines-missing-std-forward (PR #138504)

2025-05-05 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis edited https://github.com/llvm/llvm-project/pull/138504 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [Clang-Tidy][NFC] Simplify check cppcoreguidelines-missing-std-forward (PR #138504)

2025-05-05 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis updated https://github.com/llvm/llvm-project/pull/138504 >From a972594f263865dc4d214591f6dc4f6f55b058db Mon Sep 17 00:00:00 2001 From: Yanzuo Liu Date: Mon, 5 May 2025 19:02:06 +0800 Subject: [PATCH 1/2] Simplify check cppcoreguidelines-missing-std-forward --- .../cla

[clang-tools-extra] [Clang-Tidy][NFC] Simplify check cppcoreguidelines-missing-std-forward (PR #138504)

2025-05-05 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis created https://github.com/llvm/llvm-project/pull/138504 Remove `CaptureInCopy` because function parameters captured by copy should not be considered forwarded. No functional changes because implicit captures are not added to capture list until the function is instant

[clang] Fix missing initializer for inline static template member with auto caused by delayed template instantiation. (PR #138122)

2025-05-02 Thread Yanzuo Liu via cfe-commits
@@ -6027,8 +6027,15 @@ void Sema::BuildVariableInstantiation( Context.setManglingNumber(NewVar, Context.getManglingNumber(OldVar)); Context.setStaticLocalNumber(NewVar, Context.getStaticLocalNumber(OldVar)); + bool VarTemplateWithAutoType = false; + QualType VarSourceTyp

[clang] Fix missing initializer for inline static template member with auto caused by delayed template instantiation. (PR #138122)

2025-05-02 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis edited https://github.com/llvm/llvm-project/pull/138122 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Fix missing initializer for inline static template member with auto caused by delayed template instantiation. (PR #138122)

2025-05-01 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis commented: Please add a release note in clang/docs/ReleaseNotes.rst . https://github.com/llvm/llvm-project/pull/138122 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-

[clang] Fix missing initializer for inline static template member with auto caused by delayed template instantiation. (PR #138122)

2025-05-01 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis edited https://github.com/llvm/llvm-project/pull/138122 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Fix missing initializer for inline static template member with auto caused by delayed template instantiation. (PR #138122)

2025-05-01 Thread Yanzuo Liu via cfe-commits
@@ -6027,8 +6027,15 @@ void Sema::BuildVariableInstantiation( Context.setManglingNumber(NewVar, Context.getManglingNumber(OldVar)); Context.setStaticLocalNumber(NewVar, Context.getStaticLocalNumber(OldVar)); + bool VarTemplateWithAutoType = false; + QualType VarSourceTyp

[clang] [Clang][Sema] Handle invalid variable template specialization whose type depends on itself (PR #134522)

2025-04-30 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis updated https://github.com/llvm/llvm-project/pull/134522 >From ccab3dc1f18ffeda9acb07c0bd5f80f65cc788b9 Mon Sep 17 00:00:00 2001 From: Yanzuo Liu Date: Sun, 6 Apr 2025 15:06:56 +0800 Subject: [PATCH 1/4] Handle invalid variable template specialization whose type depend

[clang] [Clang][Sema] Handle invalid variable template specialization whose type depends on itself (PR #134522)

2025-04-29 Thread Yanzuo Liu via cfe-commits
@@ -7594,6 +7594,54 @@ ASTContext::getCanonicalTemplateArgument(const TemplateArgument &Arg) const { llvm_unreachable("Unhandled template argument kind"); } +bool ASTContext::isSameTemplateArgument(const TemplateArgument &Arg1, +const

[clang] [Clang][Sema] Handle invalid variable template specialization whose type depends on itself (PR #134522)

2025-04-29 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis updated https://github.com/llvm/llvm-project/pull/134522 >From ccab3dc1f18ffeda9acb07c0bd5f80f65cc788b9 Mon Sep 17 00:00:00 2001 From: Yanzuo Liu Date: Sun, 6 Apr 2025 15:06:56 +0800 Subject: [PATCH 1/3] Handle invalid variable template specialization whose type depend

[clang] [Clang][Sema] Handle invalid variable template specialization whose type depends on itself (PR #134522)

2025-04-29 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis edited https://github.com/llvm/llvm-project/pull/134522 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] Handle invalid variable template specialization whose type depends on itself (PR #134522)

2025-04-29 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis updated https://github.com/llvm/llvm-project/pull/134522 >From ccab3dc1f18ffeda9acb07c0bd5f80f65cc788b9 Mon Sep 17 00:00:00 2001 From: Yanzuo Liu Date: Sun, 6 Apr 2025 15:06:56 +0800 Subject: [PATCH 1/3] Handle invalid variable template specialization whose type depend

[clang] [Clang][Sema] Handle invalid variable template specialization whose type depends on itself (PR #134522)

2025-04-28 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis updated https://github.com/llvm/llvm-project/pull/134522 >From ccab3dc1f18ffeda9acb07c0bd5f80f65cc788b9 Mon Sep 17 00:00:00 2001 From: Yanzuo Liu Date: Sun, 6 Apr 2025 15:06:56 +0800 Subject: [PATCH 1/2] Handle invalid variable template specialization whose type depend

[clang] [Clang] diagnose deleted/default redeclaration of defined friend functions (PR #136717)

2025-04-23 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis commented: LGTM https://github.com/llvm/llvm-project/pull/136717 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] diagnose deleted/default redeclaration of defined friend functions (PR #136717)

2025-04-22 Thread Yanzuo Liu via cfe-commits
@@ -142,6 +142,13 @@ NamedDecl *Parser::ParseCXXInlineMethodDef( SkipUntil(tok::semi); } +Decl *PrevDecl = FnD->getPreviousDecl(); +if (PrevDecl && isa(PrevDecl) && zwuis wrote: `isa_and_present(PrevDecl)` https://github.com/llvm/llvm-proje

[clang] [clang][analyzer] Handle CXXParenInitListExpr alongside InitListExpr (PR #136041)

2025-04-20 Thread Yanzuo Liu via cfe-commits
zwuis wrote: > FYI we usually ping once a week. Oh, I see. IIUC `@ llvm/pr-subscribers-clang-static-analyzer-1` is also a ping, which I didn't know. https://github.com/llvm/llvm-project/pull/136041 ___ cfe-commits mailing list cfe-commits@lists.llvm.

[clang] [clang][analyzer] Handle CXXParenInitListExpr alongside InitListExpr (PR #136041)

2025-04-19 Thread Yanzuo Liu via cfe-commits
zwuis wrote: @Xazax-hun @steakhal Please take a look. https://github.com/llvm/llvm-project/pull/136041 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][analyzer] Handle CXXParenInitListExpr alongside InitListExpr (PR #136041)

2025-04-19 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis approved this pull request. https://github.com/llvm/llvm-project/pull/136041 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][analyzer] Handle CXXParenInitListExpr alongside InitListExpr (PR #136041)

2025-04-17 Thread Yanzuo Liu via cfe-commits
zwuis wrote: There is a section named "Static Analyzer" in this file. https://github.com/llvm/llvm-project/pull/136041 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/lis

[clang] [clang][analyzer] Handle CXXParenInitListExpr alongside InitListExpr (PR #136041)

2025-04-17 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis edited https://github.com/llvm/llvm-project/pull/136041 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][analyzer] Handle CXXParenInitListExpr alongside InitListExpr (PR #136041)

2025-04-17 Thread Yanzuo Liu via cfe-commits
@@ -379,10 +379,12 @@ void DynamicTypePropagation::checkPostCall(const CallEvent &Call, // aggregates, and in such case no top-frame constructor will be called. // Figure out if we need to do anything in this case. // FIXME: Instead of relying on the P

[clang] [clang][analyzer] Handle CXXParenInitListExpr alongside InitListExpr (PR #136041)

2025-04-17 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis commented: Thank you for your patch! Please add a release note in clang/docs/ReleaseNotes.rst . https://github.com/llvm/llvm-project/pull/136041 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cg

[clang] [Clang][Sema] Handle invalid variable template specialization whose type depends on itself (PR #134522)

2025-04-08 Thread Yanzuo Liu via cfe-commits
@@ -47,3 +47,21 @@ namespace InvalidInsertPos { template<> int v; int k = v; } + +namespace GH51347 { + template + auto p = p; // expected-error {{the type of variable template specialization 'p'}} zwuis wrote: I think this pattern is always illegal. B

[clang] [Clang][Sema] Handle invalid variable template specialization whose type depends on itself (PR #134522)

2025-04-06 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis created https://github.com/llvm/llvm-project/pull/134522 Fixes #51347 >From ccab3dc1f18ffeda9acb07c0bd5f80f65cc788b9 Mon Sep 17 00:00:00 2001 From: Yanzuo Liu Date: Sun, 6 Apr 2025 15:06:56 +0800 Subject: [PATCH] Handle invalid variable template specialization whose t

[clang] [clang] Implement CWG2815 (PR #132778)

2025-04-05 Thread Yanzuo Liu via cfe-commits
@@ -47,6 +47,28 @@ void f() { #endif } // namespace cwg2813 +namespace cwg2815 { // cwg2815: 21 +#if __cpp_noexcept_function_type >= 201510 zwuis wrote: I'm not sure if checking values of feature test macros is better then checking the value of `__cplusplus`

[clang] [clang] Check `std::initializer_list` more strictly (PR #133822)

2025-04-05 Thread Yanzuo Liu via cfe-commits
@@ -2590,8 +2590,14 @@ def err_auto_non_deduced_not_alone : Error< def err_implied_std_initializer_list_not_found : Error< "cannot deduce type of initializer list because std::initializer_list was " "not found; include ">; -def err_malformed_std_initializer_list : Error< -

[clang] [Clang][NFC] Add test for CWG2289 "Uniqueness of structured binding names" (PR #131054)

2025-04-05 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis edited https://github.com/llvm/llvm-project/pull/131054 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Check `std::initializer_list` more strictly (PR #133822)

2025-04-05 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis approved this pull request. https://github.com/llvm/llvm-project/pull/133822 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][ExtractAPI] emit correct spelling for type aliases (PR #134007)

2025-04-04 Thread Yanzuo Liu via cfe-commits
@@ -0,0 +1,56 @@ +// RUN: rm -rf %t +// RUN: %clang_cc1 -extract-api --pretty-sgf --emit-sgf-symbol-labels-for-testing \ +// RUN: --product-name=TypeAlias -triple arm64-apple-macosx -x c++-header %s -o %t/type-alias.symbols.json -verify + +// RUN: FileCheck %s --input-file %t/

[clang] [Clang] Implement CWG2517 Useless restriction on use of parameter in constraint-expression (PR #132919)

2025-03-26 Thread Yanzuo Liu via cfe-commits
@@ -32,6 +32,26 @@ enum E2 : S::I { e }; #endif } // namespace cwg2516 +namespace cwg2517 { // cwg2517: 21 +#if __cplusplus >= 202302L zwuis wrote: The resolution of defect reports is applied to all C++ standard verions where the issue exists unless specifie

[clang] [Clang] Implement CWG2517 Useless restriction on use of parameter in constraint-expression (PR #132919)

2025-03-25 Thread Yanzuo Liu via cfe-commits
@@ -32,6 +32,26 @@ enum E2 : S::I { e }; #endif } // namespace cwg2516 +namespace cwg2517 { // cwg2517: 21 +#if __cplusplus >= 202302L zwuis wrote: IIUC this DR is applied to C++20. https://github.com/llvm/llvm-project/pull/132919 ___

[clang] [Clang] Introduce a trait to determine the structure binding size (PR #131515)

2025-03-19 Thread Yanzuo Liu via cfe-commits
@@ -1642,6 +1661,56 @@ void Sema::CheckCompleteDecompositionDeclaration(DecompositionDecl *DD) { DD->setInvalidDecl(); } +std::optional Sema::GetDecompositionElementCount(QualType T, + SourceLocation Loc) { + con

[clang] [Clang][NFC] Add test for CWG2289 "Uniqueness of structured binding names" (PR #131054)

2025-03-19 Thread Yanzuo Liu via cfe-commits
zwuis wrote: > "Declarative region" is clearly pre-P1787R6 wording. Can you find the wording > in the current draft that covers this? Yes. I have updated the description of this PR. https://github.com/llvm/llvm-project/pull/131054 ___ cfe-commits mai

[clang] [Clang][NFC] Add test for CWG2289 "Uniqueness of structured binding names" (PR #131054)

2025-03-12 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis created https://github.com/llvm/llvm-project/pull/131054 The resolution of [CWG2289](https://wg21.link/cwg2289) added that the name of a structured binding must be unique in its declarative region, and was implemented in https://github.com/llvm/llvm-project/commit/bdb

[clang] Better diagnostics when assertion fails in `consteval` (PR #130458)

2025-03-09 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis edited https://github.com/llvm/llvm-project/pull/130458 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Better diagnostics when assertion fails in `consteval` (PR #130458)

2025-03-09 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis commented: Thank you for the patch! You should add a release note in clang/docs/ReleaseNotes.rst so that users can know the improvement. https://github.com/llvm/llvm-project/pull/130458 ___ cfe-commits mailing list cfe-commits

[clang] Better diagnostics when assertion fails in `consteval` (PR #130458)

2025-03-09 Thread Yanzuo Liu via cfe-commits
@@ -8361,6 +8361,17 @@ class ExprEvaluatorBase return false; } +// If an assertion fails during constant evaluation, give a specific note explaining that +if (FD->getName() == "__assert_fail") { zwuis wrote: The name of corresponding func

[clang] [Clang] Check for uninitialized use in lambda within CXXOperatorCallExpr (PR #129198)

2025-03-05 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis approved this pull request. https://github.com/llvm/llvm-project/pull/129198 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][P1061] Consolidate ResolvedUnpexandedPackExpr into FunctionParmPackExpr (PR #125394)

2025-02-14 Thread Yanzuo Liu via cfe-commits
@@ -3492,10 +3492,13 @@ VarDecl *BindingDecl::getHoldingVar() const { return VD; } -llvm::ArrayRef BindingDecl::getBindingPackExprs() const { +llvm::ArrayRef BindingDecl::getBindingPackDecls() const { assert(Binding && "expecting a pack expr"); - auto *RP = cast(Binding)

[clang] [Clang][NFC] Add test for CWG2285 "Issues with structured bindings" (PR #126421)

2025-02-10 Thread Yanzuo Liu via cfe-commits
@@ -196,6 +196,16 @@ void g() { #endif } // namespace cwg2277 +namespace cwg2285 { // cwg2285: 4 zwuis wrote: > It seems that Clang 5 was the first release which exhibits the correct > behavior: https://godbolt.org/z/qabGrdvPq `-std=c++1z` set `__cplusplus`

[clang] [Clang][NFC] Add test for CWG2285 "Issues with structured bindings" (PR #126421)

2025-02-10 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis updated https://github.com/llvm/llvm-project/pull/126421 >From 92c075ab44bd85550fb3f63c36bd67d41821f385 Mon Sep 17 00:00:00 2001 From: Yanzuo Liu Date: Mon, 10 Feb 2025 00:34:51 +0800 Subject: [PATCH 1/2] Add test for cwg2285 --- clang/lib/Sema/SemaDeclCXX.cpp | 7 ++

[clang] [Clang][NFC] Add test for CWG2285 "Issues with structured bindings" (PR #126421)

2025-02-09 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis created https://github.com/llvm/llvm-project/pull/126421 The resolution of [CWG2285](https://wg21.link/cwg2285) adds the point of declaration of a structured binding, and was implemented in https://github.com/llvm/llvm-project/commit/bdb84f374cde7736ca68d5db2c2ecf54683

[clang] [Clang][Sema] Fix wrong initialization kind when handling initializing structured bindings from an array with direct-list-initialization (PR #124793)

2025-02-07 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis updated https://github.com/llvm/llvm-project/pull/124793 >From 16596add29b63ee0282e026dec7b1d5946863113 Mon Sep 17 00:00:00 2001 From: Yanzuo Liu Date: Wed, 29 Jan 2025 00:38:15 +0800 Subject: [PATCH 1/4] Fix wrong initialization kind --- clang/lib/Sema/SemaInit.cpp

[clang] [Clang][Sema] Fix wrong initialization kind when handling initializing structured bindings from an array with direct-list-initialization (PR #124793)

2025-02-04 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis updated https://github.com/llvm/llvm-project/pull/124793 >From 16596add29b63ee0282e026dec7b1d5946863113 Mon Sep 17 00:00:00 2001 From: Yanzuo Liu Date: Wed, 29 Jan 2025 00:38:15 +0800 Subject: [PATCH 1/4] Fix wrong initialization kind --- clang/lib/Sema/SemaInit.cpp

[clang] [Clang][Sema] Fix wrong initialization kind when handling initializing structured bindings from an array with direct-list-initialization (PR #124793)

2025-02-04 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis updated https://github.com/llvm/llvm-project/pull/124793 >From 16596add29b63ee0282e026dec7b1d5946863113 Mon Sep 17 00:00:00 2001 From: Yanzuo Liu Date: Wed, 29 Jan 2025 00:38:15 +0800 Subject: [PATCH 1/4] Fix wrong initialization kind --- clang/lib/Sema/SemaInit.cpp

[clang] [Clang][Sema] Fix wrong initialization kind when handling initializing structured bindings from an array with direct-list-initialization (PR #124793)

2025-02-03 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis updated https://github.com/llvm/llvm-project/pull/124793 >From 16596add29b63ee0282e026dec7b1d5946863113 Mon Sep 17 00:00:00 2001 From: Yanzuo Liu Date: Wed, 29 Jan 2025 00:38:15 +0800 Subject: [PATCH 1/3] Fix wrong initialization kind --- clang/lib/Sema/SemaInit.cpp

[clang] [Clang][Sema] Fix wrong initialization kind when handling initializing structured bindings from an array with direct-list-initialization (PR #124793)

2025-01-28 Thread Yanzuo Liu via cfe-commits
zwuis wrote: Release note is not needed if this PR is cherry-picked to `release/20.x` branch. https://github.com/llvm/llvm-project/pull/124793 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-c

  1   2   >