[clang] [OpenACC] Implement beginning parts of the 'parallel' Sema impl (PR #81659)

2024-02-15 Thread Erich Keane via cfe-commits
@@ -745,9 +745,14 @@ bool Parser::ParseOpenACCClause(OpenACCDirectiveKind DirKind) { << getCurToken().getIdentifierInfo(); // Consume the clause name. - ConsumeToken(); + SourceLocation ClauseLoc = ConsumeToken(); + + bool ParamsResult = ParseOpenACCClausePara

[clang] [OpenACC] Implement beginning parts of the 'parallel' Sema impl (PR #81659)

2024-02-15 Thread Erich Keane via cfe-commits
@@ -13662,3 +13663,8 @@ StringRef ASTContext::getCUIDHash() const { CUIDHash = llvm::utohexstr(llvm::MD5Hash(LangOpts.CUID), /*LowerCase=*/true); return CUIDHash; } + +void ASTContext::setOpenACCStructuredBlock(OpenACCComputeConstruct *C, +

[clang] [OpenACC] Implement beginning parts of the 'parallel' Sema impl (PR #81659)

2024-02-15 Thread Erich Keane via cfe-commits
@@ -0,0 +1,132 @@ +//===--- SemaOpenACC.cpp - Semantic Analysis for OpenACC constructs ---===// +// +// 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] [OpenACC] Implement beginning parts of the 'parallel' Sema impl (PR #81659)

2024-02-15 Thread Erich Keane via cfe-commits
@@ -0,0 +1,132 @@ +//===--- SemaOpenACC.cpp - Semantic Analysis for OpenACC constructs ---===// +// +// 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] [OpenACC][NFC] Implement basic OpenACC Sema infrastructure (PR #81874)

2024-02-15 Thread Erich Keane via cfe-commits
https://github.com/erichkeane created https://github.com/llvm/llvm-project/pull/81874 This patch is split off from #81659, and contains just the Sema infrastructure that we can later use to implement semantic analysis of OpenACC constructs. >From 35700522a658571e2abad279f327f4160fdb6c9d Mon Se

[clang] [OpenACC][NFC] Implement basic OpenACC Sema infrastructure (PR #81874)

2024-02-15 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: @alexey-bataev : as requested, I've split off the infrastructure bits. Once this is committed, I'll move the 'warning's as a Review-after-commit so that the other patch can be easier to review. https://github.com/llvm/llvm-project/pull/81874 __

[clang] [OpenACC][NFC] Implement basic OpenACC Sema infrastructure (PR #81874)

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

[clang] [OpenACC][NFC] Implement basic OpenACC Sema infrastructure (PR #81874)

2024-02-15 Thread Erich Keane via cfe-commits
@@ -1197,7 +1215,20 @@ StmtResult Parser::ParseOpenACCDirectiveStmt() { ParsingOpenACCDirectiveRAII DirScope(*this); ConsumeAnnotationToken(); - ParseOpenACCDirective(); + OpenACCDirectiveParseInfo DirInfo = ParseOpenACCDirective(); + if (getActions().ActOnStartOpenACCD

[clang] [OpenACC][NFC] Implement basic OpenACC Sema infrastructure (PR #81874)

2024-02-15 Thread Erich Keane via cfe-commits
https://github.com/erichkeane updated https://github.com/llvm/llvm-project/pull/81874 >From 35700522a658571e2abad279f327f4160fdb6c9d Mon Sep 17 00:00:00 2001 From: erichkeane Date: Thu, 15 Feb 2024 08:41:58 -0800 Subject: [PATCH 1/2] [OpenACC][NFC] Implement basic OpenACC Sema infrastructure

[clang] [OpenACC][NFC] Implement basic OpenACC Sema infrastructure (PR #81874)

2024-02-15 Thread Erich Keane via cfe-commits
https://github.com/erichkeane updated https://github.com/llvm/llvm-project/pull/81874 >From 35700522a658571e2abad279f327f4160fdb6c9d Mon Sep 17 00:00:00 2001 From: erichkeane Date: Thu, 15 Feb 2024 08:41:58 -0800 Subject: [PATCH 1/3] [OpenACC][NFC] Implement basic OpenACC Sema infrastructure

[clang] [OpenACC][NFC] Implement basic OpenACC Sema infrastructure (PR #81874)

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

[clang] [clang] Refactor target attribute mangling. (PR #81893)

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

[clang] [clang] Refactor target attribute mangling. (PR #81893)

2024-02-15 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: I wonder if this should be a part of the Targets in CodeGen instead of here? https://github.com/llvm/llvm-project/pull/81893 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin

[clang] [clang] Refactor target attribute mangling. (PR #81893)

2024-02-15 Thread Erich Keane via cfe-commits
@@ -14,6 +14,7 @@ #ifndef LLVM_CLANG_BASIC_TARGETINFO_H #define LLVM_CLANG_BASIC_TARGETINFO_H +#include "clang/AST/Attr.h" erichkeane wrote: Basic shouldn't be referencing AST (IIRC, it shouldn't reference anything but basic or llvm), this ends up being an u

[clang] [clang] Refactor target attribute mangling. (PR #81893)

2024-02-15 Thread Erich Keane via cfe-commits
erichkeane wrote: > I wonder if this should be a part of the Targets in CodeGen instead of here? Hrm, this is a bad idea as the rest of mangling is in AST, but having mangling outside of AST seems to be the problem here. https://github.com/llvm/llvm-project/pull/81893 ___

[clang] [OpenACC] Implement beginning parts of the 'parallel' Sema impl (PR #81659)

2024-02-16 Thread Erich Keane via cfe-commits
@@ -0,0 +1,132 @@ +//===--- SemaOpenACC.cpp - Semantic Analysis for OpenACC constructs ---===// +// +// 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] [OpenACC] Implement beginning parts of the 'parallel' Sema impl (PR #81659)

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

[clang] [C11] Diagnose C11 keywords as being incompatible w/earlier standards (PR #82015)

2024-02-16 Thread Erich Keane via cfe-commits
@@ -2742,6 +2742,19 @@ bool Parser::parseMisplacedModuleImport() { return false; } +void Parser::diagnoseUseOfC11Keyword(const Token& Tok) { + // Warn that this is a C11 extension if in an older mode or if in C++. + // Otherwise, warn that it is incompatible with standards

[clang] [C11] Diagnose C11 keywords as being incompatible w/earlier standards (PR #82015)

2024-02-16 Thread Erich Keane via cfe-commits
@@ -2742,6 +2742,19 @@ bool Parser::parseMisplacedModuleImport() { return false; } +void Parser::diagnoseUseOfC11Keyword(const Token& Tok) { + // Warn that this is a C11 extension if in an older mode or if in C++. + // Otherwise, warn that it is incompatible with standards

[clang] [C11] Diagnose C11 keywords as being incompatible w/earlier standards (PR #82015)

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

[clang] [C23] Add __TYPE_FMTB__ and __TYPE_FMTb__ predefined macros (PR #82037)

2024-02-16 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. https://github.com/llvm/llvm-project/pull/82037 ___ 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-20 Thread Erich Keane via cfe-commits
erichkeane wrote: > what would be the reason for windows build failing , is it a CI issue or > specific to this PR & what can I do to resolve that. Thank you That appears to be a problem with the CI itself. I think we've fixed up a bunch of the CI, but it will require doing a 'merge' with mai

[clang] [clang][NFC] Regroup declarations in `Sema` (PR #82217)

2024-02-20 Thread Erich Keane via cfe-commits
erichkeane wrote: > This is going to be rather disruptive on downstream projects. At least we > should wait until after the release of clang 18 to merge it, to avoid endless > merge conflicts For the most part, git will handle these pretty well on downstreams I think, and as they are declarat

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

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

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

2024-02-20 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: Reviewed the CFE component, didn't look at LLVM. https://github.com/llvm/llvm-project/pull/79035 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commit

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

2024-02-20 Thread Erich Keane via cfe-commits
@@ -2705,6 +2705,33 @@ An error will be given if: }]; } +def AMDGPUMaxNumWorkGroupsDocs : Documentation { + let Category = DocCatAMDGPUAttributes; + let Content = [{ +This attribute specifies the max number of work groups when the kernel +is dispatched. + +Clang supports t

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

2024-02-20 Thread Erich Keane via cfe-commits
@@ -2705,6 +2705,33 @@ An error will be given if: }]; } +def AMDGPUMaxNumWorkGroupsDocs : Documentation { + let Category = DocCatAMDGPUAttributes; + let Content = [{ +This attribute specifies the max number of work groups when the kernel +is dispatched. + +Clang supports t

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

2024-02-20 Thread Erich Keane via cfe-commits
@@ -2705,6 +2705,33 @@ An error will be given if: }]; } +def AMDGPUMaxNumWorkGroupsDocs : Documentation { + let Category = DocCatAMDGPUAttributes; + let Content = [{ +This attribute specifies the max number of work groups when the kernel +is dispatched. + +Clang supports t

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

2024-02-20 Thread Erich Keane via cfe-commits
@@ -8069,6 +8069,26 @@ static void handleAMDGPUNumVGPRAttr(Sema &S, Decl *D, const ParsedAttr &AL) { D->addAttr(::new (S.Context) AMDGPUNumVGPRAttr(S.Context, AL, NumVGPR)); } +static void handleAMDGPUMaxNumWorkGroupsAttr(Sema &S, Decl *D, +

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

2024-02-20 Thread Erich Keane via cfe-commits
erichkeane wrote: I think we're good, feel free to resolve your conflict and commit. 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][Sema] Convert warning for extraneous template parameter lists to an extension warning (PR #82277)

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

[clang] [clang][NFC] Regroup declarations in `Sema` (PR #82217)

2024-02-20 Thread Erich Keane via cfe-commits
erichkeane wrote: > @erichkeane > > > That said, waiting until after 18 is perhaps a good diea. > > Resolving merge conflicts that will arise in the meantime is not going to be > trivial, but should be doable in a reasonable time. So I'm willing to wait. > I'm glad to hear that! I'm hopeful

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

2024-02-20 Thread Erich Keane via cfe-commits
@@ -8069,6 +8069,26 @@ static void handleAMDGPUNumVGPRAttr(Sema &S, Decl *D, const ParsedAttr &AL) { D->addAttr(::new (S.Context) AMDGPUNumVGPRAttr(S.Context, AL, NumVGPR)); } +static void handleAMDGPUMaxNumWorkGroupsAttr(Sema &S, Decl *D, +

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

2024-02-20 Thread Erich Keane via cfe-commits
erichkeane wrote: Also note, this is missing Clang lit tests, and doesn't seem to be correctly handling dependent expressions for x,y, and z. https://github.com/llvm/llvm-project/pull/79035 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https

[clang] [Clang][Sema] Fix incorrect rejection default construction of union with nontrivial member (PR #82407)

2024-02-20 Thread Erich Keane via cfe-commits
@@ -9442,9 +9442,21 @@ bool SpecialMemberDeletionInfo::shouldDeleteForSubobjectCall( int DiagKind = -1; - if (SMOR.getKind() == Sema::SpecialMemberOverloadResult::NoMemberOrDeleted) -DiagKind = !Decl ? 0 : 1; - else if (SMOR.getKind() == Sema::SpecialMemberOverloadRe

[clang] [Clang][Sema] Fix incorrect rejection default construction of union with nontrivial member (PR #82407)

2024-02-20 Thread Erich Keane via cfe-commits
@@ -188,3 +188,14 @@ static_assert(U2().b.x == 100, ""); static_assert(U3().b.x == 100, ""); } // namespace GH48416 + +namespace GH81774 { +struct Handle { +Handle(int) {} +}; +// Should be well-formed b/c NoState has a brace-or-equal-initializer erichkean

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

2024-02-20 Thread Erich Keane via cfe-commits
erichkeane wrote: > did I miss something - it looks like this was committed without approval? It looks that way to me @haoNoQ : Did you commit this instead of something else? Can you revert this until we get approval? https://github.com/llvm/llvm-project/pull/80371 ___

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

2024-02-20 Thread Erich Keane via cfe-commits
erichkeane wrote: > Hmm, no, I landed it because I made an assumption that there's simply not > that much interest in this work (I'm quite depressed about this in general > lately) so as a code owner I just made a call that it's probably good enough > to go and rely on post-commit review. Now

[clang] [Clang][Sema] Defer instantiation of exception specification until after partial ordering when determining primary template (PR #82417)

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

[clang] [Clang][Sema] Defer instantiation of exception specification until after partial ordering when determining primary template (PR #82417)

2024-02-20 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: 1 nit, else LGTM. We should probably have a release note as well. https://github.com/llvm/llvm-project/pull/82417 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/l

[clang] [Clang][Sema] Defer instantiation of exception specification until after partial ordering when determining primary template (PR #82417)

2024-02-20 Thread Erich Keane via cfe-commits
@@ -9706,9 +9706,17 @@ bool Sema::CheckFunctionTemplateSpecialization( if (Result == Candidates.end()) return true; - // Ignore access information; it doesn't figure into redeclaration checking. FunctionDecl *Specialization = cast(*Result); + auto *SpecializationFP

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

2024-02-20 Thread Erich Keane via cfe-commits
erichkeane wrote: > Ok gotcha thanks! In any case, I'll do my best to handle this more gracefully > in the future. Your advice is always appreciated! Perfect! I'll try to be better about this in the future as well. https://github.com/llvm/llvm-project/pull/80371 __

[clang] [OpenACC] Implement 'break' and 'continue' errors for Compute Cnstrcts (PR #82543)

2024-02-21 Thread Erich Keane via cfe-commits
https://github.com/erichkeane created https://github.com/llvm/llvm-project/pull/82543 OpenACC3.3 2.5.4 says: "A program may not branch into or out of a compute construct". While some of this restriction isn't particularly checkable, 'break' and 'continue' are possible and pretty trivial, so t

[clang] [OpenACC] Implement 'break' and 'continue' errors for Compute Cnstrcts (PR #82543)

2024-02-21 Thread Erich Keane via cfe-commits
https://github.com/erichkeane updated https://github.com/llvm/llvm-project/pull/82543 >From 5ea47a31eb0ce851441cb7f1851b13303732ca91 Mon Sep 17 00:00:00 2001 From: erichkeane Date: Wed, 21 Feb 2024 10:08:06 -0800 Subject: [PATCH 1/2] [OpenACC] Implement 'break' and 'continue' errors for Comput

[clang] [OpenACC] Implement 'break' and 'continue' errors for Compute Cnstrcts (PR #82543)

2024-02-21 Thread Erich Keane via cfe-commits
@@ -3371,6 +3379,20 @@ Sema::ActOnBreakStmt(SourceLocation BreakLoc, Scope *CurScope) { if (S->isOpenMPLoopScope()) return StmtError(Diag(BreakLoc, diag::err_omp_loop_cannot_use_stmt) << "break"); + + // OpenACC doesn't allow 'break'ing from a compu

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

2024-02-21 Thread Erich Keane via cfe-commits
erichkeane wrote: > > Also note, this is missing Clang lit tests, and doesn't seem to be > > correctly handling dependent expressions for x,y, and z. > > What does it mean to "handle dependent expressions for x,y, and z"? Thanks! An expression can be 'dependent', which is a C++'ism for 'has so

[clang] [OpenACC] Implement 'break' and 'continue' errors for Compute Cnstrcts (PR #82543)

2024-02-21 Thread Erich Keane via cfe-commits
@@ -3371,6 +3379,20 @@ Sema::ActOnBreakStmt(SourceLocation BreakLoc, Scope *CurScope) { if (S->isOpenMPLoopScope()) return StmtError(Diag(BreakLoc, diag::err_omp_loop_cannot_use_stmt) << "break"); + + // OpenACC doesn't allow 'break'ing from a compu

[clang] [OpenACC] Implement 'break' and 'continue' errors for Compute Cnstrcts (PR #82543)

2024-02-21 Thread Erich Keane via cfe-commits
https://github.com/erichkeane updated https://github.com/llvm/llvm-project/pull/82543 >From 5ea47a31eb0ce851441cb7f1851b13303732ca91 Mon Sep 17 00:00:00 2001 From: erichkeane Date: Wed, 21 Feb 2024 10:08:06 -0800 Subject: [PATCH 1/3] [OpenACC] Implement 'break' and 'continue' errors for Comput

[clang] [OpenACC] Implement 'break' and 'continue' errors for Compute Cnstrcts (PR #82543)

2024-02-21 Thread Erich Keane via cfe-commits
@@ -3371,6 +3379,20 @@ Sema::ActOnBreakStmt(SourceLocation BreakLoc, Scope *CurScope) { if (S->isOpenMPLoopScope()) return StmtError(Diag(BreakLoc, diag::err_omp_loop_cannot_use_stmt) << "break"); + + // OpenACC doesn't allow 'break'ing from a compu

[clang] [OpenACC] Implement 'break' and 'continue' errors for Compute Cnstrcts (PR #82543)

2024-02-21 Thread Erich Keane via cfe-commits
@@ -3371,6 +3379,20 @@ Sema::ActOnBreakStmt(SourceLocation BreakLoc, Scope *CurScope) { if (S->isOpenMPLoopScope()) return StmtError(Diag(BreakLoc, diag::err_omp_loop_cannot_use_stmt) << "break"); + + // OpenACC doesn't allow 'break'ing from a compu

[clang] [OpenACC] Implement 'break' and 'continue' errors for Compute Cnstrcts (PR #82543)

2024-02-21 Thread Erich Keane via cfe-commits
@@ -3371,6 +3379,20 @@ Sema::ActOnBreakStmt(SourceLocation BreakLoc, Scope *CurScope) { if (S->isOpenMPLoopScope()) return StmtError(Diag(BreakLoc, diag::err_omp_loop_cannot_use_stmt) << "break"); + + // OpenACC doesn't allow 'break'ing from a compu

[clang] [OpenACC] Implement 'break' and 'continue' errors for Compute Cnstrcts (PR #82543)

2024-02-21 Thread Erich Keane via cfe-commits
@@ -3371,6 +3379,20 @@ Sema::ActOnBreakStmt(SourceLocation BreakLoc, Scope *CurScope) { if (S->isOpenMPLoopScope()) return StmtError(Diag(BreakLoc, diag::err_omp_loop_cannot_use_stmt) << "break"); + + // OpenACC doesn't allow 'break'ing from a compu

[clang] [OpenACC] Implement 'break' and 'continue' errors for Compute Cnstrcts (PR #82543)

2024-02-21 Thread Erich Keane via cfe-commits
@@ -3371,6 +3379,20 @@ Sema::ActOnBreakStmt(SourceLocation BreakLoc, Scope *CurScope) { if (S->isOpenMPLoopScope()) return StmtError(Diag(BreakLoc, diag::err_omp_loop_cannot_use_stmt) << "break"); + + // OpenACC doesn't allow 'break'ing from a compu

[clang] [OpenACC] Implement 'break' and 'continue' errors for Compute Cnstrcts (PR #82543)

2024-02-22 Thread Erich Keane via cfe-commits
@@ -3371,6 +3379,20 @@ Sema::ActOnBreakStmt(SourceLocation BreakLoc, Scope *CurScope) { if (S->isOpenMPLoopScope()) return StmtError(Diag(BreakLoc, diag::err_omp_loop_cannot_use_stmt) << "break"); + + // OpenACC doesn't allow 'break'ing from a compu

[clang] [OpenACC] Implement 'break' and 'continue' errors for Compute Cnstrcts (PR #82543)

2024-02-22 Thread Erich Keane via cfe-commits
@@ -3371,6 +3379,20 @@ Sema::ActOnBreakStmt(SourceLocation BreakLoc, Scope *CurScope) { if (S->isOpenMPLoopScope()) return StmtError(Diag(BreakLoc, diag::err_omp_loop_cannot_use_stmt) << "break"); + + // OpenACC doesn't allow 'break'ing from a compu

[clang] [Clang][Sema] Fix missing warning when comparing mismatched enums in … (PR #81418)

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

[clang] [Clang][Sema] Fix missing warning when comparing mismatched enums in … (PR #81418)

2024-02-22 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: Not the best one to review this, but some drive-bys https://github.com/llvm/llvm-project/pull/81418 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-com

[clang] [Clang][Sema] Fix missing warning when comparing mismatched enums in … (PR #81418)

2024-02-22 Thread Erich Keane via cfe-commits
@@ -263,6 +263,14 @@ namespace { } } +QualType Expr::getEnumCoercedType(const ASTContext &Ctx) const { + bool NotEnumType = dyn_cast(this->getType()) == nullptr; + if (NotEnumType) erichkeane wrote: ```suggestion if (!isa(this->getType())) ``` Though,

[clang] [Clang][Sema] Fix missing warning when comparing mismatched enums in … (PR #81418)

2024-02-22 Thread Erich Keane via cfe-commits
@@ -4097,6 +4105,14 @@ FieldDecl *Expr::getSourceBitField() { return nullptr; } +EnumConstantDecl *Expr::getEnumConstantDecl() { + Expr *E = this->IgnoreParenImpCasts(); + if (DeclRefExpr *DRE = dyn_cast(E)) +if (EnumConstantDecl *ECD = dyn_cast(DRE->getDecl())) --

[clang] [OpenACC] Implement 'break' and 'continue' errors for Compute Cnstrcts (PR #82543)

2024-02-22 Thread Erich Keane via cfe-commits
https://github.com/erichkeane updated https://github.com/llvm/llvm-project/pull/82543 >From 5ea47a31eb0ce851441cb7f1851b13303732ca91 Mon Sep 17 00:00:00 2001 From: erichkeane Date: Wed, 21 Feb 2024 10:08:06 -0800 Subject: [PATCH 1/4] [OpenACC] Implement 'break' and 'continue' errors for Comput

[clang] [OpenACC] Implement 'break' and 'continue' errors for Compute Cnstrcts (PR #82543)

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

[clang] Disallow btf_type_tag in C++ mode (PR #107238)

2024-09-04 Thread Erich Keane via cfe-commits
@@ -6490,6 +6490,15 @@ static void HandleBTFTypeTagAttribute(QualType &Type, const ParsedAttr &Attr, TypeProcessingState &State) { Sema &S = State.getSema(); + // This attribute is only supported in C. + // FIXME: we should implement

[clang] Disallow btf_type_tag in C++ mode (PR #107238)

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

[clang] Disallow btf_type_tag in C++ mode (PR #107238)

2024-09-04 Thread Erich Keane via cfe-commits
@@ -225,6 +225,11 @@ Attribute Changes in Clang more cases where the returned reference outlives the object. (#GH100567) +- Now correctly diagnosing use of ``btf_type_tag`` in C++ and ignoring it; this erichkeane wrote: ```suggestion - Clang now correctly

[clang] Disallow btf_type_tag in C++ mode (PR #107238)

2024-09-04 Thread Erich Keane via cfe-commits
@@ -225,6 +225,11 @@ Attribute Changes in Clang more cases where the returned reference outlives the object. (#GH100567) +- Now correctly diagnosing use of ``btf_type_tag`` in C++ and ignoring it; this + attribute is a C-only attribute, and was causing crashes with templa

[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

2024-09-04 Thread Erich Keane via cfe-commits
@@ -0,0 +1,1566 @@ +//=== SemaFunctionEffects.cpp - Sema handling of function effects -===// erichkeane wrote: I've had a hard time with the review of this file, so I haven't done a close look. Hopefully someone who understands this better than me has

[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

2024-09-04 Thread Erich Keane via cfe-commits
@@ -8392,6 +8397,20 @@ void ASTReader::InitializeSema(Sema &S) { NewOverrides.applyOverrides(SemaObj->getLangOpts()); } + if (!DeclsWithEffectsToVerify.empty()) { +for (GlobalDeclID ID : DeclsWithEffectsToVerify) { + Decl *D = GetDecl(ID); + FunctionEf

[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

2024-09-04 Thread Erich Keane via cfe-commits
@@ -0,0 +1,1566 @@ +//=== SemaFunctionEffects.cpp - Sema handling of function effects -===// +// +// 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: A

[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

2024-09-04 Thread Erich Keane via cfe-commits
@@ -4932,6 +4938,78 @@ class FunctionEffectsRef { void dump(llvm::raw_ostream &OS) const; }; +/// A mutable set of FunctionEffect::Kind. +class FunctionEffectKindSet { + // For now this only needs to be a bitmap. + constexpr static size_t EndBitPos = 8; + using KindBitsT

[clang] [BoundsSafety][Sema] Allow counted_by and counted_by_or_null on pointers where the pointee type is incomplete but potentially completable (PR #106321)

2024-09-04 Thread Erich Keane via cfe-commits
@@ -13559,6 +13562,27 @@ QualType Sema::CheckAssignmentOperands(Expr *LHSExpr, ExprResult &RHS, QualType LHSType = LHSExpr->getType(); QualType RHSType = CompoundType.isNull() ? RHS.get()->getType() : CompoundType; + + if (RHS.

[clang] [BoundsSafety][Sema] Allow counted_by and counted_by_or_null on pointers where the pointee type is incomplete but potentially completable (PR #106321)

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

[clang] [BoundsSafety][Sema] Allow counted_by and counted_by_or_null on pointers where the pointee type is incomplete but potentially completable (PR #106321)

2024-09-04 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: I did a pass, I think @Sirraide is on the right direction in his reviews here, but the general direction of this patch is also completely acceptable. https://github.com/llvm/llvm-project/pull/106321 ___ cfe-com

[clang] [BoundsSafety][Sema] Allow counted_by and counted_by_or_null on pointers where the pointee type is incomplete but potentially completable (PR #106321)

2024-09-04 Thread Erich Keane via cfe-commits
@@ -186,4 +218,370 @@ bool Sema::CheckCountedByAttrOnField(FieldDecl *FD, Expr *E, bool CountInBytes, return false; } +SourceRange Sema::BoundsSafetySourceRangeFor(const CountAttributedType *CATy) { + // Note: This implementation relies on `CountAttributedType` being uniqu

[clang] [BoundsSafety][Sema] Allow counted_by and counted_by_or_null on pointers where the pointee type is incomplete but potentially completable (PR #106321)

2024-09-04 Thread Erich Keane via cfe-commits
@@ -3343,6 +3363,8 @@ class CountAttributedType final static bool classof(const Type *T) { return T->getTypeClass() == CountAttributed; } + + StringRef GetAttributeName(bool WithMacroPrefix) const; erichkeane wrote: ```suggestion StringRef getAttrib

[clang] [BoundsSafety][Sema] Allow counted_by and counted_by_or_null on pointers where the pointee type is incomplete but potentially completable (PR #106321)

2024-09-04 Thread Erich Keane via cfe-commits
@@ -186,4 +218,370 @@ bool Sema::CheckCountedByAttrOnField(FieldDecl *FD, Expr *E, bool CountInBytes, return false; } +SourceRange Sema::BoundsSafetySourceRangeFor(const CountAttributedType *CATy) { erichkeane wrote: I agree with Sirraide here, but would h

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2024-09-04 Thread Erich Keane via cfe-commits
erichkeane wrote: Rather than this being "not added in the header file", should we just make this one of the attributes that is disallowed after the thing has been 'referenced'? Or is that a dumb suggestion here? https://github.com/llvm/llvm-project/pull/67520

[clang] [clang-tools-extra] [clang] Implement CWG2398 provisional TTP matching to class templates (PR #94981)

2024-09-04 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: I've not done as in depth of a review as Corentin, but I approve of the direction here, I think the approach is correct, and most of the changes are fairly mechanical. So once Corentin is happy with the changes, so am I. https://github.com/llvm/llvm-pr

[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

2024-09-04 Thread Erich Keane via cfe-commits
@@ -10950,6 +10950,51 @@ def warn_imp_cast_drops_unaligned : Warning< InGroup>; // Function effects +def warn_func_effect_violation : Warning< + "'%0' %select{function|constructor|destructor|lambda|block|constructor's member initializer}1 " erichkeane wrot

[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

2024-09-04 Thread Erich Keane via cfe-commits
@@ -15099,6 +15037,106 @@ class Sema final : public SemaBase { std::string getFixItZeroLiteralForType(QualType T, SourceLocation Loc) const; ///@} + + // erichkeane wrote: @endilll ? https://github.com/llvm/llvm-project/pull/99656 __

[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

2024-09-04 Thread Erich Keane via cfe-commits
@@ -4932,6 +4938,78 @@ class FunctionEffectsRef { void dump(llvm::raw_ostream &OS) const; }; +/// A mutable set of FunctionEffect::Kind. +class FunctionEffectKindSet { + // For now this only needs to be a bitmap. + constexpr static size_t EndBitPos = 8; + using KindBitsT

[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

2024-09-04 Thread Erich Keane via cfe-commits
@@ -10950,6 +10950,51 @@ def warn_imp_cast_drops_unaligned : Warning< InGroup>; // Function effects +def warn_func_effect_violation : Warning< + "'%0' %select{function|constructor|destructor|lambda|block|constructor's member initializer}1 " erichkeane wrot

[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

2024-09-04 Thread Erich Keane via cfe-commits
@@ -8392,6 +8397,20 @@ void ASTReader::InitializeSema(Sema &S) { NewOverrides.applyOverrides(SemaObj->getLangOpts()); } + if (!DeclsWithEffectsToVerify.empty()) { +for (GlobalDeclID ID : DeclsWithEffectsToVerify) { + Decl *D = GetDecl(ID); + FunctionEf

[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

2024-09-04 Thread Erich Keane via cfe-commits
@@ -0,0 +1,1566 @@ +//=== SemaFunctionEffects.cpp - Sema handling of function effects -===// +// +// 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: A

[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

2024-09-04 Thread Erich Keane via cfe-commits
@@ -0,0 +1,1566 @@ +//=== SemaFunctionEffects.cpp - Sema handling of function effects -===// +// +// 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: A

[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

2024-09-05 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: I'm happy enough with it as is, I'd like @Sirraide to do 1 last pass, but if he approves, so do I. https://github.com/llvm/llvm-project/pull/99656 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https:/

[clang] [Parser][NFC] Move the core parsing of an attribute into a separate method (PR #107300)

2024-09-05 Thread Erich Keane via cfe-commits
@@ -2943,6 +2943,9 @@ class Parser : public CodeCompletionHandler { return false; } + bool ParseGNUSingleAttribute(ParsedAttributes &Attrs, SourceLocation &EndLoc, erichkeane wrote: I don't have a preference for any of the 3 names, but a comment explai

[clang] [Clang] Fix crash with `source_location` in lambda declarators. (PR #107411)

2024-09-05 Thread Erich Keane via cfe-commits
@@ -2287,6 +2288,15 @@ APValue SourceLocExpr::EvaluateInContext(const ASTContext &Ctx, Context = getParentContext(); } + // If we are currently parsing a lambda declarator, we might not have a fully + // formed call operator declaration yet, and we could not form a fu

[clang] [Clang] Fix crash with `source_location` in lambda declarators. (PR #107411)

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

[clang] [Clang] Fix crash with `source_location` in lambda declarators. (PR #107411)

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

[clang] [Clang] Fix crash with `source_location` in lambda declarators. (PR #107411)

2024-09-05 Thread Erich Keane via cfe-commits
erichkeane wrote: Woops! Had the wrong tab open and typed in the wrong 'fixes', did not mean to close this. The patch was supposed to fix https://github.com/llvm/llvm-project/issues/107052 https://github.com/llvm/llvm-project/pull/107411 ___ cfe-com

[clang] [Clang] Fix crash with `source_location` in lambda declarators. (PR #107411)

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

[clang] [clang-tools-extra] [clang] Implement CWG2398 provisional TTP matching to class templates (PR #94981)

2024-09-05 Thread Erich Keane via cfe-commits
@@ -9219,7 +9222,8 @@ class Sema final : public SemaBase { /// \returns true if an error occurred, false otherwise. bool CheckTemplateArgumentList( TemplateDecl *Template, SourceLocation TemplateLoc, - TemplateArgumentListInfo &TemplateArgs, bool PartialTemplateA

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2024-09-05 Thread Erich Keane via cfe-commits
erichkeane wrote: > That might not be enough. A function might not be used (or even referenced) > in the TU that defines it, but only in other TUs. But it would certainly > catch a number of issues already. Right, though catching that ends up being pretty impossible. The most you could do is

[clang] [Clang] Set `__cpp_explicit_this_parameter` (PR #107451)

2024-09-05 Thread Erich Keane via cfe-commits
erichkeane wrote: It appears that https://github.com/llvm/llvm-project/pull/95112 is actually pretty close... are we better off holding off on this until after that goes in? https://github.com/llvm/llvm-project/pull/107451 ___ cfe-commits mailing l

[clang] [Parser][NFC] Move the core parsing of an attribute into a separate method (PR #107300)

2024-09-06 Thread Erich Keane via cfe-commits
@@ -2943,6 +2943,9 @@ class Parser : public CodeCompletionHandler { return false; } + bool ParseGNUSingleAttribute(ParsedAttributes &Attrs, SourceLocation &EndLoc, erichkeane wrote: Ah, I see. The WG14 specified one is `__builtin_has_c_attribute`, cor

[clang] [clang-tools-extra] [clangd] show lambda name instead of operator() in signature help (PR #101857)

2024-09-06 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: I'm not sold on this patch, particularly the changes to the overload. I also wonder if we would better off having `CXXRecordDecl` save its 'variable' for lambdas (and look it up from there) rather than this. https://github.com/llvm/llvm-project/pull/1

[clang] [clang-tools-extra] [clangd] show lambda name instead of operator() in signature help (PR #101857)

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

[clang] [clang-tools-extra] [clangd] show lambda name instead of operator() in signature help (PR #101857)

2024-09-06 Thread Erich Keane via cfe-commits
@@ -2390,7 +2390,8 @@ static bool LookupQualifiedNameInUsingDirectives(Sema &S, LookupResult &R, } bool Sema::LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx, - bool InUnqualifiedLookup) { + bool InUnqual

[clang] [clang-tools-extra] [clangd] show lambda name instead of operator() in signature help (PR #101857)

2024-09-06 Thread Erich Keane via cfe-commits
@@ -10204,15 +10205,14 @@ class Sema final : public SemaBase { /// both @c a1 and @c a2. If @p SuppressUserConversions, then don't /// allow user-defined conversions via constructors or conversion /// operators. - void - AddMethodCandidate(CXXMethodDecl *Method, DeclAcc

[clang] [clang-tools-extra] [clangd] show lambda name instead of operator() in signature help (PR #101857)

2024-09-06 Thread Erich Keane via cfe-commits
@@ -4022,7 +4022,10 @@ CodeCompleteConsumer::OverloadCandidate::CreateSignatureString( std::string Name; llvm::raw_string_ostream OS(Name); -FDecl->getDeclName().print(OS, Policy); +auto const DeclName = (getKind() == CK_Lambda) erichkeane wro

<    13   14   15   16   17   18   19   20   21   22   >