[clang] [CIR] Add diagnostic for NYI AST visitor handlers (PR #151561)

2025-07-31 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. Should we get a test for the TagDeclRequired case? https://github.com/llvm/llvm-project/pull/151561 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman

[clang] [mlir] [OpenACC][CIR] Implement 'private' clause lowering. (PR #151360)

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

[clang] [mlir] [OpenACC][CIR] Implement 'private' clause lowering. (PR #151360)

2025-07-31 Thread Erich Keane via cfe-commits
erichkeane wrote: I've been digging into the initialization part of this, and the patch ends up being pretty sizable. If it is OK with reviewers, I'd like to just submit this and do that as a separate review. https://github.com/llvm/llvm-project/pull/151360 ___

[clang] [CIR] Upstream support for function-level variable decompositions (PR #151073)

2025-07-31 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. 1 nit, else lgtm. https://github.com/llvm/llvm-project/pull/151073 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream support for function-level variable decompositions (PR #151073)

2025-07-31 Thread Erich Keane via cfe-commits
@@ -797,3 +799,11 @@ void CIRGenFunction::emitAutoVarTypeCleanup( assert(!cir::MissingFeatures::ehCleanupFlags()); ehStack.pushCleanup(cleanupKind, addr, type, destroyer); } + +void CIRGenFunction::maybeEmitDeferredVarDeclInit(const VarDecl *vd) { + if (auto *dd = dyn_cast

[clang] [CIR] Upstream support for function-level variable decompositions (PR #151073)

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

[clang] [mlir] [OpenACC][CIR] Implement 'private' clause lowering. (PR #151360)

2025-07-31 Thread Erich Keane via cfe-commits
@@ -355,6 +356,110 @@ class OpenACCClauseCIREmitter final } } + template + RecipeTy getOrCreateRecipe(ASTContext &astCtx, const Expr *varRef, + DeclContext *dc, QualType baseType, + mlir::Value mainOp) { +mli

[clang] [mlir] [OpenACC][CIR] Implement 'private' clause lowering. (PR #151360)

2025-07-31 Thread Erich Keane via cfe-commits
@@ -355,6 +356,110 @@ class OpenACCClauseCIREmitter final } } + template + RecipeTy getOrCreateRecipe(ASTContext &astCtx, const Expr *varRef, + DeclContext *dc, QualType baseType, + mlir::Value mainOp) { +mli

[clang] [mlir] [OpenACC][CIR] Implement 'private' clause lowering. (PR #151360)

2025-07-31 Thread Erich Keane via cfe-commits
@@ -0,0 +1,522 @@ +// RUN: %clang_cc1 -fopenacc -triple x86_64-linux-gnu -Wno-openacc-self-if-potential-conflict -emit-cir -fclangir -triple x86_64-linux-pc %s -o - | FileCheck %s + +struct NoCopyConstruct {}; + +struct CopyConstruct { + CopyConstruct() = default; + CopyConstr

[clang] [SYCL] Restrict the sycl_kernel_entry_point attribute spelling to C++11 style. (PR #151405)

2025-07-31 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. I think I saw a clang-format complaint, so make sure that +CI passes, else LGTM. https://github.com/llvm/llvm-project/pull/151405 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://

[clang] [CIR] Fix fallthrough warning (PR #151418)

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

[clang] [CIR] Fix warnings related to unused variables in release builds (PR #151412)

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

[clang] clang: Make the type_info builtin declaration a singleton (PR #151277)

2025-07-31 Thread Erich Keane via cfe-commits
@@ -2381,6 +2384,15 @@ class ASTContext : public RefCountedBase { return getTagDeclType(MSGuidTagDecl); } + /// Retrieve the implicitly-predeclared 'struct type_info' declaration. + TagDecl *getMSTypeInfoTagDecl() const { +// Lazily create this type on demand - it'

[clang] [mlir] [OpenACC][CIR] Implement 'private' clause lowering. (PR #151360)

2025-07-30 Thread Erich Keane via cfe-commits
erichkeane wrote: @razvanlupusoru and @clementval : Would love review of the ACC dialect changes, but also confirmation that I got the IR correct. Particularly the lack of copy or constructor-initialization, and general privatization appertainment. I realize this is going to change somewhat w

[clang] [Analysis] Prevent revisiting block when searching for noreturn vars (PR #150582)

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

[clang] [Clang] disallow # operators in attribute argument lists (PR #147308)

2025-07-30 Thread Erich Keane via cfe-commits
@@ -124,6 +124,11 @@ Improvements to Clang's diagnostics Added a new warning in this group for the case where the attribute is missing/implicit on an override of a virtual method. +- Clang rejects the ``#`` and ``##`` preprocessor tokens in an attribute e

[clang] [Clang] disallow # operators in attribute argument lists (PR #147308)

2025-07-30 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. 1 nit on the release note, else this LGTM. We still need to let Aaron decide how long we are going to give WG21 a chance to change this :) https://github.com/llvm/llvm-project/pull/147308 ___

[clang] [Clang] disallow # operators in attribute argument lists (PR #147308)

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

[clang] [Clang] disallow # operators in attribute argument lists (PR #147308)

2025-07-30 Thread Erich Keane via cfe-commits
@@ -124,6 +124,11 @@ Improvements to Clang's diagnostics Added a new warning in this group for the case where the attribute is missing/implicit on an override of a virtual method. +- Clang rejects the ``#`` and ``##`` preprocessor tokens in an attribute + argument list i

[clang] [clang] Fix constant evaluation of member pointer access into sibling class. (PR #150829)

2025-07-29 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: Not quite sure I get what is going on but: 1- we need a release note 2- I need a better description of what is happening here. Your tests doesn't make it clear that it is only the `e1` and `e2` expressions that are changing the behavior? Is that corre

[clang] [lldb] [Clang] Initial support for P2841 (Variable template and concept template parameters) (PR #150823)

2025-07-29 Thread Erich Keane via cfe-commits
@@ -1746,6 +1754,16 @@ class TemplateTemplateParmDecl final return SourceRange(getTemplateParameters()->getTemplateLoc(), End); } + TemplateNameKind kind() const { erichkeane wrote: Right, i wasn't suggesting changing the num name, just that `kind` isn

[clang] [lldb] [Clang] Initial support for P2841 (Variable template and concept template parameters) (PR #150823)

2025-07-28 Thread Erich Keane via cfe-commits
@@ -5144,6 +5163,56 @@ bool TreeTransform::TransformTemplateArguments( } +template +template +bool TreeTransform::TransformConceptTemplateArguments( +InputIterator First, InputIterator Last, TemplateArgumentListInfo &Outputs, +bool Uneval) { + + auto isConcept = []

[clang] [lldb] [Clang] Initial support for P2841 (Variable template and concept template parameters) (PR #150823)

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

[clang] [lldb] [Clang] Initial support for P2841 (Variable template and concept template parameters) (PR #150823)

2025-07-28 Thread Erich Keane via cfe-commits
@@ -5144,6 +5163,56 @@ bool TreeTransform::TransformTemplateArguments( } +template +template +bool TreeTransform::TransformConceptTemplateArguments( +InputIterator First, InputIterator Last, TemplateArgumentListInfo &Outputs, +bool Uneval) { + + auto isConcept = []

[clang] [lldb] [Clang] Initial support for P2841 (Variable template and concept template parameters) (PR #150823)

2025-07-28 Thread Erich Keane via cfe-commits
@@ -339,6 +339,18 @@ bool TemplateArgument::isPackExpansion() const { llvm_unreachable("Invalid TemplateArgument Kind!"); } +bool TemplateArgument::isConceptOrConceptTemplateParameter() const { + bool isConcept = false; + if (getKind() == TemplateArgument::Template) { +

[clang] [lldb] [Clang] Initial support for P2841 (Variable template and concept template parameters) (PR #150823)

2025-07-28 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: A few comments, else looks reasonable. Thanks for the explaination! https://github.com/llvm/llvm-project/pull/150823 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailma

[clang] [lldb] [Clang] Initial support for P2841 (Variable template and concept template parameters) (PR #150823)

2025-07-28 Thread Erich Keane via cfe-commits
@@ -1746,6 +1754,16 @@ class TemplateTemplateParmDecl final return SourceRange(getTemplateParameters()->getTemplateLoc(), End); } + TemplateNameKind kind() const { erichkeane wrote: Mild preference for `templateKind` or something like that (perhaps som

[clang] [lldb] [Clang] Initial support for P2841 (Variable template and concept template parameters) (PR #150823)

2025-07-28 Thread Erich Keane via cfe-commits
@@ -26,115 +27,116 @@ #include namespace clang { - /// Represents the parsed form of a C++ template argument. - class ParsedTemplateArgument { - public: -/// Describes the kind of template argument that was parsed. -enum KindType { - /// A template type parame

[clang] [lldb] [Clang] Initial support for P2841 (Variable template and concept template parameters) (PR #150823)

2025-07-28 Thread Erich Keane via cfe-commits
@@ -235,7 +237,7 @@ void TemplateParameterList::getAssociatedConstraints( ACs.emplace_back(E); } } - if (HasRequiresClause) + if (HasRequiresClause && getRequiresClause()) erichkeane wrote: Does this mean we can now have a requires clause

[clang] [[gnu::nonstring]] should work on pointers too (PR #150974)

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

[clang] [lldb] [Clang] Initial support for P2841 (Variable template and concept template parameters) (PR #150823)

2025-07-28 Thread Erich Keane via cfe-commits
@@ -160,7 +160,7 @@ class alignas(8) InitializedEntity { struct VD { /// The VarDecl, FieldDecl, or BindingDecl being initialized. -ValueDecl *VariableOrMember; +NamedDecl *VariableOrMember; erichkeane wrote: Should the comment above be updated?

[clang] [lldb] [Clang] Initial support for P2841 (Variable template and concept template parameters) (PR #150823)

2025-07-28 Thread Erich Keane via cfe-commits
@@ -140,15 +142,15 @@ class ConceptReference { NamedDecl *FoundDecl; /// \brief The concept named. - ConceptDecl *NamedConcept; + TemplateDecl *NamedConcept; erichkeane wrote: It seems weird for a type named `ConceptReference` to not refer to a `Concep

[clang] [lldb] [Clang] Initial support for P2841 (Variable template and concept template parameters) (PR #150823)

2025-07-28 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: I don't quite get what is happening here yet, can you give a summary of what is being accomplished, and how you're doing so? https://github.com/llvm/llvm-project/pull/150823 ___ cfe-commits mailing list cfe-c

[clang] [lldb] [Clang] Initial support for P2841 (Variable template and concept template parameters) (PR #150823)

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

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

2025-07-28 Thread Erich Keane via cfe-commits
@@ -1797,16 +1803,18 @@ void Preprocessor::ExpandBuiltinMacro(Token &Tok) { diag::err_feature_check_malformed); return II && HasExtension(*this, II->getName()); }); - } else if (II == Ident__has_builtin) { + } else if (

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

2025-07-28 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. 1 nit, else I'm ok with this. https://github.com/llvm/llvm-project/pull/126324 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

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

[clang] [Analysis] Prevent revisiting block when searching for noreturn vars (PR #150582)

2025-07-25 Thread Erich Keane via cfe-commits
@@ -225,3 +225,20 @@ extern void abc_02(func_type *); abc_02(&func_ptr); func_ptr(); } // expected-warning {{function declared 'noreturn' should not return}} + +namespace Issue150336 { +void free(void *); +typedef void (*sel_freefunc)(void *); +struct gmx_ana_selmethod_t {

[clang] [Analysis] Prevent revisiting block when searching for noreturn vars (PR #150582)

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

[clang] [Analysis] Prevent revisiting block when searching for noreturn vars (PR #150582)

2025-07-25 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: Once the test is good, so am I. https://github.com/llvm/llvm-project/pull/150582 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Unblock destructor alias handling (PR #150497)

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

[clang] [NFC][clang-scan-deps] Refine the implementation of dependency_directives_scan::Token::isOneOf (PR #150433)

2025-07-24 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. This seems fine to me, though SEEING this dependency-scanner just brings up more questions than anything :) https://github.com/llvm/llvm-project/pull/150433 ___ cfe-commits mailing list cfe-co

[clang] [Sema] Fix false positive warnings for misaligned member access (PR #150025)

2025-07-24 Thread Erich Keane via cfe-commits
@@ -15534,17 +15534,28 @@ void Sema::AddPotentialMisalignedMembers(Expr *E, RecordDecl *RD, ValueDecl *MD, MisalignedMembers.emplace_back(E, RD, MD, Alignment); } -void Sema::DiagnoseMisalignedMembers() { - for (MisalignedMember &m : MisalignedMembers) { -const NamedDe

[clang] [Sema] Fix false positive warnings for misaligned member access (PR #150025)

2025-07-24 Thread Erich Keane via cfe-commits
https://github.com/erichkeane requested changes to this pull request. https://github.com/llvm/llvm-project/pull/150025 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][SYCL] Add sycl_external attribute and restrict emitting device code (PR #140282)

2025-07-23 Thread Erich Keane via cfe-commits
@@ -12251,6 +12264,9 @@ bool Sema::CheckFunctionDeclaration(Scope *S, FunctionDecl *NewFD, if (NewFD->hasAttr()) SYCL().CheckSYCLEntryPointFunctionDecl(NewFD); + if (NewFD->hasAttr()) +SYCL().CheckSYCLExternalFunctionDecl(NewFD); erichkeane wrote:

[clang] [clang][SYCL] Add sycl_external attribute and restrict emitting device code (PR #140282)

2025-07-23 Thread Erich Keane via cfe-commits
@@ -12937,6 +12937,10 @@ bool ASTContext::DeclMustBeEmitted(const Decl *D) { if (D->hasAttr()) return false; + if (LangOpts.SYCLIsDevice && !D->hasAttr() && + !D->hasAttr()) erichkeane wrote: An additional thought after clicking 'start-review': P

[clang] [clang][SYCL] Add sycl_external attribute and restrict emitting device code (PR #140282)

2025-07-23 Thread Erich Keane via cfe-commits
@@ -12937,6 +12937,10 @@ bool ASTContext::DeclMustBeEmitted(const Decl *D) { if (D->hasAttr()) return false; + if (LangOpts.SYCLIsDevice && !D->hasAttr() && + !D->hasAttr()) erichkeane wrote: I understood what you meant, and strongly disagree. Th

[clang] [clang][SYCL] Add sycl_external attribute and restrict emitting device code (PR #140282)

2025-07-23 Thread Erich Keane via cfe-commits
@@ -1641,6 +1641,13 @@ def DeviceKernel : DeclOrTypeAttr { }]; } +def SYCLExternal : InheritableAttr { + let Spellings = [Clang<"sycl_external">]; erichkeane wrote: > Ok, I'm fine with dropping the GNU spelling. But in that case, we should also > change the

[clang] [clang][SYCL] Add sycl_external attribute and restrict emitting device code (PR #140282)

2025-07-23 Thread Erich Keane via cfe-commits
@@ -12251,6 +12264,9 @@ bool Sema::CheckFunctionDeclaration(Scope *S, FunctionDecl *NewFD, if (NewFD->hasAttr()) SYCL().CheckSYCLEntryPointFunctionDecl(NewFD); + if (NewFD->hasAttr()) +SYCL().CheckSYCLExternalFunctionDecl(NewFD); erichkeane wrote:

[clang] [clang][SYCL] Add sycl_external attribute and restrict emitting device code (PR #140282)

2025-07-23 Thread Erich Keane via cfe-commits
@@ -12937,6 +12937,10 @@ bool ASTContext::DeclMustBeEmitted(const Decl *D) { if (D->hasAttr()) return false; + if (LangOpts.SYCLIsDevice && !D->hasAttr() && + !D->hasAttr()) erichkeane wrote: Hmmm... this skips quite a bit which causes obvious dis

[clang] [clang][SYCL] Add sycl_external attribute and restrict emitting device code (PR #140282)

2025-07-23 Thread Erich Keane via cfe-commits
@@ -12908,6 +12908,14 @@ def err_sycl_special_type_num_init_method : Error< "types with 'sycl_special_class' attribute must have one and only one '__init' " "method defined">; +// SYCL external attribute diagnostics +def err_sycl_attribute_invalid_linkage : Error< + "'sy

[clang] [clang][SYCL] Add sycl_external attribute and restrict emitting device code (PR #140282)

2025-07-23 Thread Erich Keane via cfe-commits
@@ -1641,6 +1641,13 @@ def DeviceKernel : DeclOrTypeAttr { }]; } +def SYCLExternal : InheritableAttr { + let Spellings = [Clang<"sycl_external">]; erichkeane wrote: > We use the `Clang` spelling for `sycl_kernel_entry_point`, what would be the > reason for

[clang] [clang] Implement -Walloc-size diagnostic option (PR #150028)

2025-07-23 Thread Erich Keane via cfe-commits
@@ -3684,6 +3684,12 @@ def warn_alloca_align_alignof : Warning< "second argument to __builtin_alloca_with_align is supposed to be in bits">, InGroup>; +def warn_alloc_size +: Warning< + "allocation of insufficient size '%0' for type %1 with size '%2'">, +

[clang] [clang][SYCL] Add sycl_external attribute and restrict emitting device code (PR #140282)

2025-07-23 Thread Erich Keane via cfe-commits
@@ -12937,6 +12937,10 @@ bool ASTContext::DeclMustBeEmitted(const Decl *D) { if (D->hasAttr()) return false; + if (LangOpts.SYCLIsDevice && !D->hasAttr() && + !D->hasAttr()) erichkeane wrote: This doesn't seem right to me, as it changes/causes us

[clang] [clang][SYCL] Add sycl_external attribute and restrict emitting device code (PR #140282)

2025-07-23 Thread Erich Keane via cfe-commits
@@ -476,6 +476,47 @@ The SYCL kernel in the previous code sample meets these expectations. }]; } +def SYCLExternalDocs : Documentation { + let Category = DocCatFunction; + let Heading = "sycl_external"; + let Content = [{ +The ``sycl_external`` attribute indicates that a

[clang] [clang][SYCL] Add sycl_external attribute and restrict emitting device code (PR #140282)

2025-07-23 Thread Erich Keane via cfe-commits
@@ -1641,6 +1641,13 @@ def DeviceKernel : DeclOrTypeAttr { }]; } +def SYCLExternal : InheritableAttr { + let Spellings = [Clang<"sycl_external">]; erichkeane wrote: ```suggestion let Spellings = [CXX11<"sycl_external">]; ``` Alternatively: ```suggestion

[clang] [clang][SYCL] Add sycl_external attribute and restrict emitting device code (PR #140282)

2025-07-23 Thread Erich Keane via cfe-commits
@@ -12908,6 +12908,14 @@ def err_sycl_special_type_num_init_method : Error< "types with 'sycl_special_class' attribute must have one and only one '__init' " "method defined">; +// SYCL external attribute diagnostics +def err_sycl_attribute_invalid_linkage : Error< + "'sy

[clang] [clang][SYCL] Add sycl_external attribute and restrict emitting device code (PR #140282)

2025-07-23 Thread Erich Keane via cfe-commits
@@ -12251,6 +12264,9 @@ bool Sema::CheckFunctionDeclaration(Scope *S, FunctionDecl *NewFD, if (NewFD->hasAttr()) SYCL().CheckSYCLEntryPointFunctionDecl(NewFD); + if (NewFD->hasAttr()) +SYCL().CheckSYCLExternalFunctionDecl(NewFD); erichkeane wrote:

[clang] [clang][SYCL] Add sycl_external attribute and restrict emitting device code (PR #140282)

2025-07-23 Thread Erich Keane via cfe-commits
@@ -4084,6 +4084,19 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, NamedDecl *&OldD, Scope *S, diag::note_carries_dependency_missing_first_decl) << 0/*Function*/; } +// SYCL 2020 section 5.10.1, "SYCL functions and member functions linkage": +// W

[clang] [clang][SYCL] Add sycl_external attribute and restrict emitting device code (PR #140282)

2025-07-23 Thread Erich Keane via cfe-commits
@@ -476,6 +476,47 @@ The SYCL kernel in the previous code sample meets these expectations. }]; } +def SYCLExternalDocs : Documentation { + let Category = DocCatFunction; + let Heading = "sycl_external"; + let Content = [{ +The ``sycl_external`` attribute indicates that a

[clang] [clang][SYCL] Add sycl_external attribute and restrict emitting device code (PR #140282)

2025-07-23 Thread Erich Keane via cfe-commits
@@ -476,6 +476,47 @@ The SYCL kernel in the previous code sample meets these expectations. }]; } +def SYCLExternalDocs : Documentation { + let Category = DocCatFunction; + let Heading = "sycl_external"; + let Content = [{ +The ``sycl_external`` attribute indicates that a

[clang] [clang][SYCL] Add sycl_external attribute and restrict emitting device code (PR #140282)

2025-07-23 Thread Erich Keane via cfe-commits
@@ -16275,6 +16297,13 @@ Decl *Sema::ActOnFinishFunctionBody(Decl *dcl, Stmt *Body, } } + if (FD && !FD->isInvalidDecl() && FD->hasAttr()) { +SYCLExternalAttr *SEAttr = FD->getAttr(); +if (FD->isDeletedAsWritten()) erichkeane wrote: What about

[clang] [clang][SYCL] Add sycl_external attribute and restrict emitting device code (PR #140282)

2025-07-23 Thread Erich Keane via cfe-commits
@@ -476,6 +476,47 @@ The SYCL kernel in the previous code sample meets these expectations. }]; } +def SYCLExternalDocs : Documentation { + let Category = DocCatFunction; + let Heading = "sycl_external"; + let Content = [{ +The ``sycl_external`` attribute indicates that a

[clang] [clang][SYCL] Add sycl_external attribute and restrict emitting device code (PR #140282)

2025-07-23 Thread Erich Keane via cfe-commits
@@ -476,6 +476,47 @@ The SYCL kernel in the previous code sample meets these expectations. }]; } +def SYCLExternalDocs : Documentation { + let Category = DocCatFunction; + let Heading = "sycl_external"; + let Content = [{ +The ``sycl_external`` attribute indicates that a

[clang] [clang][SYCL] Add sycl_external attribute and restrict emitting device code (PR #140282)

2025-07-23 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: Ah shoot, apparently I forgot to click 'submit' when I reviewed this last week. Sorry about that. Here are my pending comments. https://github.com/llvm/llvm-project/pull/140282 ___ cfe-commits mailing list cf

[clang] [clang][SYCL] Add sycl_external attribute and restrict emitting device code (PR #140282)

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

[clang] [clang] Implement -Walloc-size diagnostic option (PR #150028)

2025-07-22 Thread Erich Keane via cfe-commits
@@ -3256,6 +3257,14 @@ class CallExpr : public Expr { setDependence(getDependence() | ExprDependence::TypeValueInstantiation); } + /// Try to get the alloc_size attribute of the callee. May return null. + const AllocSizeAttr *getAllocSizeAttr() const;

[clang] [clang] Implement -Walloc-size diagnostic option (PR #150028)

2025-07-22 Thread Erich Keane via cfe-commits
@@ -3256,6 +3257,14 @@ class CallExpr : public Expr { setDependence(getDependence() | ExprDependence::TypeValueInstantiation); } + /// Try to get the alloc_size attribute of the callee. May return null. + const AllocSizeAttr *getAllocSizeAttr() const; + + /// Get the

[clang] [clang] Implement -Walloc-size diagnostic option (PR #150028)

2025-07-22 Thread Erich Keane via cfe-commits
@@ -3684,6 +3684,12 @@ def warn_alloca_align_alignof : Warning< "second argument to __builtin_alloca_with_align is supposed to be in bits">, InGroup>; +def warn_alloc_size +: Warning< + "allocation of insufficient size '%0' for type %1 with size '%2'">, +

[clang] [clang] Implement -Walloc-size diagnostic option (PR #150028)

2025-07-22 Thread Erich Keane via cfe-commits
@@ -3542,6 +3542,59 @@ bool CallExpr::isBuiltinAssumeFalse(const ASTContext &Ctx) const { Arg->EvaluateAsBooleanCondition(ArgVal, Ctx) && !ArgVal; } +const AllocSizeAttr *CallExpr::getAllocSizeAttr() const { + if (const FunctionDecl *DirectCallee = getDirectCallee()

[clang] [clang] Implement -Walloc-size diagnostic option (PR #150028)

2025-07-22 Thread Erich Keane via cfe-commits
@@ -717,6 +717,10 @@ Improvements to Clang's diagnostics Added a new warning in this group for the case where the attribute is missing/implicit on an override of a virtual method. +- A new warning ``-Walloc-size`` has been added to detect calls to functions + decorated w

[clang] [clang] Check empty macro name in `#pragma push_macro("")` or `#pragma pop_macro("")` (PR #149982)

2025-07-22 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. 1 nit, else lgtm. https://github.com/llvm/llvm-project/pull/149982 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Check empty macro name in `#pragma push_macro("")` or `#pragma pop_macro("")` (PR #149982)

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

[clang] [clang] Check empty macro name in `#pragma push_macro("")` or `#pragma pop_macro("")` (PR #149982)

2025-07-22 Thread Erich Keane via cfe-commits
@@ -694,6 +694,9 @@ def err_pragma_push_pop_macro_malformed : Error< def warn_pragma_pop_macro_no_push : Warning< "pragma pop_macro could not pop '%0', no matching push_macro">, InGroup; +def warn_pargma_push_pop_macro_empty_string : Warning< + "#pragma %select{push_macr

[clang] [Clang] Add elementwise maximumnum/minimumnum builtin functions (PR #149775)

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

[clang] [Clang] Add elementwise maximumnum/minimumnum builtin functions (PR #149775)

2025-07-21 Thread Erich Keane via cfe-commits
@@ -4108,6 +4108,22 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID, return RValue::get(Result); } + case Builtin::BI__builtin_elementwise_maximumnum: { +Value *Op0 = EmitScalarExpr(E->getArg(0)); erichkeane wrote

[clang] [PATCH 1/6] [clang] Improve nested name specifier AST representation (PR #147835)

2025-07-21 Thread Erich Keane via cfe-commits
@@ -307,7 +307,7 @@ class DynTypedNode { /// For nodes which represent textual entities in the source code, /// return their SourceRange. For all other nodes, return SourceRange(). - SourceRange getSourceRange() const; + SourceRange getSourceRange(bool IncludeQualifier

[clang] [PATCH 1/6] [clang] Improve nested name specifier AST representation (PR #147835)

2025-07-21 Thread Erich Keane via cfe-commits
@@ -532,4 +532,4 @@ template <> struct DenseMapInfo { }; } // namespace llvm -#endif // LLVM_CLANG_AST_NESTEDNAMESPECIFIER_H +#endif // LLVM_CLANG_AST_NESTEDNAMESPECIFIERBASE_H erichkeane wrote: This doesn't seem right? https://github.com/llvm/llvm-project

[clang] [PATCH 1/6] [clang] Improve nested name specifier AST representation (PR #147835)

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

[clang] [PATCH 1/6] [clang] Improve nested name specifier AST representation (PR #147835)

2025-07-21 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. I did as thorough of a review as I could. a small nit, else this is LGTM once the other reviewers who have commented are happy. https://github.com/llvm/llvm-project/pull/147835 ___ cfe-commits

[clang] [Clang] Add elementwise maximumnum/minimumnum builtin functions (PR #149775)

2025-07-21 Thread Erich Keane via cfe-commits
@@ -4108,6 +4108,22 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID, return RValue::get(Result); } + case Builtin::BI__builtin_elementwise_maximumnum: { +Value *Op0 = EmitScalarExpr(E->getArg(0)); erichkeane wrote

[clang] [clang] improve consistency with GCC vector comparison (PR #148954)

2025-07-21 Thread Erich Keane via cfe-commits
@@ -12901,25 +12901,9 @@ QualType Sema::GetSignedVectorType(QualType V) { return Context.getExtVectorType(Context.LongLongTy, VTy->getNumElements()); } - if (TypeSize == Context.getTypeSize(Context.Int128Ty)) -return Context.getVectorType(Context.Int128Ty, VTy->getN

[clang] [clang] improve consistency with GCC vector comparison (PR #148954)

2025-07-21 Thread Erich Keane via cfe-commits
@@ -13206,6 +13206,30 @@ QualType ASTContext::getIntTypeForBitwidth(unsigned DestWidth, return QualTy; } +/// getGCCCompatibleIntTypeForBitwidth - +/// sets integer QualTy according to specified details: +/// bitwidth, signed/unsigned. +/// this function is compatible with

[clang] [clang] improve consistency with GCC vector comparison (PR #148954)

2025-07-21 Thread Erich Keane via cfe-commits
@@ -13206,6 +13206,30 @@ QualType ASTContext::getIntTypeForBitwidth(unsigned DestWidth, return QualTy; } +/// getGCCCompatibleIntTypeForBitwidth - +/// sets integer QualTy according to specified details: +/// bitwidth, signed/unsigned. +/// this function is compatible with

[clang] [clang] improve consistency with GCC vector comparison (PR #148954)

2025-07-21 Thread Erich Keane via cfe-commits
@@ -876,6 +876,15 @@ class ASTContext : public RefCountedBase { QualType getIntTypeForBitwidth(unsigned DestWidth, unsigned Signed) const; + /// getGCCCompatibleIntTypeForBitwidth - + /// sets integer QualTy according to specified details:

[clang] [clang][Diagnostic] Clarify error message for auto (PR #149781)

2025-07-21 Thread Erich Keane via cfe-commits
@@ -8237,12 +8237,24 @@ Sema::CheckTemplateDeclScope(Scope *S, TemplateParameterList *TemplateParams) { if (CXXRecordDecl *RD = dyn_cast(Ctx)) { // C++ [temp.mem]p2: // A local class shall not have member templates. - if (RD->isLocalClass()) -ret

[clang] [clang][Diagnostic] Clarify error message for auto (PR #149781)

2025-07-21 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: I think we'd want to extract the determination of a dialog location into a separate function (lambda?) to help calculate it, in both of the diag cases, including hte `err_template_outside_namespace_or_class_scope` diag. Also: we need a test for this. A

[clang] [clang][Diagnostic] Clarify error message for auto (PR #149781)

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

[clang] More fixes for P3144R2 implementation (PR #149406)

2025-07-18 Thread Erich Keane via cfe-commits
https://github.com/erichkeane requested changes to this pull request. Marking as 'requested changes' so this doesn't get inadvertently merged while discussions re: the diagnostics are happening. https://github.com/llvm/llvm-project/pull/149406 ___ cfe

[clang] More fixes for P3144R2 implementation (PR #149406)

2025-07-18 Thread Erich Keane via cfe-commits
@@ -8392,17 +8392,19 @@ def ext_default_init_const : ExtWarn< "is a Microsoft extension">, InGroup; def err_delete_operand : Error<"cannot delete expression of type %0">; +def err_delete_void_ptr_operand : Error< + "cannot delete expression with pointer-to-'void' type %0">

[clang] [Clang][ARM] Fix __ARM_FEATURE_LDREX on Armv8-M (PR #149538)

2025-07-18 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. I'm find with this, but am not the one who should be reviewing for correctness :) I presume the submitter knows the ARM features list better than I, so *shrug*. https://github.com/llvm/llvm-project/pull/149538 _

[clang] [Clang] Add -Wimplicit-fallthrough to -Wextra for GCC compatibility (PR #149474)

2025-07-18 Thread Erich Keane via cfe-commits
erichkeane wrote: I did a dive through the history here. It seems that the 'hold up' historically is the 'flex' project using the comment-based form. I agree with historical discussions that recognizing comments here is silly, and we should not do it. That said, I'm generally in favor of th

[clang] [Clang] Do not assume a perfect match is a better match than a non-template non-perfect match (PR #149504)

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

[clang] [OpenACC][Sema] Implement warning for non-effective 'private' (PR #149004)

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

[clang] [CIR] Add rotate operation (PR #148426)

2025-07-16 Thread Erich Keane via cfe-commits
erichkeane wrote: > Did this patch undergo a Windows CI build? Clang-IR changes don't quite yet trigger MLIR/CIR builds yet, just the plain Clang builds, Andy has a patch that has recently received approval from the Infra Area Team to do so, it just needs a few final approvals. That said, are

[clang] Don't mark lambda non-dependent if nested in a generic lambda. (PR #149121)

2025-07-16 Thread Erich Keane via cfe-commits
@@ -15512,6 +15512,8 @@ TreeTransform::TransformLambdaExpr(LambdaExpr *E) { DC = DC->getParent(); if ((getSema().isUnevaluatedContext() || getSema().isConstantEvaluatedContext()) && + !(dyn_cast_or_null(DC->getParent()) && erichkeane wrote:

[clang] [OpenACC][Sema] Implement warning for non-effective 'private' (PR #149004)

2025-07-16 Thread Erich Keane via cfe-commits
https://github.com/erichkeane updated https://github.com/llvm/llvm-project/pull/149004 >From fc35a6148e45f2a0b17fc362a1143077b93ad294 Mon Sep 17 00:00:00 2001 From: erichkeane Date: Tue, 15 Jul 2025 18:08:10 -0700 Subject: [PATCH 1/2] [OpenACC][Sema] Implement warning for non-effective 'privat

[clang] [clang] improve consistency with GCC vector comparison (PR #148954)

2025-07-16 Thread Erich Keane via cfe-commits
@@ -12901,24 +12901,24 @@ QualType Sema::GetSignedVectorType(QualType V) { return Context.getExtVectorType(Context.LongLongTy, VTy->getNumElements()); } - if (TypeSize == Context.getTypeSize(Context.Int128Ty)) -return Context.getVectorType(Context.Int128Ty, VTy->get

[clang] [OpenACC][Sema] Implement warning for non-effective 'private' (PR #149004)

2025-07-16 Thread Erich Keane via cfe-commits
@@ -624,6 +624,66 @@ void SemaOpenACC::CheckDeclReference(SourceLocation Loc, Expr *E, Decl *D) { // loop (or we aren't in a loop!) so skip the diagnostic. } +namespace { +// Check whether the type of the thing we are referencing is OK for things like +// private, firstpriv

[clang] [OpenACC][Sema] Implement warning for non-effective 'private' (PR #149004)

2025-07-16 Thread Erich Keane via cfe-commits
@@ -13478,6 +13478,12 @@ def err_acc_invalid_default_type def err_acc_device_type_multiple_archs : Error<"OpenACC 'device_type' clause on a 'set' construct only permits " "one architecture">; +def warn_acc_var_referenced_lacks_op +: Warning<"variable of type

  1   2   3   4   5   6   7   8   9   10   >