[clang] [Clang][NFC] Remove TemplateArgumentList::OnStack (PR #79760)

2024-01-30 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian updated https://github.com/llvm/llvm-project/pull/79760 >From 1f6d9f32e21032b11f6e6a4fd6186ccaee88e2e2 Mon Sep 17 00:00:00 2001 From: Krystian Stasiowski Date: Sun, 28 Jan 2024 11:03:52 -0500 Subject: [PATCH] [Clang][NFC] Remove TemplateArgumentList::OnStack ---

[clang] [Clang][Sema] Diagnose use of template keyword after declarative nested-name-specifiers (PR #78595)

2024-01-30 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian updated https://github.com/llvm/llvm-project/pull/78595 >From ba33d31a3029ab538ae5ddc61609b848ee1261d4 Mon Sep 17 00:00:00 2001 From: Krystian Stasiowski Date: Wed, 17 Jan 2024 10:13:29 -0500 Subject: [PATCH] [Clang][Sema] Diagnose use of template keyword after de

[clang] [Clang][Sema] Diagnose use of template keyword after declarative nested-name-specifiers (PR #78595)

2024-01-30 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian edited https://github.com/llvm/llvm-project/pull/78595 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] Diagnose use of template keyword after declarative nested-name-specifiers (PR #78595)

2024-01-30 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian updated https://github.com/llvm/llvm-project/pull/78595 >From 529d16d3509219b9d1cc74c515ec101b1316b6d1 Mon Sep 17 00:00:00 2001 From: Krystian Stasiowski Date: Wed, 17 Jan 2024 10:13:29 -0500 Subject: [PATCH] [Clang][Sema] Diagnose use of template keyword after de

[clang] [Clang][Sema] Diagnose use of template keyword after declarative nested-name-specifiers (PR #78595)

2024-01-30 Thread Krystian Stasiowski via cfe-commits
sdkrystian wrote: @cor3ntin Addressed your comments. I also added the error to a diagnostics group (`template-in-declaration-name`) https://github.com/llvm/llvm-project/pull/78595 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.l

[clang] [Clang][Sema] Diagnose use of template keyword after declarative nested-name-specifiers (PR #78595)

2024-01-30 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian edited https://github.com/llvm/llvm-project/pull/78595 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][NFC] Remove TemplateArgumentList::OnStack (PR #79760)

2024-01-30 Thread Krystian Stasiowski via cfe-commits
@@ -301,7 +279,9 @@ class TemplateArgumentList final unsigned size() const { return NumArguments; } /// Retrieve a pointer to the template argument list. - const TemplateArgument *data() const { return Arguments; } + const TemplateArgument *data() const { +return get

[clang] [Clang][NFC] Remove TemplateArgumentList::OnStack (PR #79760)

2024-01-30 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian edited https://github.com/llvm/llvm-project/pull/79760 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][NFC] Remove TemplateArgumentList::OnStack (PR #79760)

2024-01-30 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian edited https://github.com/llvm/llvm-project/pull/79760 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Parse] Diagnose member template declarations with multiple declarators (PR #78243)

2024-01-30 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian updated https://github.com/llvm/llvm-project/pull/78243 >From 396f51a606562039242544c8521239c42d8dcb16 Mon Sep 17 00:00:00 2001 From: Krystian Stasiowski Date: Fri, 12 Jan 2024 13:45:15 -0500 Subject: [PATCH 1/2] [Clang][Parse] Diagnose member template declarations

[clang] [Clang][Sema] Diagnose friend declarations with enum elaborated-type-specifier in all language modes (PR #80171)

2024-01-31 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian created https://github.com/llvm/llvm-project/pull/80171 According to [[dcl.type.elab]p4](http://eel.is/c++draft/dcl.type.elab#4): > If an _elaborated-type-specifier_ appears with the `friend` specifier as an > entire _member-declaration_, the _member-declaration_ s

[clang] [Clang][Sema] Diagnose friend declarations with enum elaborated-type-specifier in all language modes (PR #80171)

2024-01-31 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian updated https://github.com/llvm/llvm-project/pull/80171 >From 62e3b97ac668b7a12331b01cb5e11549d28dd533 Mon Sep 17 00:00:00 2001 From: Krystian Stasiowski Date: Wed, 31 Jan 2024 11:09:11 -0500 Subject: [PATCH] [Clang][Sema] Diagnose friend declarations with enum el

[clang] [Clang][Sema] Diagnose friend declarations with enum elaborated-type-specifier in all language modes (PR #80171)

2024-01-31 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian edited https://github.com/llvm/llvm-project/pull/80171 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] Diagnose friend declarations with enum elaborated-type-specifier in all language modes (PR #80171)

2024-02-01 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian updated https://github.com/llvm/llvm-project/pull/80171 >From 16931f5be26b689f6142ffa272e07be50b1d35d6 Mon Sep 17 00:00:00 2001 From: Krystian Stasiowski Date: Wed, 31 Jan 2024 11:09:11 -0500 Subject: [PATCH] [Clang][Sema] Diagnose friend declarations with enum el

[clang] [Clang][NFC] Remove TemplateArgumentList::OnStack (PR #79760)

2024-02-01 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian updated https://github.com/llvm/llvm-project/pull/79760 >From 87b8ab6b6d7f70ae27c766f4038683f9237cc65a Mon Sep 17 00:00:00 2001 From: Krystian Stasiowski Date: Sun, 28 Jan 2024 11:03:52 -0500 Subject: [PATCH] [Clang][NFC] Remove TemplateArgumentList::OnStack ---

[clang] [Clang][NFC] Remove TemplateArgumentList::OnStack (PR #79760)

2024-02-01 Thread Krystian Stasiowski via cfe-commits
sdkrystian wrote: @erichkeane I added the following release note: > Removed support for constructing on-stack `TemplateArgumentList`s. Interfaces > should instead use `ArrayRef` to pass template arguments. I'm not entirely sure how to benchmark these changes. Perhaps I could determine the diff

[clang] [Clang][NFC] Remove TemplateArgumentList::OnStack (PR #79760)

2024-02-01 Thread Krystian Stasiowski via cfe-commits
sdkrystian wrote: @erichkeane I ended up writing a python script that compiles the TUs in `clang/lib` with `-print-stats` and then sums up the total bytes allocated by `ASTContext`. Ended up with a 0.4% decrease in memory usage. This does however rely on `compile_commands.json`, and boost does

[clang] [Clang][Parse] Diagnose member template declarations with multiple declarators (PR #78243)

2024-02-01 Thread Krystian Stasiowski via cfe-commits
sdkrystian wrote: Ping @erichkeane https://github.com/llvm/llvm-project/pull/78243 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][NFC] Remove TemplateArgumentList::OnStack (PR #79760)

2024-02-01 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian updated https://github.com/llvm/llvm-project/pull/79760 >From 2e3e1a1dcaf1a6483e326c0d537af50e264098bb Mon Sep 17 00:00:00 2001 From: Krystian Stasiowski Date: Sun, 28 Jan 2024 11:03:52 -0500 Subject: [PATCH] [Clang][NFC] Remove TemplateArgumentList::OnStack ---

[clang] [Clang][NFC] Remove TemplateArgumentList::OnStack (PR #79760)

2024-02-01 Thread Krystian Stasiowski via cfe-commits
sdkrystian wrote: @erichkeane How does this sound? > Removed support for constructing on-stack `TemplateArgumentList`s; interfaces > should instead use `ArrayRef` to pass template arguments. > This reduces AST memory usage by 0.4% when compiling clang. https://github.com/llvm/llvm-project/pu

[clang] [Clang][Parse] Diagnose member template declarations with multiple declarators (PR #78243)

2024-02-01 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian updated https://github.com/llvm/llvm-project/pull/78243 >From 2f691fa57791b40c7598df9b83f3ba3417c07c39 Mon Sep 17 00:00:00 2001 From: Krystian Stasiowski Date: Fri, 12 Jan 2024 13:45:15 -0500 Subject: [PATCH 1/2] [Clang][Parse] Diagnose member template declarations

[clang] [Clang][Parse] Diagnose member template declarations with multiple declarators (PR #78243)

2024-02-01 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian updated https://github.com/llvm/llvm-project/pull/78243 >From 07999d290eaf5476189865b8050153d1e25011d2 Mon Sep 17 00:00:00 2001 From: Krystian Stasiowski Date: Fri, 12 Jan 2024 13:45:15 -0500 Subject: [PATCH] [Clang][Parse] Diagnose member template declarations wit

[clang] [Clang][NFC] Remove TemplateArgumentList::OnStack (PR #79760)

2024-02-01 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian updated https://github.com/llvm/llvm-project/pull/79760 >From 2ea817f2103cf146e21128358c1064871a309664 Mon Sep 17 00:00:00 2001 From: Krystian Stasiowski Date: Sun, 28 Jan 2024 11:03:52 -0500 Subject: [PATCH] [Clang][NFC] Remove TemplateArgumentList::OnStack ---

[clang] [Clang][Parse] Diagnose member template declarations with multiple declarators (PR #78243)

2024-02-01 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian closed https://github.com/llvm/llvm-project/pull/78243 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] Diagnose friend declarations with enum elaborated-type-specifier in all language modes (PR #80171)

2024-02-01 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian updated https://github.com/llvm/llvm-project/pull/80171 >From a39aab07696acfea3e3b78d6ad92c8b771eaf0d2 Mon Sep 17 00:00:00 2001 From: Krystian Stasiowski Date: Wed, 31 Jan 2024 11:09:11 -0500 Subject: [PATCH 1/2] [Clang][Sema] Diagnose friend declarations with enum

[clang] [Clang][Sema] Diagnose friend declarations with enum elaborated-type-specifier in all language modes (PR #80171)

2024-02-01 Thread Krystian Stasiowski via cfe-commits
sdkrystian wrote: @cor3ntin I added a test with a note stating that [CWG2363](http://wg21.link/CWG2363) was closed as NAD https://github.com/llvm/llvm-project/pull/80171 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cg

[clang] [Clang][NFC] Remove TemplateArgumentList::OnStack (PR #79760)

2024-02-01 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian closed https://github.com/llvm/llvm-project/pull/79760 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] Diagnose use of template keyword after declarative nested-name-specifiers (PR #78595)

2024-02-01 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian updated https://github.com/llvm/llvm-project/pull/78595 >From 3c211c6fb78f48dc68634e042e94dbe2f33fb999 Mon Sep 17 00:00:00 2001 From: Krystian Stasiowski Date: Wed, 17 Jan 2024 10:13:29 -0500 Subject: [PATCH] [Clang][Sema] Diagnose use of template keyword after de

[clang] [Clang][Sema] Diagnose friend declarations with enum elaborated-type-specifier in all language modes (PR #80171)

2024-02-01 Thread Krystian Stasiowski via cfe-commits
@@ -17534,79 +17534,6 @@ Decl *Sema::BuildStaticAssertDeclaration(SourceLocation StaticAssertLoc, return Decl; } -/// Perform semantic analysis of the given friend type declaration. -/// -/// \returns A friend declaration that. -FriendDecl *Sema::CheckFriendTypeDecl(SourceL

[clang] [Clang][Sema] Correctly look up primary template for variable template specializations (PR #80359)

2024-02-01 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian created https://github.com/llvm/llvm-project/pull/80359 Consider the following: ```cpp namespace N0 { namespace N1 { template int x1 = 0; } using namespace N1; } template<> int N0::x1; ``` According to [[dcl.meaning.general] p3.3](http://eel.is/c++dr

[clang] [Clang][Sema] Correctly look up primary template for variable template specializations (PR #80359)

2024-02-01 Thread Krystian Stasiowski via cfe-commits
sdkrystian wrote: Still need to add a release note, but this should otherwise complete https://github.com/llvm/llvm-project/pull/80359 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] Correctly look up primary template for variable template specializations (PR #80359)

2024-02-01 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian edited https://github.com/llvm/llvm-project/pull/80359 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] Correctly look up primary template for variable template specializations (PR #80359)

2024-02-01 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian edited https://github.com/llvm/llvm-project/pull/80359 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] Correctly look up primary template for variable template specializations (PR #80359)

2024-02-02 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian updated https://github.com/llvm/llvm-project/pull/80359 >From f23e899cd409463c6934b09929e3deb4a69205ef Mon Sep 17 00:00:00 2001 From: Krystian Stasiowski Date: Thu, 1 Feb 2024 17:34:59 -0500 Subject: [PATCH] [Clang][Sema] Correctly look up primary template for vari

[clang] [Clang][Sema] Correctly look up primary template for variable template specializations (PR #80359)

2024-02-02 Thread Krystian Stasiowski via cfe-commits
sdkrystian wrote: @erichkeane Release note added https://github.com/llvm/llvm-project/pull/80359 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] Correctly look up primary template for variable template specializations (PR #80359)

2024-02-02 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian closed https://github.com/llvm/llvm-project/pull/80359 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] Diagnose use of template keyword after declarative nested-name-specifiers (PR #78595)

2024-02-02 Thread Krystian Stasiowski via cfe-commits
sdkrystian wrote: @erichkeane cor3ntin approved... please take a look when you have time https://github.com/llvm/llvm-project/pull/78595 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] Diagnose use of template keyword after declarative nested-name-specifiers (PR #78595)

2024-02-02 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian updated https://github.com/llvm/llvm-project/pull/78595 >From 44689d064a5e4c908c0011532302e9b84e060fab Mon Sep 17 00:00:00 2001 From: Krystian Stasiowski Date: Wed, 17 Jan 2024 10:13:29 -0500 Subject: [PATCH] [Clang][Sema] Diagnose use of template keyword after de

[clang] [Clang][Sema] Diagnose use of template keyword after declarative nested-name-specifiers (PR #78595)

2024-02-02 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian closed https://github.com/llvm/llvm-project/pull/78595 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[libcxx] [clang] [Clang][libc++] Implement __is_nothrow_convertible and use it in libc++ (PR #80436)

2024-02-02 Thread Krystian Stasiowski via cfe-commits
sdkrystian wrote: @philnik777 https://lab.llvm.org/buildbot/#/builders/46/builds/63116 https://github.com/llvm/llvm-project/pull/80436 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Reapply "[Clang][Sema] Diagnose function/variable templates that shadow their own template parameters (#78274)" (PR #79683)

2024-02-05 Thread Krystian Stasiowski via cfe-commits
sdkrystian wrote: Ping @cor3ntin https://github.com/llvm/llvm-project/pull/79683 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] Diagnose function/variable templates that shadow their own template parameters (PR #78274)

2024-01-24 Thread Krystian Stasiowski via cfe-commits
sdkrystian wrote: @cor3ntin @AaronBallman I can work on reapplying this tomorrow. Do we want a flag that allows _all_ template parameter shadowing as a warning, or only in this particular case? https://github.com/llvm/llvm-project/pull/78274 ___ cfe

[clang] [Clang][Parse] Diagnose member template declarations with multiple declarators (PR #78243)

2024-01-26 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian updated https://github.com/llvm/llvm-project/pull/78243 >From 357d4665dac2da1d7899b72f1249de7bc8760342 Mon Sep 17 00:00:00 2001 From: Krystian Stasiowski Date: Fri, 12 Jan 2024 13:45:15 -0500 Subject: [PATCH 1/2] [Clang][Parse] Diagnose member template declarations

[clang] [Clang][Parse] Diagnose member template declarations with multiple declarators (PR #78243)

2024-01-26 Thread Krystian Stasiowski via cfe-commits
sdkrystian wrote: @erichkeane I have refactored `ParseSingleDeclarationAfterTemplate` (now named `ParseDeclarationAfterTemplate`) to call `ParseDeclGroup` and return the resultant `DeclGroup`. With respect to moving the point of diagnosis to `FinalizeDeclaratorGroup`: as of now, the diagnost

[clang] [Clang][Parse] Diagnose member template declarations with multiple declarators (PR #78243)

2024-01-26 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian updated https://github.com/llvm/llvm-project/pull/78243 >From c84243067045958d1d3007bd07bd49b7d4bfc642 Mon Sep 17 00:00:00 2001 From: Krystian Stasiowski Date: Fri, 12 Jan 2024 13:45:15 -0500 Subject: [PATCH 1/2] [Clang][Parse] Diagnose member template declarations

[clang] [Clang][Sema] Diagnose use of template keyword after declarative nested-name-specifiers (PR #78595)

2024-01-26 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian updated https://github.com/llvm/llvm-project/pull/78595 >From 75524a1f443c86787f0605d7890a1caa01c5ebf5 Mon Sep 17 00:00:00 2001 From: Krystian Stasiowski Date: Wed, 17 Jan 2024 10:13:29 -0500 Subject: [PATCH 1/2] [Clang][Sema] Diagnose use of template keyword after

[clang] [Clang][Sema] Allow elaborated-type-specifiers that declare member class template explict specializations (PR #78720)

2024-01-26 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian updated https://github.com/llvm/llvm-project/pull/78720 >From 7a08876edcbae41cfbc1595348cd0c66ea813d7c Mon Sep 17 00:00:00 2001 From: Krystian Stasiowski Date: Fri, 19 Jan 2024 08:37:21 -0500 Subject: [PATCH] [Clang][Sema] Allow elaborated-type-specifiers that decl

[clang] Reapply "[Clang][Sema] Diagnose function/variable templates that shadow their own template parameters (#78274)" (PR #79683)

2024-01-27 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian created https://github.com/llvm/llvm-project/pull/79683 Reapplies #78274 with the addition of a default-error warning (`strict-primary-template-shadow`) that is issued for instances of shadowing which were previously accepted prior to this patch. >From abc8f062a

[clang] [Clang][Sema] Diagnose function/variable templates that shadow their own template parameters (PR #78274)

2024-01-27 Thread Krystian Stasiowski via cfe-commits
sdkrystian wrote: See #79683 https://github.com/llvm/llvm-project/pull/78274 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Reapply "[Clang][Sema] Diagnose function/variable templates that shadow their own template parameters (#78274)" (PR #79683)

2024-01-27 Thread Krystian Stasiowski via cfe-commits
sdkrystian wrote: Need to run clang-format on this and mention the flag in the release notes, but should be otherwise GTG https://github.com/llvm/llvm-project/pull/79683 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cg

[clang] Reapply "[Clang][Sema] Diagnose function/variable templates that shadow their own template parameters (#78274)" (PR #79683)

2024-01-27 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian edited https://github.com/llvm/llvm-project/pull/79683 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Reapply "[Clang][Sema] Diagnose function/variable templates that shadow their own template parameters (#78274)" (PR #79683)

2024-01-27 Thread Krystian Stasiowski via cfe-commits
@@ -6506,12 +6500,25 @@ NamedDecl *Sema::HandleDeclarator(Scope *S, Declarator &D, RemoveUsingDecls(Previous); } - if (Previous.isSingleResult() && - Previous.getFoundDecl()->isTemplateParameter()) { + // if (Previous.isSingleResult() && + //Previous.getFoun

[clang] Reapply "[Clang][Sema] Diagnose function/variable templates that shadow their own template parameters (#78274)" (PR #79683)

2024-01-27 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian updated https://github.com/llvm/llvm-project/pull/79683 >From 391254191932c8ca325346978de5c57b233cbab8 Mon Sep 17 00:00:00 2001 From: Krystian Stasiowski Date: Tue, 16 Jan 2024 08:05:33 -0500 Subject: [PATCH] Reapply "[Clang][Sema] Diagnose function/variable templa

[clang] Reapply "[Clang][Sema] Diagnose function/variable templates that shadow their own template parameters (#78274)" (PR #79683)

2024-01-27 Thread Krystian Stasiowski via cfe-commits
@@ -6535,6 +6543,12 @@ NamedDecl *Sema::HandleDeclarator(Scope *S, Declarator &D, if (getLangOpts().CPlusPlus) CheckExtraCXXDefaultArguments(D); + // The scope passed in may not be a decl scope. Zip up the scope tree until + // we find one that is. + while ((S->getF

[clang] Reapply "[Clang][Sema] Diagnose function/variable templates that shadow their own template parameters (#78274)" (PR #79683)

2024-01-27 Thread Krystian Stasiowski via cfe-commits
@@ -885,16 +885,19 @@ bool Sema::DiagnoseUninstantiableTemplate(SourceLocation PointOfInstantiation, /// that the template parameter 'PrevDecl' is being shadowed by a new /// declaration at location Loc. Returns true to indicate that this is /// an error, and false otherwise.

[clang] Reapply "[Clang][Sema] Diagnose function/variable templates that shadow their own template parameters (#78274)" (PR #79683)

2024-01-27 Thread Krystian Stasiowski via cfe-commits
@@ -885,16 +885,19 @@ bool Sema::DiagnoseUninstantiableTemplate(SourceLocation PointOfInstantiation, /// that the template parameter 'PrevDecl' is being shadowed by a new /// declaration at location Loc. Returns true to indicate that this is /// an error, and false otherwise.

[clang] [Clang][NFC] Remove TemplateArgumentList::OnStack (PR #79760)

2024-01-28 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian created https://github.com/llvm/llvm-project/pull/79760 This removes on-stack `TemplateArgumentList`'s. They were primary used to pass an `ArrayRef` to `Sema::getTemplateInstantiationArgs`, which had a `const TemplateArgumentList*` parameter for the innermost temp

[clang] [Clang][Parse] Diagnose member template declarations with multiple declarators (PR #78243)

2024-01-16 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian created https://github.com/llvm/llvm-project/pull/78243 According to [[temp.pre] p5](http://eel.is/c++draft/temp.pre#5): > In a > [template-declaration](http://eel.is/c++draft/temp.pre#nt:template-declaration), > explicit specialization, or explicit instantiation

[clang] [Clang][Parse] Diagnose member template declarations with multiple declarators (PR #78243)

2024-01-16 Thread Krystian Stasiowski via cfe-commits
sdkrystian wrote: Ping @erichkeane https://github.com/llvm/llvm-project/pull/78243 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Parse] Diagnose member template declarations with multiple declarators (PR #78243)

2024-01-16 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian updated https://github.com/llvm/llvm-project/pull/78243 >From b5d814abf6241d3e9cdfcc64109c33c56a896172 Mon Sep 17 00:00:00 2001 From: Krystian Stasiowski Date: Fri, 12 Jan 2024 13:45:15 -0500 Subject: [PATCH] [Clang][Parse] Diagnose member template declarations wit

[clang] [Clang][Sema] Diagnose function/variable templates that shadow their own template parameters (PR #78274)

2024-01-16 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian created https://github.com/llvm/llvm-project/pull/78274 Previously, we skipped through template parameter scopes (until we hit a declaration scope) prior to redeclaration lookup for declarators. For template declarations, the meant that their template parameters w

[clang] [Clang][Sema] Diagnose function/variable templates that shadow their own template parameters (PR #78274)

2024-01-16 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian updated https://github.com/llvm/llvm-project/pull/78274 >From cdd6d0d441a9d2cbd6670890ea2d0c8caff074d1 Mon Sep 17 00:00:00 2001 From: Krystian Stasiowski Date: Tue, 16 Jan 2024 06:28:35 -0500 Subject: [PATCH 1/2] [Clang][Sema][NFC] Remove unused Scope* parameter fr

[clang] [Clang][Sema] Diagnose function/variable templates that shadow their own template parameters (PR #78274)

2024-01-16 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian updated https://github.com/llvm/llvm-project/pull/78274 >From cdd6d0d441a9d2cbd6670890ea2d0c8caff074d1 Mon Sep 17 00:00:00 2001 From: Krystian Stasiowski Date: Tue, 16 Jan 2024 06:28:35 -0500 Subject: [PATCH 1/2] [Clang][Sema][NFC] Remove unused Scope* parameter fr

[clang] [Clang][Parse] Diagnose member template declarations with multiple declarators (PR #78243)

2024-01-16 Thread Krystian Stasiowski via cfe-commits
@@ -3167,6 +3167,15 @@ Parser::ParseCXXClassMemberDeclaration(AccessSpecifier AS, DeclaratorInfo.complete(ThisDecl); +if (TemplateInfo.Kind != ParsedTemplateInfo::NonTemplate) { + if (Tok.is(tok::comma)) { +Diag(Tok, diag::err_multiple_template_declarato

[clang] [Clang][Sema] Diagnose function/variable templates that shadow their own template parameters (PR #78274)

2024-01-16 Thread Krystian Stasiowski via cfe-commits
sdkrystian wrote: Ping @erichkeane (if you are already being pinged automatically please let me know so I'm not double-pinging :) ) https://github.com/llvm/llvm-project/pull/78274 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.l

[clang] [Clang][Sema] Diagnose function/variable templates that shadow their own template parameters (PR #78274)

2024-01-16 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian updated https://github.com/llvm/llvm-project/pull/78274 >From 03e0e75c2793de4429b15acdbd04382ee45b7952 Mon Sep 17 00:00:00 2001 From: Krystian Stasiowski Date: Tue, 16 Jan 2024 06:28:35 -0500 Subject: [PATCH 1/2] [Clang][Sema][NFC] Remove unused Scope* parameter fr

[clang] [Clang][Sema] Diagnose function/variable templates that shadow their own template parameters (PR #78274)

2024-01-16 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian edited https://github.com/llvm/llvm-project/pull/78274 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] Diagnose function/variable templates that shadow their own template parameters (PR #78274)

2024-01-16 Thread Krystian Stasiowski via cfe-commits
sdkrystian wrote: @erichkeane I don't think I can add reviewers [without write access to the repo](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/requesting-a-pull-request-review) unfortunately https://github.com/llvm

[clang] [Clang][Sema] Diagnose function/variable templates that shadow their own template parameters (PR #78274)

2024-01-16 Thread Krystian Stasiowski via cfe-commits
sdkrystian wrote: Alright, I've applied. Thanks! https://github.com/llvm/llvm-project/pull/78274 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] Diagnose function/variable templates that shadow their own template parameters (PR #78274)

2024-01-16 Thread Krystian Stasiowski via cfe-commits
@@ -6070,7 +6070,7 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state, /// /// The result of this call will never be null, but the associated /// type may be a null type if there's an unrecoverable error. -TypeSourceInfo *Sema::GetTypeForDeclarator(D

[clang] [Clang][Parse] Diagnose member template declarations with multiple declarators (PR #78243)

2024-01-16 Thread Krystian Stasiowski via cfe-commits
@@ -3167,6 +3167,15 @@ Parser::ParseCXXClassMemberDeclaration(AccessSpecifier AS, DeclaratorInfo.complete(ThisDecl); +if (TemplateInfo.Kind != ParsedTemplateInfo::NonTemplate) { + if (Tok.is(tok::comma)) { +Diag(Tok, diag::err_multiple_template_declarato

[clang] [Clang][Parse] Diagnose member template declarations with multiple declarators (PR #78243)

2024-01-16 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian updated https://github.com/llvm/llvm-project/pull/78243 >From b5d814abf6241d3e9cdfcc64109c33c56a896172 Mon Sep 17 00:00:00 2001 From: Krystian Stasiowski Date: Fri, 12 Jan 2024 13:45:15 -0500 Subject: [PATCH 1/2] [Clang][Parse] Diagnose member template declarations

[clang] [Clang][Parse] Diagnose member template declarations with multiple declarators (PR #78243)

2024-01-16 Thread Krystian Stasiowski via cfe-commits
@@ -3167,6 +3167,15 @@ Parser::ParseCXXClassMemberDeclaration(AccessSpecifier AS, DeclaratorInfo.complete(ThisDecl); +if (TemplateInfo.Kind != ParsedTemplateInfo::NonTemplate) { + if (Tok.is(tok::comma)) { +Diag(Tok, diag::err_multiple_template_declarato

[clang] [Clang][Parse] Diagnose member template declarations with multiple declarators (PR #78243)

2024-01-16 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian edited https://github.com/llvm/llvm-project/pull/78243 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Parse] Diagnose member template declarations with multiple declarators (PR #78243)

2024-01-16 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian updated https://github.com/llvm/llvm-project/pull/78243 >From b5d814abf6241d3e9cdfcc64109c33c56a896172 Mon Sep 17 00:00:00 2001 From: Krystian Stasiowski Date: Fri, 12 Jan 2024 13:45:15 -0500 Subject: [PATCH 1/2] [Clang][Parse] Diagnose member template declarations

[clang] [Clang][Parse] Diagnose member template declarations with multiple declarators (PR #78243)

2024-01-16 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian updated https://github.com/llvm/llvm-project/pull/78243 >From b5d814abf6241d3e9cdfcc64109c33c56a896172 Mon Sep 17 00:00:00 2001 From: Krystian Stasiowski Date: Fri, 12 Jan 2024 13:45:15 -0500 Subject: [PATCH 1/2] [Clang][Parse] Diagnose member template declarations

[clang] [Clang][Sema] Diagnose function/variable templates that shadow their own template parameters (PR #78274)

2024-01-16 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian updated https://github.com/llvm/llvm-project/pull/78274 >From 90d66e29f3550d50bd114d68fc8b12156e26de18 Mon Sep 17 00:00:00 2001 From: Krystian Stasiowski Date: Tue, 16 Jan 2024 08:05:33 -0500 Subject: [PATCH] [Clang][Sema] Diagnose function/variable templates that

[clang] [Clang][Sema][NFC] Remove unused Scope* parameter from Sema::GetTypeForDeclarator and Sema::ActOnTypeName (PR #78325)

2024-01-16 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian created https://github.com/llvm/llvm-project/pull/78325 Split from #78274 >From 03e0e75c2793de4429b15acdbd04382ee45b7952 Mon Sep 17 00:00:00 2001 From: Krystian Stasiowski Date: Tue, 16 Jan 2024 06:28:35 -0500 Subject: [PATCH] [Clang][Sema][NFC] Remove unused Scop

[clang] [Clang][Sema] Diagnose function/variable templates that shadow their own template parameters (PR #78274)

2024-01-16 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian edited https://github.com/llvm/llvm-project/pull/78274 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] Diagnose function/variable templates that shadow their own template parameters (PR #78274)

2024-01-16 Thread Krystian Stasiowski via cfe-commits
@@ -6070,7 +6070,7 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state, /// /// The result of this call will never be null, but the associated /// type may be a null type if there's an unrecoverable error. -TypeSourceInfo *Sema::GetTypeForDeclarator(D

[clang] [Clang][Sema][NFC] Remove unused Scope* parameter from Sema::GetTypeForDeclarator and Sema::ActOnTypeName (PR #78325)

2024-01-17 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian updated https://github.com/llvm/llvm-project/pull/78325 >From a35415e1282fa988c4e5b0d27704b63a6f20a7c5 Mon Sep 17 00:00:00 2001 From: Krystian Stasiowski Date: Tue, 16 Jan 2024 06:28:35 -0500 Subject: [PATCH] [Clang][Sema][NFC] Remove unused Scope* parameter from

[clang] [Clang][Sema][NFC] Remove unused Scope* parameter from Sema::GetTypeForDeclarator and Sema::ActOnTypeName (PR #78325)

2024-01-17 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian closed https://github.com/llvm/llvm-project/pull/78325 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] Diagnose function/variable templates that shadow their own template parameters (PR #78274)

2024-01-17 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian updated https://github.com/llvm/llvm-project/pull/78274 >From 4ac6eb855fc302214a0cd0bcd15af351981eaf02 Mon Sep 17 00:00:00 2001 From: Krystian Stasiowski Date: Tue, 16 Jan 2024 08:05:33 -0500 Subject: [PATCH] [Clang][Sema] Diagnose function/variable templates that

[clang] [Clang][Sema] Diagnose function/variable templates that shadow their own template parameters (PR #78274)

2024-01-17 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian closed https://github.com/llvm/llvm-project/pull/78274 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] Diagnose use of template keyword in declarative nested-… (PR #78595)

2024-01-18 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian created https://github.com/llvm/llvm-project/pull/78595 According to [[temp.names] p5](http://eel.is/c++draft/temp.names#5): > The keyword template shall not appear immediately after a declarative > [nested-name-specifier](http://eel.is/c++draft/expr.prim.id.qual#n

[clang] [Clang][Sema] Diagnose use of template keyword in declarative nested-name-specifiers (PR #78595)

2024-01-18 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian edited https://github.com/llvm/llvm-project/pull/78595 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] Diagnose use of template keyword in declarative nested-name-specifiers (PR #78595)

2024-01-18 Thread Krystian Stasiowski via cfe-commits
sdkrystian wrote: (still need to add a release note) https://github.com/llvm/llvm-project/pull/78595 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] Diagnose use of template keyword in declarative nested-name-specifiers (PR #78595)

2024-01-18 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian updated https://github.com/llvm/llvm-project/pull/78595 >From c0babaca73a6451bdefd4ba3a28976e2d7dd136a Mon Sep 17 00:00:00 2001 From: Krystian Stasiowski Date: Wed, 17 Jan 2024 10:13:29 -0500 Subject: [PATCH] [Clang][Sema] Diagnose use of template keyword in declar

[clang] [Clang][Sema] Diagnose use of template keyword after declarative nested-name-specifiers (PR #78595)

2024-01-18 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian edited https://github.com/llvm/llvm-project/pull/78595 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] Diagnose function/variable templates that shadow their own template parameters (PR #78274)

2024-01-18 Thread Krystian Stasiowski via cfe-commits
sdkrystian wrote: @zmodem template parameter shadowing is an extension with `-fms-compatibility`, if that works https://github.com/llvm/llvm-project/pull/78274 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mail

[clang] [Clang][Sema] Diagnose use of template keyword after declarative nested-name-specifiers (PR #78595)

2024-01-18 Thread Krystian Stasiowski via cfe-commits
@@ -182,8 +182,8 @@ struct Bad2 { int a, b; }; } // namespace dr2386 namespace std { template struct tuple_size; -template <> struct std::tuple_size {}; sdkrystian wrote: @Endilll if left unchanged this will result in a warning about redundant qualification,

[clang] [Clang][Sema] Diagnose use of template keyword after declarative nested-name-specifiers (PR #78595)

2024-01-18 Thread Krystian Stasiowski via cfe-commits
sdkrystian wrote: @cor3ntin Pedantic warning would probably be best as other implementations are not great at diagnosing this https://github.com/llvm/llvm-project/pull/78595 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.or

[clang] [Clang][Sema] Diagnose use of template keyword after declarative nested-name-specifiers (PR #78595)

2024-01-18 Thread Krystian Stasiowski via cfe-commits
@@ -182,8 +182,8 @@ struct Bad2 { int a, b; }; } // namespace dr2386 namespace std { template struct tuple_size; -template <> struct std::tuple_size {}; sdkrystian wrote: It is, yes https://github.com/llvm/llvm-project/pull/78595

[clang] [Clang][Parse] Diagnose member template declarations with multiple declarators (PR #78243)

2024-01-18 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian updated https://github.com/llvm/llvm-project/pull/78243 >From 2bb667e61d2f07d216e6744d72d8b73a638f2d5d Mon Sep 17 00:00:00 2001 From: Krystian Stasiowski Date: Fri, 12 Jan 2024 13:45:15 -0500 Subject: [PATCH 1/2] [Clang][Parse] Diagnose member template declarations

[clang] [Clang][Sema] Allow elaborated-type-specifiers that declare member class template explict specializations (PR #78720)

2024-01-19 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian created https://github.com/llvm/llvm-project/pull/78720 According to [[dcl.type.elab] p2](http://eel.is/c++draft/dcl.type.elab#2): > If an > [elaborated-type-specifier](http://eel.is/c++draft/dcl.type.elab#nt:elaborated-type-specifier) > is the sole constituent of

[clang] [Clang][Sema] Allow elaborated-type-specifiers that declare member class template explict specializations (PR #78720)

2024-01-19 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian updated https://github.com/llvm/llvm-project/pull/78720 >From 99823bcb04c5c6a1ab33ea3e75829eae5a76de14 Mon Sep 17 00:00:00 2001 From: Krystian Stasiowski Date: Fri, 19 Jan 2024 08:37:21 -0500 Subject: [PATCH] [Clang][Sema] Allow elaborated-type-specifiers that decl

[clang] [Clang][Sema] Diagnose use of template keyword after declarative nested-name-specifiers (PR #78595)

2024-01-19 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian updated https://github.com/llvm/llvm-project/pull/78595 >From c07119d8e85e4bd9849e8d0b5dc8edb5384d9b91 Mon Sep 17 00:00:00 2001 From: Krystian Stasiowski Date: Wed, 17 Jan 2024 10:13:29 -0500 Subject: [PATCH] [Clang][Sema] Diagnose use of template keyword after de

[clang] [Clang][Sema] Diagnose use of template keyword after declarative nested-name-specifiers (PR #78595)

2024-01-19 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian updated https://github.com/llvm/llvm-project/pull/78595 >From f72b5e65817e9c25ec0fcabbf0a6bf684066a046 Mon Sep 17 00:00:00 2001 From: Krystian Stasiowski Date: Wed, 17 Jan 2024 10:13:29 -0500 Subject: [PATCH] [Clang][Sema] Diagnose use of template keyword after de

[clang] [Clang][Sema] Diagnose use of template keyword after declarative nested-name-specifiers (PR #78595)

2024-01-19 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian updated https://github.com/llvm/llvm-project/pull/78595 >From f72b5e65817e9c25ec0fcabbf0a6bf684066a046 Mon Sep 17 00:00:00 2001 From: Krystian Stasiowski Date: Wed, 17 Jan 2024 10:13:29 -0500 Subject: [PATCH 1/2] [Clang][Sema] Diagnose use of template keyword after

[clang] [Clang][Sema] Diagnose use of template keyword after declarative nested-name-specifiers (PR #78595)

2024-01-19 Thread Krystian Stasiowski via cfe-commits
sdkrystian wrote: @cor3ntin I changed the diagnostic to a pedantic warning and added a release note. > I wonder if we should add tests for > https://cplusplus.github.io/CWG/issues/1707.html in this patch. We don't check for the template keyword when parsing an _elaborated-type-specifier_ wi

<    1   2   3   4   5   6   7   8   9   10   >