[clang] [llvm] [Clang] restrict use of attribute names reserved by the C++ standard (PR #106036)

2025-01-17 Thread Erich Keane via cfe-commits
@@ -179,13 +179,15 @@ static bool isLanguageDefinedBuiltin(const SourceManager &SourceMgr, static bool isReservedCXXAttributeName(Preprocessor &PP, IdentifierInfo *II) { const LangOptions &Lang = PP.getLangOpts(); if (Lang.CPlusPlus && - hasAttribute(AttributeCommonIn

[clang] [llvm] [Clang] restrict use of attribute names reserved by the C++ standard (PR #106036)

2025-01-17 Thread Erich Keane via cfe-commits
@@ -61,14 +62,23 @@ int clang::hasAttribute(AttributeCommonInfo::Syntax Syntax, if (res) return res; - // Check if any plugin provides this attribute. - for (auto &Ptr : getAttributePluginInstances()) -if (Ptr->hasSpelling(Syntax, Name)) - return 1; + if (Che

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

2025-01-17 Thread Erich Keane via cfe-commits
erichkeane wrote: > Both 1 and 2 seems like good options @hokein @erichkeane (especially 1 is > probably something we should try to do) I like 1, but not really 2, I think we should wait for this to be reasonably complete before merging it, particularly this close to the release. I'd probabl

[clang] [llvm] [Clang] restrict use of attribute names reserved by the C++ standard (PR #106036)

2025-01-17 Thread Erich Keane via cfe-commits
@@ -173,6 +176,20 @@ static bool isLanguageDefinedBuiltin(const SourceManager &SourceMgr, return false; } +static bool isReservedCXXAttributeName(Preprocessor &PP, IdentifierInfo *II) { + const LangOptions &Lang = PP.getLangOpts(); + if (Lang.CPlusPlus && + hasAttrib

[clang] [Clang] disallow the use of asterisks preceding constructor and destructor names (PR #122621)

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

[clang] [FixIt] Improve Source Ranges and Fix-It Hints for Unused Lambda Captures #106445 (PR #117953)

2025-01-16 Thread Erich Keane via cfe-commits
erichkeane wrote: > @erichkeane this is still doing lexing things in Sema, I was actually > wondering if you had suggestions :D Ah, i thought I'd mentioned on this before. Yeah, I very much would expect all of the work this is doing to be possible in the parser. Sema shouldn't be setting ra

[clang] [clang] Fix `gnu::init_priority` attribute handling for reserved values (PR #121577)

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

[clang] [clang] Fix `gnu::init_priority` attribute handling for reserved values (PR #121577)

2025-01-16 Thread Erich Keane via cfe-commits
@@ -3591,15 +3591,20 @@ static void handleInitPriorityAttr(Sema &S, Decl *D, const ParsedAttr &AL) { return; } + if (prioritynum < 0 || prioritynum > 65535) { +S.Diag(AL.getLoc(), diag::err_attribute_argument_out_of_range) +<< E->getSourceRange() << AL << 0

[clang] [clang] Fix `gnu::init_priority` attribute handling for reserved values (PR #121577)

2025-01-16 Thread Erich Keane via cfe-commits
@@ -3591,15 +3591,20 @@ static void handleInitPriorityAttr(Sema &S, Decl *D, const ParsedAttr &AL) { return; } + if (prioritynum < 0 || prioritynum > 65535) { erichkeane wrote: checking `<0` is silly, it is an unsigned argument. https://github.com/l

[clang] [clang] Fix `gnu::init_priority` attribute handling for reserved values (PR #121577)

2025-01-16 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: 2 nits, else this is on the right track. https://github.com/llvm/llvm-project/pull/121577 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Fix canonicalization of pack indexing types (PR #123209)

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

[clang] Don't treat the default switch path as unreachable when all enumerators are covered (PR #123166)

2025-01-16 Thread Erich Keane via cfe-commits
erichkeane wrote: Hmm... This isn't really my area of expertise, but I consider those types of warnings valuable. While it isn't technically 'unreachable', it IS by intent of the code. Is there perhaps some sort of annotation on the struct we have that we could skip this assumption on instead

[clang] Add 'enum_select' diagnostic selection to clang. (PR #122505)

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

[clang] Add 'enum_select' diagnostic selection to clang. (PR #122505)

2025-01-15 Thread Erich Keane via cfe-commits
erichkeane wrote: > LGTM with a minor nit on the documentation, but I think this is a great new > feature for the diagnostics engine. Thank you for it! > > btw, if you happen to have a list of diagnostics that could benefit from > switching to use it, that sure seems like Good First Issue terr

[clang] Add 'enum_select' diagnostic selection to clang. (PR #122505)

2025-01-15 Thread Erich Keane via cfe-commits
https://github.com/erichkeane updated https://github.com/llvm/llvm-project/pull/122505 >From 4fbfdc801f6f296a8021f8efaea3a0da887f276f Mon Sep 17 00:00:00 2001 From: erichkeane Date: Thu, 9 Jan 2025 10:47:59 -0800 Subject: [PATCH 1/3] Add 'enum_select' diagnostic selection to clang. This causes

[clang] [Clang] Remove __is_referenceable builtin (PR #123078)

2025-01-15 Thread Erich Keane via cfe-commits
erichkeane wrote: > Should we deprecate it in 20, remove in 21? _almost_ is not 0 > https://github.com/search?q=__is_referenceable%28&type=code Eh, it is pretty effectively 0. If you subtract ones that are wrapped in '#if 0' or part of libcxx, the first two pages have like 3 entries on them.

[clang] [Clang] Correct the order of substituted arguments in CTAD alias guides (PR #123022)

2025-01-15 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. Seems fine, though please apply Corentin's suggestions. https://github.com/llvm/llvm-project/pull/123022 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/ma

[clang] [llvm] [Clang] restrict use of attribute names reserved by the C++ standard (PR #106036)

2025-01-15 Thread Erich Keane via cfe-commits
@@ -173,6 +176,20 @@ static bool isLanguageDefinedBuiltin(const SourceManager &SourceMgr, return false; } +static bool isReservedCXXAttributeName(Preprocessor &PP, IdentifierInfo *II) { + const LangOptions &Lang = PP.getLangOpts(); + if (Lang.CPlusPlus && + hasAttrib

[clang] [llvm] [Clang] restrict use of attribute names reserved by the C++ standard (PR #106036)

2025-01-15 Thread Erich Keane via cfe-commits
@@ -173,6 +176,20 @@ static bool isLanguageDefinedBuiltin(const SourceManager &SourceMgr, return false; } +static bool isReservedCXXAttributeName(Preprocessor &PP, IdentifierInfo *II) { + const LangOptions &Lang = PP.getLangOpts(); + if (Lang.CPlusPlus && + hasAttrib

[clang] Add 'enum_select' diagnostic selection to clang. (PR #122505)

2025-01-14 Thread Erich Keane via cfe-commits
@@ -886,6 +909,11 @@ struct DiagTextDocPrinter : DiagTextVisitor { makeRowSeparator(RST[I]); } + void VisitEnumSelect(EnumSelectPiece *P) { +// For now, document this as if it were a 'select'. erichkeane wrote: I don't think so? Actually, the '

[clang] Add 'enum_select' diagnostic selection to clang. (PR #122505)

2025-01-14 Thread Erich Keane via cfe-commits
@@ -0,0 +1,16 @@ +// RUN: clang-tblgen --gen-clang-diags-enums -I%S %s 2>&1 | FileCheck %s +include "DiagnosticBase.inc" + +def DupeNames1 : Error<"%enum_select{}0">; +def DupeNames2 : Error<"%enum_select{}0">; +// CHECK: error: Duplicate enumeration name 'DupeName' +// CHECK-NEXT

[clang] [llvm] [Clang] restrict use of attribute names reserved by the C++ standard (PR #106036)

2025-01-14 Thread Erich Keane via cfe-commits
erichkeane wrote: > Yes, but the point is: these names aren't reserved but the pain can still > happen. e.g., `cdecl` is not a reserved identifier, but re-defining its > meaning can still break code in ways that could have better diagnostics: > https://godbolt.org/z/vTfWPsYj9. Though, I suppo

[clang] [Clang][P1061] Add stuctured binding packs (PR #121417)

2025-01-14 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. I'm good here. Please let others make sure they are as well though. https://github.com/llvm/llvm-project/pull/121417 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.o

[clang] [libcxx] [Clang] emit -Wignored-qualifiers diagnostic for cv-qualified base classes (PR #121419)

2025-01-14 Thread Erich Keane via cfe-commits
erichkeane wrote: As far as the CFE is concerned, we're OK with this. Though note, I anticipate quite a bit of push back as libraries discover this warning, though most should change their code instead, so I don't anticipate a good reason to revert. https://github.com/llvm/llvm-project/pull/

[clang] [llvm] [Clang] restrict use of attribute names reserved by the C++ standard (PR #106036)

2025-01-14 Thread Erich Keane via cfe-commits
erichkeane wrote: > > > Oh, I see, you're suggesting we remove the `getStdNamespace` check from > > > this PR. Yeah, I think that's reasonable. > > > > > > Yep, that is my suggestion, sorry I was insufficiently clear. > > > But I'd somewhat question whether this PR and warning really has anyth

[clang] [llvm] [Clang] restrict use of attribute names reserved by the C++ standard (PR #106036)

2025-01-13 Thread Erich Keane via cfe-commits
erichkeane wrote: > Oh, I see, you're suggesting we remove the `getStdNamespace` check from this > PR. Yeah, I think that's reasonable. Yep, that is my suggestion, sorry I was insufficiently clear. > But I'd somewhat question whether this PR and warning really has anything to > do with the at

[clang] [Clang] disallow the use of asterisks preceding constructor and destructor names (PR #122621)

2025-01-13 Thread Erich Keane via cfe-commits
@@ -2223,6 +2225,8 @@ def err_destructor_not_member : Error< def err_destructor_cannot_be : Error<"destructor cannot be declared '%0'">; def err_invalid_qualified_destructor : Error< "'%0' qualifier is not allowed on a destructor">; +def err_invalid_destructor_decl : Error< -

[clang] [Clang] disallow the use of asterisks preceding constructor and destructor names (PR #122621)

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

[clang] [Clang] disallow the use of asterisks preceding constructor and destructor names (PR #122621)

2025-01-13 Thread Erich Keane via cfe-commits
@@ -2223,6 +2225,8 @@ def err_destructor_not_member : Error< def err_destructor_cannot_be : Error<"destructor cannot be declared '%0'">; def err_invalid_qualified_destructor : Error< "'%0' qualifier is not allowed on a destructor">; +def err_invalid_destructor_decl : Error< -

[clang] [Clang] disallow the use of asterisks preceding constructor and destructor names (PR #122621)

2025-01-13 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: 1 nit, else LGTM once @cor3ntin is happy. https://github.com/llvm/llvm-project/pull/122621 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] raise extension warning for unknown namespaced attributes (PR #120925)

2025-01-13 Thread Erich Keane via cfe-commits
@@ -179,6 +179,8 @@ def err_opencl_unknown_type_specifier : Error< def warn_unknown_attribute_ignored : Warning< "unknown attribute %0 ignored">, InGroup; +def ext_unknown_attribute_ignored : Extension< + "unknown attribute %0 ignored">, InGroup; erichkeane

[clang] [Clang] emit -Wignored-qualifiers diagnostic for cv-qualified base classes (PR #121419)

2025-01-13 Thread Erich Keane via cfe-commits
erichkeane wrote: > @erichkeane @ldionne should the `libcxx` tests > ([common_reference.compile.pass.cpp](https://github.com/llvm/llvm-project/blob/main/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/common_reference.compile.pass.cpp), > > [apply_extended_types.pass.cpp](https://gi

[clang] [Clang][P1061] Add stuctured binding packs (PR #121417)

2025-01-10 Thread Erich Keane via cfe-commits
@@ -1965,3 +1965,52 @@ CXXFoldExpr::CXXFoldExpr(QualType T, UnresolvedLookupExpr *Callee, SubExprs[SubExpr::RHS] = RHS; setDependence(computeDependence(this)); } + +ResolvedUnexpandedPackExpr::ResolvedUnexpandedPackExpr(SourceLocation BL, +

[clang] [SYCL] AST support for SYCL kernel entry point functions. (PR #122379)

2025-01-10 Thread Erich Keane via cfe-commits
@@ -4678,6 +4678,95 @@ class BlockDecl : public Decl, public DeclContext { } }; +/// Represents a partial function definition. +/// +/// An outlined function declaration contains the parameters and body of +/// a function independent of other function definition concerns suc

[clang] [SYCL] AST support for SYCL kernel entry point functions. (PR #122379)

2025-01-10 Thread Erich Keane via cfe-commits
@@ -0,0 +1,92 @@ +//===- StmtSYCL.h - Classes for SYCL kernel calls ---*- 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: Apa

[clang] [SYCL] AST support for SYCL kernel entry point functions. (PR #122379)

2025-01-10 Thread Erich Keane via cfe-commits
@@ -1793,6 +1794,16 @@ void ASTDeclReader::VisitBlockDecl(BlockDecl *BD) { BD->setCaptures(Reader.getContext(), captures, capturesCXXThis); } +void ASTDeclReader::VisitOutlinedFunctionDecl(OutlinedFunctionDecl *D) { + // NumParams is deserialized by OutlinedFunctionDecl::Cr

[clang] Add 'enum_select' diagnostic selection to clang. (PR #122505)

2025-01-10 Thread Erich Keane via cfe-commits
https://github.com/erichkeane created https://github.com/llvm/llvm-project/pull/122505 This causes us to generate an enum to go along with the select diagnostic, which allows for clearer diagnostic error emit lines. The syntax for this is: %enum_select{%OptionalEnumeratorName{Text}|{Text2}}0

[clang] [SYCL] AST support for SYCL kernel entry point functions. (PR #122379)

2025-01-10 Thread Erich Keane via cfe-commits
@@ -4678,6 +4678,95 @@ class BlockDecl : public Decl, public DeclContext { } }; +/// Represents a partial function definition. +/// +/// An outlined function declaration contains the parameters and body of +/// a function independent of other function definition concerns suc

[clang] [SYCL] AST support for SYCL kernel entry point functions. (PR #122379)

2025-01-10 Thread Erich Keane via cfe-commits
@@ -451,9 +452,9 @@ class ASTDeclReader : public DeclVisitor { void VisitOMPDeclareMapperDecl(OMPDeclareMapperDecl *D); void VisitOMPRequiresDecl(OMPRequiresDecl *D); void VisitOMPCapturedExprDecl(OMPCapturedExprDecl *D); - }; erichkeane wrote: Unrelate

[clang] [SYCL] AST support for SYCL kernel entry point functions. (PR #122379)

2025-01-10 Thread Erich Keane via cfe-commits
@@ -451,9 +452,9 @@ class ASTDeclReader : public DeclVisitor { void VisitOMPDeclareMapperDecl(OMPDeclareMapperDecl *D); void VisitOMPRequiresDecl(OMPRequiresDecl *D); void VisitOMPCapturedExprDecl(OMPCapturedExprDecl *D); - }; +}; - } // namespace clang --

[clang] [SYCL] AST support for SYCL kernel entry point functions. (PR #122379)

2025-01-10 Thread Erich Keane via cfe-commits
@@ -0,0 +1,92 @@ +//===- StmtSYCL.h - Classes for SYCL kernel calls ---*- 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: Apa

[clang] [SYCL] AST support for SYCL kernel entry point functions. (PR #122379)

2025-01-10 Thread Erich Keane via cfe-commits
@@ -1376,6 +1377,16 @@ void ASTDeclWriter::VisitBlockDecl(BlockDecl *D) { Code = serialization::DECL_BLOCK; } +void ASTDeclWriter::VisitOutlinedFunctionDecl(OutlinedFunctionDecl *D) { + Record.push_back(D->getNumParams()); + VisitDecl(D); + Record.push_back(D->isNothrow()

[clang] [SYCL] AST support for SYCL kernel entry point functions. (PR #122379)

2025-01-10 Thread Erich Keane via cfe-commits
@@ -4678,6 +4678,95 @@ class BlockDecl : public Decl, public DeclContext { } }; +/// Represents a partial function definition. +/// +/// An outlined function declaration contains the parameters and body of +/// a function independent of other function definition concerns suc

[clang] [SYCL] AST support for SYCL kernel entry point functions. (PR #122379)

2025-01-10 Thread Erich Keane via cfe-commits
@@ -4678,6 +4678,95 @@ class BlockDecl : public Decl, public DeclContext { } }; +/// Represents a partial function definition. +/// +/// An outlined function declaration contains the parameters and body of +/// a function independent of other function definition concerns suc

[clang] [Clang][P1061] Add stuctured binding packs (PR #121417)

2025-01-10 Thread Erich Keane via cfe-commits
@@ -12726,11 +12726,15 @@ bool ASTContext::DeclMustBeEmitted(const Decl *D) { // Likewise, variables with tuple-like bindings are required if their // bindings have side-effects. - if (const auto *DD = dyn_cast(VD)) -for (const auto *BD : DD->bindings()) - if (co

[clang] [libclang] Allow using PrintingPolicy with types (PR #122386)

2025-01-10 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. C++ side looks fine. Python looks innocuous enough, but I don't know it well enough to confidently review it. https://github.com/llvm/llvm-project/pull/122386 ___ cfe-commits mailing list cfe-c

[clang] [libclang] Add API to query more information about base classes. (PR #120300)

2025-01-10 Thread Erich Keane via cfe-commits
@@ -27,6 +27,33 @@ unsigned clang_isVirtualBase(CXCursor C) { return B->isVirtual(); } +unsigned clang_visitCXXBaseClasses(CXType PT, CXFieldVisitor visitor, + CXClientData client_data) { + CXCursor PC = clang_getTypeDeclaration(PT); + if

[clang] [libclang] Add API to query more information about base classes. (PR #120300)

2025-01-10 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. No idea what is going on with the python, but only 1 possible nit in the C++ https://github.com/llvm/llvm-project/pull/120300 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://list

[clang] [libclang] Add API to query more information about base classes. (PR #120300)

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

[clang] [SYCL] Basic diagnostics for the sycl_kernel_entry_point attribute. (PR #120327)

2025-01-09 Thread Erich Keane via cfe-commits
erichkeane wrote: This must have crossed in the air, we are now rejecting std attributes spelled there. See https://github.com/llvm/llvm-project/commit/1a73654b3212b623ac21b9deb3aeaadc6906b7e4 https://github.com/llvm/llvm-project/pull/120327 ___ cfe

[clang] [SYCL] Basic diagnostics for the sycl_kernel_entry_point attribute. (PR #120327)

2025-01-09 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. I think this is fine now. https://github.com/llvm/llvm-project/pull/120327 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][P1061] Add stuctured binding packs (PR #121417)

2025-01-09 Thread Erich Keane via cfe-commits
@@ -3423,6 +3425,30 @@ VarDecl *BindingDecl::getHoldingVar() const { return VD; } +void DecompositionDecl::VisitHoldingVars( +llvm::function_ref F) const { + VisitBindings([&](BindingDecl *BD) { +if (VarDecl *VD = BD->getHoldingVar()) + F(VD); + }); +} + +void

[clang] [Clang][P1061] Add stuctured binding packs (PR #121417)

2025-01-09 Thread Erich Keane via cfe-commits
@@ -2202,6 +2202,17 @@ void ASTStmtWriter::VisitPackIndexingExpr(PackIndexingExpr *E) { Code = serialization::EXPR_PACK_INDEXING; } +void ASTStmtWriter::VisitResolvedUnexpandedPackExpr( erichkeane wrote: DID you see my comment on how to test these? I made

[clang] [libcxx] [Clang] Implement CWG2369 "Ordering between constraints and substitution" (PR #102857)

2025-01-09 Thread Erich Keane via cfe-commits
erichkeane wrote: That seems like a heavy hand. Should we instead be checking the 'unevaluated context' state to see whether we should be emitting stuff? I can't imagine that anything from an unevaluated context should ever be emitted. https://github.com/llvm/llvm-project/pull/102857 ___

[clang] [Clang][P1061] Add stuctured binding packs (PR #121417)

2025-01-09 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: Most of this looks good, a handful of small concerns/changes I want, else pretty good. https://github.com/llvm/llvm-project/pull/121417 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm

[clang] [Clang][P1061] Add stuctured binding packs (PR #121417)

2025-01-09 Thread Erich Keane via cfe-commits
@@ -1965,3 +1965,52 @@ CXXFoldExpr::CXXFoldExpr(QualType T, UnresolvedLookupExpr *Callee, SubExprs[SubExpr::RHS] = RHS; setDependence(computeDependence(this)); } + +ResolvedUnexpandedPackExpr::ResolvedUnexpandedPackExpr(SourceLocation BL, +

[clang] [Clang][P1061] Add stuctured binding packs (PR #121417)

2025-01-09 Thread Erich Keane via cfe-commits
@@ -12726,11 +12726,15 @@ bool ASTContext::DeclMustBeEmitted(const Decl *D) { // Likewise, variables with tuple-like bindings are required if their // bindings have side-effects. - if (const auto *DD = dyn_cast(VD)) -for (const auto *BD : DD->bindings()) - if (co

[clang] [Clang][P1061] Add stuctured binding packs (PR #121417)

2025-01-09 Thread Erich Keane via cfe-commits
@@ -2556,6 +2558,15 @@ void StmtPrinter::VisitPackIndexingExpr(PackIndexingExpr *E) { OS << "]"; } +void StmtPrinter::VisitResolvedUnexpandedPackExpr( +ResolvedUnexpandedPackExpr *E) { + OS << "getExprs() + E->getNumExprs(), erichkeane

[clang] [Clang][P1061] Add stuctured binding packs (PR #121417)

2025-01-09 Thread Erich Keane via cfe-commits
@@ -3423,6 +3425,30 @@ VarDecl *BindingDecl::getHoldingVar() const { return VD; } +void DecompositionDecl::VisitHoldingVars( erichkeane wrote: Rather than both of these functions, I'd prefer we have some sort of iterators that allow standard iteration over

[clang] [Clang][P1061] Add stuctured binding packs (PR #121417)

2025-01-09 Thread Erich Keane via cfe-commits
@@ -2484,6 +2488,14 @@ TemplateInstantiator::TransformDeclRefExpr(DeclRefExpr *E) { if (PD->isParameterPack()) return TransformFunctionParmPackRefExpr(E, PD); + if (BindingDecl *BD = dyn_cast(D); BD && BD->isParameterPack()) { +BD = cast(TransformDecl(BD->getL

[clang] [Clang][P1061] Add stuctured binding packs (PR #121417)

2025-01-09 Thread Erich Keane via cfe-commits
@@ -4167,6 +4165,8 @@ class BindingDecl : public ValueDecl { /// Set the decomposed variable for this BindingDecl. void setDecomposedDecl(ValueDecl *Decomposed) { Decomp = Decomposed; } + VarDecl *getHoldingVar() const; erichkeane wrote: Can we get the c

[clang] [Clang][P1061] Add stuctured binding packs (PR #121417)

2025-01-09 Thread Erich Keane via cfe-commits
@@ -5321,6 +5321,58 @@ class BuiltinBitCastExpr final } }; +// Represents an unexpanded pack where the list of expressions are +// known. These are used when structured bindings introduce a pack. +class ResolvedUnexpandedPackExpr final +: public Expr, + private llvm

[clang] [Clang][P1061] Add stuctured binding packs (PR #121417)

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

[clang] [Clang][P1061] Add stuctured binding packs (PR #121417)

2025-01-09 Thread Erich Keane via cfe-commits
@@ -15991,6 +15991,13 @@ TreeTransform::TransformFunctionParmPackExpr(FunctionParmPackExpr *E) { return E; } +template +ExprResult TreeTransform::TransformResolvedUnexpandedPackExpr( +ResolvedUnexpandedPackExpr *E) { + // Default behavior is to do nothing with this tr

[clang] [Clang][P1061] Add stuctured binding packs (PR #121417)

2025-01-09 Thread Erich Keane via cfe-commits
@@ -5321,6 +5321,58 @@ class BuiltinBitCastExpr final } }; +// Represents an unexpanded pack where the list of expressions are +// known. These are used when structured bindings introduce a pack. +class ResolvedUnexpandedPackExpr final +: public Expr, + private llvm

[clang] [libcxx] [Clang] Implement CWG2369 "Ordering between constraints and substitution" (PR #102857)

2025-01-09 Thread Erich Keane via cfe-commits
erichkeane wrote: > > Is kinda wrong, it should be in the instantiation of that function... > > @erichkeane I don’t quite understand: the CWG issue itself requires us to > check the constraint before substituting into the function during template > argument deduction. So it shouldn’t live in a

[clang] [Clang] disallow attributes after namespace identifier (PR #121614)

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

[clang] [llvm] [Clang] Add __builtin_assume_dereferenceable to encode deref assumption. (PR #121789)

2025-01-08 Thread Erich Keane via cfe-commits
@@ -839,6 +839,12 @@ def BuiltinAssumeAligned : Builtin { let Prototype = "void*(void const*, size_t, ...)"; } +def BuiltinAssumeDereferenceable : Builtin { + let Spellings = ["__builtin_assume_dereferenceable"]; + let Attributes = [NoThrow, Const, Constexpr];

[clang] [Clang] __has_builtin should return false for aux triple builtins (PR #121839)

2025-01-08 Thread Erich Keane via cfe-commits
erichkeane wrote: > I am afraid this will break all existing CUDA/HIP programs since they expect > to be able to parse the builtins for both host and device targets. > > In the spirit of single source, the compiler sees the entire code for all > targets, including host target and all device ta

[clang] [libcxx] [Clang] Implement CWG2369 "Ordering between constraints and substitution" (PR #102857)

2025-01-08 Thread Erich Keane via cfe-commits
erichkeane wrote: Oof, hrmph. It seems to me that we just have to be slightly more aggressive at making sure we instantiate stuff I think. This sentence: `In this case, the lambda resides within the function declaration compare_three_way_result_t<_Tp, _Up> operator<=>(_Tp, _Up), which remains

[clang] [llvm] [Clang] Add __builtin_assume_dereferenceable to encode deref assumption. (PR #121789)

2025-01-08 Thread Erich Keane via cfe-commits
@@ -2761,6 +2761,41 @@ etc.). Query for this feature with ``__has_builtin(__builtin_assume_separate_storage)``. +``__builtin_assume_dereferenceable`` +- + +``__builtin_assume_derefernceable`` is used to provide the optimizer with the -

[clang] [llvm] [Clang] Add __builtin_assume_dereferenceable to encode deref assumption. (PR #121789)

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

[clang] [llvm] [Clang] Add __builtin_assume_dereferenceable to encode deref assumption. (PR #121789)

2025-01-08 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. 1 more question on the semantics + a typo, but the code LGTM. https://github.com/llvm/llvm-project/pull/121789 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-

[clang] [llvm] [Clang] Add __builtin_assume_dereferenceable to encode deref assumption. (PR #121789)

2025-01-08 Thread Erich Keane via cfe-commits
@@ -2761,6 +2761,41 @@ etc.). Query for this feature with ``__has_builtin(__builtin_assume_separate_storage)``. +``__builtin_assume_dereferenceable`` +- + +``__builtin_assume_derefernceable`` is used to provide the optimizer with the +know

[clang] [llvm] [Clang] Add __builtin_assume_dereferenceable to encode deref assumption. (PR #121789)

2025-01-07 Thread Erich Keane via cfe-commits
@@ -2761,6 +2761,41 @@ etc.). Query for this feature with ``__has_builtin(__builtin_assume_separate_storage)``. +``__builtin_assume_dereferenceable`` +- + +``__builtin_assume_derefernceable`` is used to provide the optimizer with the +know

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

2025-01-07 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)

2025-01-07 Thread Erich Keane via cfe-commits
@@ -186,4 +218,206 @@ bool Sema::CheckCountedByAttrOnField(FieldDecl *FD, Expr *E, bool CountInBytes, return false; } +static void EmitIncompleteCountedByPointeeNotes(Sema &S, +const CountAttributedType *CATy, +

[clang] [clang] Implement __attribute__((format_matches)) (PR #116708)

2025-01-07 Thread Erich Keane via cfe-commits
=?utf-8?q?F=C3=A9lix?= Cloutier , =?utf-8?q?F=C3=A9lix?= Cloutier , =?utf-8?q?F=C3=A9lix?= Cloutier , =?utf-8?q?F=C3=A9lix?= Cloutier Message-ID: In-Reply-To: https://github.com/erichkeane approved this pull request. https://github.com/llvm/llvm-project/pull/116708 ___

[clang] [Clang] __has_builtin should return false for aux triple builtins (PR #121839)

2025-01-07 Thread Erich Keane via cfe-commits
erichkeane wrote: > I don't think it makes any sense for `__has_builtin` to return true when the > target does not in-fact have the builtin. Most of the time this is used to > guard target specific code, which will then be wrong if it's compiled on the > device. Realistically the solution that

[clang] [Clang] __has_builtin should return false for aux triple builtins (PR #121839)

2025-01-07 Thread Erich Keane via cfe-commits
erichkeane wrote: I think I wrote the original patch. The point for allowing the 'aux' target to enable a builtin that is not supported on the 'default' target is for languages where 2-pass compilation is necessary for device/host, and the 'aux' target is used to capture that this is a 2-pass

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

2025-01-07 Thread Erich Keane via cfe-commits
erichkeane wrote: I think I'm reasonably OK with this, though @Sirraide has a 'requested changes', so he should do the final approval. https://github.com/llvm/llvm-project/pull/106321 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lis

[clang] [clang] Implement __attribute__((format_matches)) (PR #116708)

2025-01-07 Thread Erich Keane via cfe-commits
=?utf-8?q?Félix?= Cloutier , =?utf-8?q?Félix?= Cloutier Message-ID: In-Reply-To: erichkeane wrote: > As an update, I've been adding more tests and I found that I can make > improvements with follow-up work. Since these aren't stability problems or > false positives, and we think the change i

[clang] [clang] Fix implicit integer conversion for opaque enums declared in class templates (PR #121039)

2025-01-06 Thread Erich Keane via cfe-commits
=?utf-8?q?André?= Brand Message-ID: In-Reply-To: erichkeane wrote: > @erichkeane I am not sure what you mean. As I pointed out earlier, the > examples @cor3ntin brought up actually conform to the standard as in > [[temp.spec.general]](https://wg21.link/temp.spec#temp.inst-3): > > > The impl

[clang] [llvm] [Clang] Add __builtin_assume_dereferenceable to encode deref assumption. (PR #121789)

2025-01-06 Thread Erich Keane via cfe-commits
@@ -2761,6 +2761,41 @@ etc.). Query for this feature with ``__has_builtin(__builtin_assume_separate_storage)``. +``__builtin_assume_dereferenceable`` +- + +``__builtin_assume_derefernceable`` is used to provide the optimizer with the +know

[clang] [llvm] [Clang] Add __builtin_assume_dereferenceable to encode deref assumption. (PR #121789)

2025-01-06 Thread Erich Keane via cfe-commits
@@ -3726,6 +3726,16 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID, AlignmentCI, OffsetValue); return RValue::get(PtrValue); } + case Builtin::BI__builtin_assume_dereferenceable: { +const Expr *Ptr = E-

[clang] [llvm] [Clang] Add __builtin_assume_dereferenceable to encode deref assumption. (PR #121789)

2025-01-06 Thread Erich Keane via cfe-commits
@@ -2761,6 +2761,41 @@ etc.). Query for this feature with ``__has_builtin(__builtin_assume_separate_storage)``. +``__builtin_assume_dereferenceable`` +- + +``__builtin_assume_derefernceable`` is used to provide the optimizer with the +know

[clang] [clang] Fix implicit integer conversion for opaque enums declared in class templates (PR #121039)

2025-01-06 Thread Erich Keane via cfe-commits
=?utf-8?q?André?= Brand Message-ID: In-Reply-To: erichkeane wrote: > > Thanks for the PR. Can you update the commit message to be more descriptive? > > I'm not sure the fix is sufficient. > > I think most of the checks done in `ActOnEnumBody` should be (re) performed > > on instantiation. > >

[clang] [Clang] raise extension warning for unknown namespaced attributes (PR #120925)

2025-01-03 Thread Erich Keane via cfe-commits
@@ -179,6 +179,8 @@ def err_opencl_unknown_type_specifier : Error< def warn_unknown_attribute_ignored : Warning< "unknown attribute %0 ignored">, InGroup; +def ext_unknown_attribute_ignored : Extension< + "unknown attribute %0 ignored">, InGroup; erichkeane

[clang] [Clang] raise extension warning for unknown namespaced attributes (PR #120925)

2025-01-03 Thread Erich Keane via cfe-commits
@@ -179,6 +179,8 @@ def err_opencl_unknown_type_specifier : Error< def warn_unknown_attribute_ignored : Warning< "unknown attribute %0 ignored">, InGroup; +def ext_unknown_attribute_ignored : Extension< + "unknown attribute %0 ignored">, InGroup; erichkeane

[clang] [Clang] emit -Wignored-qualifiers diagnostic for cv-qualified base classes (PR #121419)

2025-01-03 Thread Erich Keane via cfe-commits
erichkeane wrote: > > ...that the template cases are going to be REALLY noisy > > @erichkeane It looks like that's why I have two failed tests from > `llvm-libc++-shared-cfg-in` due to the use of qualifiers Yep, that looks to be exactly the case! I'd be interested to see if @ldionne would be

[clang] [Clang] raise extension warning for unknown namespaced attributes (PR #120925)

2025-01-03 Thread Erich Keane via cfe-commits
@@ -179,6 +179,8 @@ def err_opencl_unknown_type_specifier : Error< def warn_unknown_attribute_ignored : Warning< "unknown attribute %0 ignored">, InGroup; +def ext_unknown_attribute_ignored : Extension< + "unknown attribute %0 ignored">, InGroup; erichkeane

[clang] [clang] Implement __attribute__((format_matches)) (PR #116708)

2025-01-03 Thread Erich Keane via cfe-commits
=?utf-8?q?Félix?= Cloutier , =?utf-8?q?Félix?= Cloutier Message-ID: In-Reply-To: https://github.com/erichkeane edited https://github.com/llvm/llvm-project/pull/116708 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-

[clang] [clang] Implement __attribute__((format_matches)) (PR #116708)

2025-01-03 Thread Erich Keane via cfe-commits
=?utf-8?q?Félix?= Cloutier , =?utf-8?q?Félix?= Cloutier Message-ID: In-Reply-To: @@ -595,6 +595,97 @@ ArgType::matchesType(ASTContext &C, QualType argTy) const { llvm_unreachable("Invalid ArgType Kind!"); } +static analyze_format_string::ArgType::MatchKind +integerTypeMat

[clang] [clang] Implement __attribute__((format_matches)) (PR #116708)

2025-01-03 Thread Erich Keane via cfe-commits
=?utf-8?q?Félix?= Cloutier , =?utf-8?q?Félix?= Cloutier Message-ID: In-Reply-To: https://github.com/erichkeane approved this pull request. I did as deep of a look-through as I could, though this is obviously a big patch. I didn't come up with any real comments, so everythign looks alright to

[clang] [Clang] emit -Wignored-qualifiers diagnostic for cv-qualified base classes (PR #121419)

2025-01-03 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. I have a bit of a concern that the template cases are going to be REALLY noisy, but we can deal with restricting individual use cases to a separate warning-group in the future if need-be. https://github.com/llvm/llvm-project/pull/121419

[clang] [Clang] raise extension warning for unknown namespaced attributes (PR #120925)

2025-01-03 Thread Erich Keane via cfe-commits
@@ -179,6 +179,8 @@ def err_opencl_unknown_type_specifier : Error< def warn_unknown_attribute_ignored : Warning< "unknown attribute %0 ignored">, InGroup; +def ext_unknown_attribute_ignored : Extension< + "unknown attribute %0 ignored">, InGroup; erichkeane

[clang] [Clang] raise extension warning for unknown namespaced attributes (PR #120925)

2025-01-03 Thread Erich Keane via cfe-commits
@@ -166,7 +166,8 @@ getScopeFromNormalizedScopeName(StringRef ScopeName) { .Case("hlsl", AttributeCommonInfo::Scope::HLSL) .Case("msvc", AttributeCommonInfo::Scope::MSVC) .Case("omp", AttributeCommonInfo::Scope::OMP) - .Case("riscv", AttributeCommonInfo::

[clang] [SYCL] Basic diagnostics for the sycl_kernel_entry_point attribute. (PR #120327)

2025-01-02 Thread Erich Keane via cfe-commits
@@ -1550,6 +1550,8 @@ NamedDecl *Sema::ActOnNonTypeTemplateParameter(Scope *S, Declarator &D, IdResolver.AddDecl(Param); } + ProcessDeclAttributes(S, Param, D); erichkeane wrote: Still want Aaron to check on this. https://github.com/llvm/llvm-project

[clang] [SYCL] Basic diagnostics for the sycl_kernel_entry_point attribute. (PR #120327)

2025-01-02 Thread Erich Keane via cfe-commits
@@ -15978,6 +15988,24 @@ Decl *Sema::ActOnFinishFunctionBody(Decl *dcl, Stmt *Body, CheckCoroutineWrapper(FD); } + // Diagnose invalid SYCL kernel entry point function declarations. + if (FD && !FD->isInvalidDecl() && !FD->isTemplated() && + FD->hasAttr()) { +

[clang] [Clang][P1061] Add stuctured binding packs (PR #121417)

2025-01-02 Thread Erich Keane via cfe-commits
erichkeane wrote: As a quick note, the best way to check serialization/deserialization is a PCH /restore test. I did a bunch in `SemaOpenACC` that you can use as an example (see a bunch ending with `-ast` in the name). Basically, you just do the right command-line incantation, plus a #ifdef

  1   2   3   4   5   6   7   8   9   10   >