[clang] [llvm] [AMDGPU] Adding the amdgpu-num-work-groups function attribute (PR #79035)

2024-02-12 Thread Erich Keane via cfe-commits
@@ -2705,6 +2705,30 @@ An error will be given if: }]; } +def AMDGPUNumWorkGroupsDocs : Documentation { + let Category = DocCatAMDGPUAttributes; + let Content = [{ +The number of work groups specifies the number of work groups when the kernel +is dispatched. + +Clang

[clang] [llvm] [AMDGPU] Adding the amdgpu-num-work-groups function attribute (PR #79035)

2024-02-12 Thread Erich Keane via cfe-commits
@@ -2705,6 +2705,30 @@ An error will be given if: }]; } +def AMDGPUNumWorkGroupsDocs : Documentation { + let Category = DocCatAMDGPUAttributes; + let Content = [{ +The number of work groups specifies the number of work groups when the kernel erichkeane

[clang] [llvm] [AMDGPU] Adding the amdgpu-num-work-groups function attribute (PR #79035)

2024-02-12 Thread Erich Keane via cfe-commits
@@ -2705,6 +2705,30 @@ An error will be given if: }]; } +def AMDGPUNumWorkGroupsDocs : Documentation { + let Category = DocCatAMDGPUAttributes; + let Content = [{ +The number of work groups specifies the number of work groups when the kernel +is dispatched. + +Clang

[clang] [llvm] [AMDGPU] Adding the amdgpu-num-work-groups function attribute (PR #79035)

2024-02-12 Thread Erich Keane via cfe-commits
@@ -2031,6 +2031,13 @@ def AMDGPUNumVGPR : InheritableAttr { let Subjects = SubjectList<[Function], ErrorDiag, "kernel functions">; } +def AMDGPUNumWorkGroups : InheritableAttr { + let Spellings = [Clang<"amdgpu_num_work_groups", 0>]; + let Args =

[clang] [clang] Support `__is_trivially_copyable(int()&)==false` (PR #81298)

2024-02-12 Thread Erich Keane via cfe-commits
@@ -57,7 +57,7 @@ UNION(char[2], short) u2 = { .one = { 'a', 'b' } }; // ext-warning 3 {{'_Static_ typedef UNION(char, short) U3; // expected-error {{static assertion failed due to requirement 'sizeof(char) == sizeof(short)': type size mismatch}} \

[clang] [clang] Support `__is_trivially_copyable(int()&)==false` (PR #81298)

2024-02-12 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: This would need a release note + I think it needs better testing. @AaronBallman might wish to take a look as well, this is his code ownership. https://github.com/llvm/llvm-project/pull/81298 ___ cfe-commits

[clang] [clang] Support `__is_trivially_copyable(int()&)==false` (PR #81298)

2024-02-12 Thread Erich Keane via cfe-commits
https://github.com/erichkeane edited https://github.com/llvm/llvm-project/pull/81298 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Avoid printing overly large integer. (PR #75902)

2024-02-12 Thread Erich Keane via cfe-commits
=?utf-8?q?“Nhat?= , =?utf-8?q?“Nhat?= , =?utf-8?q?“Nhat?= , =?utf-8?q?“Nhat?= , =?utf-8?q?“Nhat?= ,Nhat Nguyen Message-ID: In-Reply-To: erichkeane wrote: Looks like all the tests disappeared? Only thing I see is the code change. Also, no release note is currently present.

[clang] [clang][NFC] Refactor `Sema::TemplateDeductionResult` (PR #81398)

2024-02-12 Thread Erich Keane via cfe-commits
@@ -11445,11 +11452,16 @@ static void DiagnoseBadDeduction(Sema , NamedDecl *Found, Decl *Templated, (ParamD = Param.dyn_cast()) || (ParamD = Param.dyn_cast()) || (ParamD = Param.dyn_cast()); - switch (DeductionFailure.Result) { - case Sema::TDK_Success: -

[clang] [clang][NFC] Refactor `Sema::TemplateDeductionResult` (PR #81398)

2024-02-12 Thread Erich Keane via cfe-commits
@@ -33,6 +33,7 @@ namespace clang { class Decl; struct DeducedPack; class Sema; +enum class TemplateDeductionResult; erichkeane wrote: should we specify the underlying type in all of these? I wonder if we can just specify it as `uint8_t`? Would mean not

[clang] [clang] Avoid -Wshadow warning when init-capture named same as class field (PR #74512)

2024-02-09 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. https://github.com/llvm/llvm-project/pull/74512 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Add some CodeGen tests for CWG 2xx issues (PR #80823)

2024-02-09 Thread Erich Keane via cfe-commits
@@ -6,28 +6,36 @@ // RUN: %clang_cc1 -std=c++23 %s -triple x86_64-linux-gnu -emit-llvm -disable-llvm-passes -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK // RUN: %clang_cc1 -std=c++2c %s -triple x86_64-linux-gnu

[clang] [clang] Add some CodeGen tests for CWG 2xx issues (PR #80823)

2024-02-09 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. LGTM, make sure @cor3ntin is happy too though. https://github.com/llvm/llvm-project/pull/80823 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [clang] Add some CodeGen tests for CWG 2xx issues (PR #80823)

2024-02-09 Thread Erich Keane via cfe-commits
https://github.com/erichkeane edited https://github.com/llvm/llvm-project/pull/80823 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Add some CodeGen tests for CWG 2xx issues (PR #80823)

2024-02-09 Thread Erich Keane via cfe-commits
@@ -0,0 +1,33 @@ +// RUN: %clang_cc1 -std=c++98 %s -triple x86_64-linux-gnu -emit-llvm -disable-llvm-passes -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK +// RUN: %clang_cc1 -std=c++11 %s -triple x86_64-linux-gnu

[clang] [clang] Add some CodeGen tests for CWG 1xx issues (PR #80338)

2024-02-09 Thread Erich Keane via cfe-commits
@@ -0,0 +1,51 @@ +// RUN: %clang_cc1 -std=c++98 %s -triple x86_64-linux-gnu -emit-llvm -disable-llvm-passes -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK +// RUN: %clang_cc1 -std=c++11 %s -triple x86_64-linux-gnu

[clang] [OpenACC] Implement AST for OpenACC Compute Constructs (PR #81188)

2024-02-09 Thread Erich Keane via cfe-commits
@@ -0,0 +1,142 @@ +//===- StmtOpenACC.h - Classes for OpenACC directives --*- 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:

[clang] [clang] Add some CodeGen tests for CWG 2xx issues (PR #80823)

2024-02-09 Thread Erich Keane via cfe-commits
@@ -0,0 +1,43 @@ +// RUN: %clang_cc1 -std=c++98 %s -triple x86_64-linux-gnu -emit-llvm -disable-llvm-passes -O0 -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK +// RUN: %clang_cc1 -std=c++11 %s -triple x86_64-linux-gnu

[clang] [clang] Add some CodeGen tests for CWG 2xx issues (PR #80823)

2024-02-09 Thread Erich Keane via cfe-commits
@@ -0,0 +1,33 @@ +// RUN: %clang_cc1 -std=c++98 %s -triple x86_64-linux-gnu -emit-llvm -disable-llvm-passes -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK +// RUN: %clang_cc1 -std=c++11 %s -triple x86_64-linux-gnu

[clang] [OpenACC] Implement AST for OpenACC Compute Constructs (PR #81188)

2024-02-09 Thread Erich Keane via cfe-commits
https://github.com/erichkeane updated https://github.com/llvm/llvm-project/pull/81188 >From b7ca554663c4d0994ac255ee17ac016ef94f6778 Mon Sep 17 00:00:00 2001 From: erichkeane Date: Thu, 8 Feb 2024 07:56:30 -0800 Subject: [PATCH 1/4] [OpenACC] Implement AST for OpenACC Compute Constructs

[clang] [OpenACC] Implement AST for OpenACC Compute Constructs (PR #81188)

2024-02-09 Thread Erich Keane via cfe-commits
@@ -2145,7 +2145,11 @@ enum CXCursorKind { */ CXCursor_OMPScopeDirective = 306, - CXCursor_LastStmt = CXCursor_OMPScopeDirective, + /** OpenACC Compute Construct. + */ + CXCursor_OpenACCComputeConstruct = 307, erichkeane wrote: Thats a good idea,

[clang] [OpenACC] Implement AST for OpenACC Compute Constructs (PR #81188)

2024-02-09 Thread Erich Keane via cfe-commits
@@ -0,0 +1,142 @@ +//===- StmtOpenACC.h - Classes for OpenACC directives --*- 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:

[clang] [OpenACC] Implement AST for OpenACC Compute Constructs (PR #81188)

2024-02-09 Thread Erich Keane via cfe-commits
https://github.com/erichkeane updated https://github.com/llvm/llvm-project/pull/81188 >From b7ca554663c4d0994ac255ee17ac016ef94f6778 Mon Sep 17 00:00:00 2001 From: erichkeane Date: Thu, 8 Feb 2024 07:56:30 -0800 Subject: [PATCH 1/3] [OpenACC] Implement AST for OpenACC Compute Constructs

[clang] [clang] Avoid -Wshadow warning when init-capture named same as class field (PR #74512)

2024-02-09 Thread Erich Keane via cfe-commits
erichkeane wrote: > cc @erichkeane @AaronBallman I looked through and don't see anything of concern to me that you haven't covered. I am on the fence as to whether this warning makes sense to have in this situation. The point of the warning isn't that the language has a problem, it is

[clang] Diagnose misuse of the cleanup attribute (PR #80040)

2024-02-09 Thread Erich Keane via cfe-commits
@@ -3780,6 +3780,30 @@ static void handleCleanupAttr(Sema , Decl *D, const ParsedAttr ) { << NI.getName() << ParamTy << Ty; return; } + VarDecl *VD = cast(D); + // Create a reference to the variable declaration. This is a fake/dummy + // reference. +

[clang] [OpenACC] Implement AST for OpenACC Compute Constructs (PR #81188)

2024-02-08 Thread Erich Keane via cfe-commits
@@ -0,0 +1,140 @@ +//===- StmtOpenACC.h - Classes for OpenACC directives --*- 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:

[clang] [OpenACC] Implement AST for OpenACC Compute Constructs (PR #81188)

2024-02-08 Thread Erich Keane via cfe-commits
@@ -0,0 +1,140 @@ +//===- StmtOpenACC.h - Classes for OpenACC directives --*- 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:

[clang] [OpenACC] Implement AST for OpenACC Compute Constructs (PR #81188)

2024-02-08 Thread Erich Keane via cfe-commits
@@ -2838,6 +2838,27 @@ void ASTStmtWriter::VisitOMPTargetParallelGenericLoopDirective( Code = serialization::STMT_OMP_TARGET_PARALLEL_GENERIC_LOOP_DIRECTIVE; } +//===--===// +// OpenACC

[clang] [OpenACC] Implement AST for OpenACC Compute Constructs (PR #81188)

2024-02-08 Thread Erich Keane via cfe-commits
https://github.com/erichkeane edited https://github.com/llvm/llvm-project/pull/81188 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Open acc ast start[OpenACC] Implement AST for OpenACC Compute Constructs (PR #81188)

2024-02-08 Thread Erich Keane via cfe-commits
https://github.com/erichkeane created https://github.com/llvm/llvm-project/pull/81188 'serial', 'parallel', and 'kernel' constructs are all considered 'Compute' constructs. This patch creates the AST type, plus the required infrastructure for such a type, plus some base types that will be

[clang-tools-extra] [clang-tidy] Fix failing test after #80864 (PR #81171)

2024-02-08 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. This seems right to me, though a 2nd reviewer would be nice. I don't think we should wait for CI on this due to it fixing a bot-breakage. https://github.com/llvm/llvm-project/pull/81171 ___

[clang] [Clang][Sema] Abbreviated function templates do not append invented parameters to empty template parameter lists (PR #80864)

2024-02-08 Thread Erich Keane via cfe-commits
erichkeane wrote: > Looks like there is a test > (`clang-tools-extra/test/clang-tidy/infrastructure/diagnostic.cpp`) that > contains the following: > > ```c++ > #ifdef PR64602 // Should not crash > template > struct S > { > auto foo(auto); > }; > > template <> > auto S<>::foo(auto) > {

[clang] [Clang][C++23] Implement P1774R8: Portable assumptions (PR #81014)

2024-02-08 Thread Erich Keane via cfe-commits
erichkeane wrote: > > > We also need to figure out what to do w/ `clang::assume`, because the > > > entire situation with the two being separate attributes is a bit of a > > > mess, as @erichkeane also pointed out. That can probably be resolved > > > separately from the RFC, however—though

[clang] [Clang][Sema] Abbreviated function templates do not append invented parameters to empty template parameter lists (PR #80864)

2024-02-08 Thread Erich Keane via cfe-commits
erichkeane wrote: > Looks like there is a test > (`clang-tools-extra/test/clang-tidy/infrastructure/diagnostic.cpp`) that > contains the following: > > ```c++ > #ifdef PR64602 // Should not crash > template > struct S > { > auto foo(auto); > }; > > template <> > auto S<>::foo(auto) > {

[clang] [Clang][C++23] Implement P1774R8: Portable assumptions (PR #81014)

2024-02-08 Thread Erich Keane via cfe-commits
erichkeane wrote: > We also need to figure out what to do w/ `clang::assume`, because the entire > situation with the two being separate attributes is a bit of a mess, as > @erichkeane also pointed out. That can probably be resolved separately from > the RFC, however—though I’m not that

[clang] [Clang][Sema] Abbreviated function templates do not append invented parameters to empty template parameter lists (PR #80864)

2024-02-08 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. https://github.com/llvm/llvm-project/pull/80864 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] Properly get captured 'this' pointer in lambdas with an explicit object parameter in constant evaluator (PR #81102)

2024-02-08 Thread Erich Keane via cfe-commits
erichkeane wrote: > Should I fix the conflict in the release notes myself, or should that be done > when this gets merged? Because at least in my experience, merge conflicts in > the release notes just keep reappearing if a pr stays open for some time... Lets hang out on that for a bit...

[clang] [Clang][C++23] Implement P1774R8: Portable assumptions (PR #81014)

2024-02-07 Thread Erich Keane via cfe-commits
erichkeane wrote: > > I think the confusion/conflict between this and clang::assume needs to be > > figured out. These two should just be, as close as possible, spellings of > > the same thing. > > Well, apparently, `clang::assume` always takes a string and is meant for OMP > assumptions, so

[clang] [Clang][C++23] Implement P1774R8: Portable assumptions (PR #81014)

2024-02-07 Thread Erich Keane via cfe-commits
erichkeane wrote: > > We have 2 options: > > > > * Wait for llvm to get improve their handling of assumption based > > optimizations. > > * Proceed with this work hoping this encourages work on the optimizer. > > The standard also mentions that `__has_cpp_attribute` should return `0` ‘if >

[clang] [Clang][C++23] Implement P1774R8: Portable assumptions (PR #81014)

2024-02-07 Thread Erich Keane via cfe-commits
erichkeane wrote: Also note, we need to update the feature-test-macro/has_attribute-expr here. https://github.com/llvm/llvm-project/pull/81014 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [Clang][C++23] Implement P1774R8: Portable assumptions (PR #81014)

2024-02-07 Thread Erich Keane via cfe-commits
@@ -1996,6 +1996,30 @@ Here is an example: }]; } +def AssumeDocs : Documentation { + let Category = DocCatStmt; + let Heading = "assume"; + let Content = [{ +The ``assume`` attribute is used to indicate to the optimizer that a +certain condition can be assumed to be true

[clang] [Clang][C++23] Implement P1774R8: Portable assumptions (PR #81014)

2024-02-07 Thread Erich Keane via cfe-commits
@@ -1996,6 +1996,30 @@ Here is an example: }]; } +def AssumeDocs : Documentation { + let Category = DocCatStmt; + let Heading = "assume"; + let Content = [{ +The ``assume`` attribute is used to indicate to the optimizer that a +certain condition can be assumed to be true

[clang] [Clang][C++23] Implement P1774R8: Portable assumptions (PR #81014)

2024-02-07 Thread Erich Keane via cfe-commits
@@ -1996,6 +1996,30 @@ Here is an example: }]; } +def AssumeDocs : Documentation { + let Category = DocCatStmt; + let Heading = "assume"; + let Content = [{ +The ``assume`` attribute is used to indicate to the optimizer that a +certain condition can be assumed to be true

[clang] [Clang][C++23] Implement P1774R8: Portable assumptions (PR #81014)

2024-02-07 Thread Erich Keane via cfe-commits
@@ -4528,6 +4528,54 @@ static bool IsBuiltInOrStandardCXX11Attribute(IdentifierInfo *AttrName, } } +/// Parse the argument to C++23's [[assume()]] attribute. +bool Parser::ParseAssumeAttributeArg(ParsedAttributes , + IdentifierInfo

[clang] [Clang][C++23] Implement P1774R8: Portable assumptions (PR #81014)

2024-02-07 Thread Erich Keane via cfe-commits
@@ -783,6 +783,9 @@ def err_ms_property_expected_comma_or_rparen : Error< def err_ms_property_initializer : Error< "property declaration cannot have a default member initializer">; +def err_assume_attr_expects_cond_expr : Error< + "use of this expression in an 'assume'

[clang] [Clang][C++23] Implement P1774R8: Portable assumptions (PR #81014)

2024-02-07 Thread Erich Keane via cfe-commits
@@ -4528,6 +4528,54 @@ static bool IsBuiltInOrStandardCXX11Attribute(IdentifierInfo *AttrName, } } +/// Parse the argument to C++23's [[assume()]] attribute. +bool Parser::ParseAssumeAttributeArg(ParsedAttributes , erichkeane wrote: Hopefully someone more

[clang] [Clang][C++23] Implement P1774R8: Portable assumptions (PR #81014)

2024-02-07 Thread Erich Keane via cfe-commits
@@ -1996,6 +1996,30 @@ Here is an example: }]; } +def AssumeDocs : Documentation { + let Category = DocCatStmt; + let Heading = "assume"; + let Content = [{ +The ``assume`` attribute is used to indicate to the optimizer that a +certain condition can be assumed to be true

[clang] Diagnose misuse of the cleanup attribute (PR #80040)

2024-02-07 Thread Erich Keane via cfe-commits
@@ -3780,6 +3780,30 @@ static void handleCleanupAttr(Sema , Decl *D, const ParsedAttr ) { << NI.getName() << ParamTy << Ty; return; } + VarDecl *VD = cast(D); + // Create a reference to the variable declaration. This is a fake/dummy + // reference. +

[clang] Diagnose misuse of the cleanup attribute (PR #80040)

2024-02-07 Thread Erich Keane via cfe-commits
@@ -3780,6 +3780,30 @@ static void handleCleanupAttr(Sema , Decl *D, const ParsedAttr ) { << NI.getName() << ParamTy << Ty; return; } + VarDecl *VD = cast(D); + // Create a reference to the variable declaration. This is a fake/dummy + // reference. +

[clang] Diagnose misuse of the cleanup attribute (PR #80040)

2024-02-07 Thread Erich Keane via cfe-commits
@@ -3780,6 +3780,30 @@ static void handleCleanupAttr(Sema , Decl *D, const ParsedAttr ) { << NI.getName() << ParamTy << Ty; return; } + VarDecl *VD = cast(D); + // Create a reference to the variable declaration. This is a fake/dummy + // reference. +

[clang] Diagnose misuse of the cleanup attribute (PR #80040)

2024-02-07 Thread Erich Keane via cfe-commits
@@ -3780,6 +3780,30 @@ static void handleCleanupAttr(Sema , Decl *D, const ParsedAttr ) { << NI.getName() << ParamTy << Ty; return; } + VarDecl *VD = cast(D); + // Create a reference to the variable declaration. This is a fake/dummy + // reference. +

[clang] [Clang][Sema] Do not attempt to instantiate a deleted move constructor (PR #80959)

2024-02-07 Thread Erich Keane via cfe-commits
@@ -7894,13 +7895,18 @@ bool Sema::CheckExplicitlyDefaultedSpecialMember(CXXMethodDecl *MD, if (ShouldDeleteForTypeMismatch || ShouldDeleteSpecialMember(MD, CSM)) { if (First) { SetDeclDeleted(MD, MD->getLocation()); - if (!inTemplateInstantiation() &&

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

2024-02-06 Thread Erich Keane via cfe-commits
@@ -380,7 +375,8 @@ class DeclSpec { unsigned FS_noreturn_specified : 1; // friend-specifier - unsigned Friend_specified : 1; + unsigned FriendSpecified : 1; erichkeane wrote: I think you're right, thats the one!

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

2024-02-06 Thread Erich Keane via cfe-commits
@@ -145,6 +145,7 @@ Improvements to Clang's diagnostics prints. - Clang now diagnoses member template declarations with multiple declarators. +- Clang now diagnoses friend declarations with an ``enum`` elaborated-type-specifier outside of C++98. erichkeane

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

2024-02-06 Thread Erich Keane via cfe-commits
@@ -2552,10 +2552,10 @@ class Parser : public CodeCompletionHandler { /// Starting with a scope specifier, identifier, or /// template-id that refers to the current class, determine whether /// this is a constructor declarator. - bool isConstructorDeclarator( -

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

2024-02-06 Thread Erich Keane via cfe-commits
@@ -145,6 +145,7 @@ Improvements to Clang's diagnostics prints. - Clang now diagnoses member template declarations with multiple declarators. +- Clang now diagnoses friend declarations with an ``enum`` elaborated-type-specifier outside of C++98. erichkeane

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

2024-02-06 Thread Erich Keane via cfe-commits
@@ -380,7 +375,8 @@ class DeclSpec { unsigned FS_noreturn_specified : 1; // friend-specifier - unsigned Friend_specified : 1; + unsigned FriendSpecified : 1; erichkeane wrote: Should these have that debug-attribute that we added not long ago? I think

[clang] [Clang][Sema] Abbreviated function templates do not append invented parameters to empty template parameter lists (PR #80864)

2024-02-06 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. https://github.com/llvm/llvm-project/pull/80864 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] Abbreviated function templates do not append invented parameters to empty template parameter lists (PR #80864)

2024-02-06 Thread Erich Keane via cfe-commits
@@ -9759,7 +9759,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator , DeclContext *DC, SmallVector TemplateParamLists; llvm::append_range(TemplateParamLists, TemplateParamListsRef); if (TemplateParameterList *Invented = D.getInventedTemplateParameterList()) { -

[clang] [Clang][Sema] Abbreviated function templates do not append invented parameters to empty template parameter lists (PR #80864)

2024-02-06 Thread Erich Keane via cfe-commits
@@ -19294,7 +19294,16 @@ void Sema::ActOnStartFunctionDeclarationDeclarator( ExplicitLists, /*IsFriend=*/false, IsMemberSpecialization, IsInvalid, /*SuppressDiagnostic=*/true); } - if (ExplicitParams) { + // C++23 [dcl.fct]p23: + // An abbreviated

[clang] [Clang][Sema] Abbreviated function templates do not append invented parameters to empty template parameter lists (PR #80864)

2024-02-06 Thread Erich Keane via cfe-commits
@@ -9759,7 +9759,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator , DeclContext *DC, SmallVector TemplateParamLists; llvm::append_range(TemplateParamLists, TemplateParamListsRef); if (TemplateParameterList *Invented = D.getInventedTemplateParameterList()) { -

[clang] Diagnose misuse of the cleanup attribute (PR #80040)

2024-02-06 Thread Erich Keane via cfe-commits
erichkeane wrote: > Umm how could I resolve that? I tried various things but none working. 沈 You'll have to spend some time in a debugger (note that `clang::DiagnosticIDs::EmitDiag` is where the diagnostic happens, so is a good place for a brekapoint). But I see that in your creation of your

[clang] Diagnose misuse of the cleanup attribute (PR #80040)

2024-02-06 Thread Erich Keane via cfe-commits
erichkeane wrote: > ``` > extern void free(void *); > extern void *malloc(size_t size); > void t8(void) { > void *p __attribute__((cleanup(free))) = malloc(10); // > expected-warning{{attempt to call free on non-heap object 'p'}} > } > ``` > > I added this, but I am getting this error:

[clang] [Clang][Sema] Diagnose declarative nested-name-specifiers naming alias templates (PR #80842)

2024-02-06 Thread Erich Keane via cfe-commits
@@ -6295,22 +6297,36 @@ bool Sema::diagnoseQualifiedDeclaration(CXXScopeSpec , DeclContext *DC, << FixItHint::CreateRemoval(TemplateId->TemplateKWLoc); NestedNameSpecifierLoc SpecLoc(SS.getScopeRep(), SS.location_data()); - while (SpecLoc.getPrefix()) { + do {

[clang] [Clang][Sema] Diagnose declarative nested-name-specifiers naming alias templates (PR #80842)

2024-02-06 Thread Erich Keane via cfe-commits
@@ -6295,22 +6297,36 @@ bool Sema::diagnoseQualifiedDeclaration(CXXScopeSpec , DeclContext *DC, << FixItHint::CreateRemoval(TemplateId->TemplateKWLoc); NestedNameSpecifierLoc SpecLoc(SS.getScopeRep(), SS.location_data()); - while (SpecLoc.getPrefix()) { + do {

[clang] [Clang][Sema] Diagnose declarative nested-name-specifiers naming alias templates (PR #80842)

2024-02-06 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: Added other reviewers, this part of naming is something that I need other eyes on. https://github.com/llvm/llvm-project/pull/80842 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [Clang][Sema] Diagnose declarative nested-name-specifiers naming alias templates (PR #80842)

2024-02-06 Thread Erich Keane via cfe-commits
https://github.com/erichkeane edited https://github.com/llvm/llvm-project/pull/80842 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][TSA] Make RequiresCapability a DeclOrType attribute (PR #67095)

2024-02-06 Thread Erich Keane via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: @@ -8938,6 +8957,11 @@ static void processTypeAttrs(TypeProcessingState , QualType , attr.setUsedAsTypeAttr();

[clang] [Clang][Sema] fix crash in codegen stage when an lambda expression declared in an unevaluated context (PR #80802)

2024-02-06 Thread Erich Keane via cfe-commits
@@ -1613,8 +1613,8 @@ namespace { bool TemplateInstantiator::AlreadyTransformed(QualType T) { if (T.isNull()) return true; - - if (T->isInstantiationDependentType() || T->isVariablyModifiedType()) + if (T->isInstantiationDependentType() || T->isVariablyModifiedType()

[clang] [Clang][Sema] Fix regression due to missing ambiguity check before attempting access check. (PR #80730)

2024-02-05 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. This'll need a cherry pick to 18 as it is a break against 17, right? Otherwise LGTM. https://github.com/llvm/llvm-project/pull/80730 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[llvm] [clang] [clang-tools-extra] [clang] reject to capture variable in `RequiresExprBodyDecl` (PR #78598)

2024-02-05 Thread Erich Keane via cfe-commits
@@ -19706,22 +19706,29 @@ static void buildLambdaCaptureFixit(Sema , LambdaScopeInfo *LSI, } } +static DeclContext *ignoreReuquiresBodyDecl(DeclContext *DC) { erichkeane wrote: ```suggestion static DeclContext *ignoreRequiresBodyDecl(DeclContext *DC) {

[clang] [llvm] [clang-tools-extra] [clang] reject to capture variable in `RequiresExprBodyDecl` (PR #78598)

2024-02-05 Thread Erich Keane via cfe-commits
@@ -0,0 +1,25 @@ +// RUN: %clang -fsyntax-only -std=c++20 -Xclang -verify %s + +// expected-no-diagnostics + +auto GH69307_Func_1() { + constexpr auto b = 1; + return [&](auto c) -> int erichkeane wrote: Can you do a similar test with NO capture here? To show

[clang-tools-extra] [llvm] [clang] [clang] reject to capture variable in `RequiresExprBodyDecl` (PR #78598)

2024-02-05 Thread Erich Keane via cfe-commits
@@ -19706,22 +19706,29 @@ static void buildLambdaCaptureFixit(Sema , LambdaScopeInfo *LSI, } } +static DeclContext *ignoreReuquiresBodyDecl(DeclContext *DC) { erichkeane wrote: Name here doesn't match what you're doing here. Perhaps something closer to

[llvm] [clang] [clang-tools-extra] [clang] reject to capture variable in `RequiresExprBodyDecl` (PR #78598)

2024-02-05 Thread Erich Keane via cfe-commits
@@ -0,0 +1,7 @@ +// RUN: %clang_cc1 -fsyntax-only -Wunused-lambda-capture -Wused-but-marked-unused -Wno-uninitialized -verify -std=c++20 %s + +void test() { + int i; + auto explicit_by_value_unused_requires = [i] (auto) requires requires { i; } {}; // expected-warning{{lambda

[clang] [Clang] Fix crash when recovering from an invalid pack indexing type. (PR #80652)

2024-02-05 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. Seems reasonable. https://github.com/llvm/llvm-project/pull/80652 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [clang-tools-extra] [concepts] Extract function template pack arguments from the current instantiation if possible (PR #80594)

2024-02-05 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. https://github.com/llvm/llvm-project/pull/80594 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Fix a crash when dumping a pack indexing type. (PR #80439)

2024-02-02 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. https://github.com/llvm/llvm-project/pull/80439 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Fix a crash when dumping a pack indexing type. (PR #80439)

2024-02-02 Thread Erich Keane via cfe-commits
@@ -0,0 +1,24 @@ +// RUN: not %clang_cc1 -std=c++2c -ast-dump %s | FileCheck %s + +namespace InvalidPacksShouldNotCrash { + +struct NotAPack; +template typename Tp> +void not_pack() { +int i = 0; +i...[0]; // expected-error {{i does not refer to the name of a parameter

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

2024-02-02 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. 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] Correctly look up primary template for variable template specializations (PR #80359)

2024-02-02 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. 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] Fix a crash when dumping a pack indexing type. (PR #80439)

2024-02-02 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. LGTM other than generalizing the test a bit. https://github.com/llvm/llvm-project/pull/80439 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [Clang] Fix a crash when dumping a pack indexing type. (PR #80439)

2024-02-02 Thread Erich Keane via cfe-commits
@@ -0,0 +1,24 @@ +// RUN: not %clang_cc1 -std=c++2c -ast-dump %s | FileCheck %s + +namespace InvalidPacksShouldNotCrash { + +struct NotAPack; +template typename Tp> +void not_pack() { +int i = 0; +i...[0]; // expected-error {{i does not refer to the name of a parameter

[clang] Fix clang crash when printing highlighted code in diagnostic (after #66514) (PR #80442)

2024-02-02 Thread Erich Keane via cfe-commits
@@ -1349,7 +1349,7 @@ void TextDiagnostic::emitSnippetAndCaret( // Prepare source highlighting information for the lines we're about to // emit, starting from the first line. std::unique_ptr[]> SourceStyles = - highlightLines(BufStart, Lines.first, Lines.second, PP,

[clang] Fix clang crash when printing highlighted code in diagnostic (after #66514) (PR #80442)

2024-02-02 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. https://github.com/llvm/llvm-project/pull/80442 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Fix clang crash when printing highlighted code in diagnostic (after #66514) (PR #80442)

2024-02-02 Thread Erich Keane via cfe-commits
https://github.com/erichkeane edited https://github.com/llvm/llvm-project/pull/80442 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[libc] [clang] [flang] [clang-tools-extra] [llvm] [clang][Sema] Populate function template depth at AddTemplateOverloadCandidate (PR #80395)

2024-02-02 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. I don't see much value in a backport, particularly since this affects back to Clang 12. Else, LGTM. https://github.com/llvm/llvm-project/pull/80395 ___ cfe-commits mailing list

[clang] [attributes][analyzer] Generalize [[clang::suppress]] to declarations. (PR #80371)

2024-02-02 Thread Erich Keane via cfe-commits
@@ -147,6 +147,20 @@ bool BugSuppression::isSuppressed(const PathDiagnosticLocation , // done as well as perform a lot of work we'll never need. // Gladly, none of our on-by-default checkers currently need it. DeclWithIssue = ACtx.getTranslationUnitDecl(); + }

[clang] [Clang][Sema] fix outline member function template with default align crash (PR #80288)

2024-02-02 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. https://github.com/llvm/llvm-project/pull/80288 ___ 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 Erich Keane via cfe-commits
https://github.com/erichkeane commented: Other than release note, this LGTM. 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] Add some CodeGen tests for CWG 1xx issues (PR #80338)

2024-02-02 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. This looks right to me. https://github.com/llvm/llvm-project/pull/80338 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] Fix crash with const qualified member operator new (PR #80327)

2024-02-01 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: I'm not the best reviewer for this, but it looks reasonable to me. Perhaps Aaron should take a look to make sure? https://github.com/llvm/llvm-project/pull/80327 ___ cfe-commits mailing list

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

2024-02-01 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. 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-02-01 Thread Erich Keane via cfe-commits
erichkeane wrote: > @erichkeane How does this sound? > > > Removed support for constructing on-stack `TemplateArgumentList`s; > > interfaces should instead use `ArrayRef` to pass template > > arguments. Transitioning internal uses to `ArrayRef` > > reduces AST memory usage by 0.4% when

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

2024-02-01 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. I think this looks fine now... WDYT @cor3ntin ? https://github.com/llvm/llvm-project/pull/78243 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

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

2024-02-01 Thread Erich Keane via cfe-commits
erichkeane 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

[clang] Diagnose misuse of the cleanup attribute (PR #80040)

2024-02-01 Thread Erich Keane via cfe-commits
@@ -10098,6 +10098,23 @@ static bool isVector(QualType QT, QualType ElementType) { return false; } +bool Sema::IsPointerToPointer(QualType LHSType, QualType RHSType) { + if (const PointerType *LHSPointer = dyn_cast(LHSType)) { erichkeane wrote: I think

[clang] Diagnose misuse of the cleanup attribute (PR #80040)

2024-02-01 Thread Erich Keane via cfe-commits
@@ -8265,6 +8265,9 @@ def warn_condition_is_assignment : Warning<"using the result of an " def warn_free_nonheap_object : Warning<"attempt to call %0 on non-heap %select{object %2|object: block expression|object: lambda-to-function-pointer conversion}1">, InGroup; +def

[clang] Diagnose misuse of the cleanup attribute (PR #80040)

2024-02-01 Thread Erich Keane via cfe-commits
https://github.com/erichkeane edited https://github.com/llvm/llvm-project/pull/80040 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Diagnose misuse of the cleanup attribute (PR #80040)

2024-02-01 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: This needs a release note and some tests as well. https://github.com/llvm/llvm-project/pull/80040 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

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

2024-02-01 Thread Erich Keane via cfe-commits
erichkeane 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

<    5   6   7   8   9   10   11   12   13   14   >