[clang] [OpenACC] 'collapse' clause 'force' tag (PR #110906)

2024-10-02 Thread Erich Keane via cfe-commits
https://github.com/erichkeane created https://github.com/llvm/llvm-project/pull/110906 The 'force' tag permits intervening code on the applicable 'loop' construct, so this implements the restriction when the 'force' tag isn't present. >From 2cf12f7d5e6ea7727ea40bfa229758f4d657f5e9 Mon Sep 17 0

[clang] [Clang][Sema] Bump the instantiated index when skipping past non-init-captures (PR #110887)

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

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

2024-10-02 Thread Erich Keane via cfe-commits
erichkeane wrote: > @erichkeane Since you’ve approved the pr, shall we merge it once CI is done > or do you still want to wait for Shafik to review the release note? > > (I don’t have anything else to comment on either) I'm OK just committing. Shafik did a run at the release note that wasn't

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

2024-10-02 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. I have no further comments here, this looks good to me. https://github.com/llvm/llvm-project/pull/99656 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mai

[clang] [clang][frontend] Add support for attribute plugins for statement attributes (PR #110334)

2024-10-02 Thread Erich Keane via cfe-commits
erichkeane wrote: > > So the problem with statement attributes is that we don't really have a > > good way to do instantiation of them on a template, which is why we held > > off on this in the first place. The infrastructure for instantiation DOES > > happen on decl attributes automatically a

[clang] [OpenACC] Check Loop counts for 'collapse' clause. (PR #110851)

2024-10-02 Thread Erich Keane via cfe-commits
https://github.com/erichkeane created https://github.com/llvm/llvm-project/pull/110851 OpenACC Spec requires that each loop associated with a 'collapse' have exactly 1 loop/nest. This is implemented in 2 parts: 1- diagnosing when we see a 2nd loop at any level with an applicable 'collapse' 2-

[clang] [Clang] omit parentheses in fold expressions with a single expansion (PR #110761)

2024-10-02 Thread Erich Keane via cfe-commits
@@ -15598,6 +15598,9 @@ TreeTransform::TransformCXXFoldExpr(CXXFoldExpr *E) { return getDerived().RebuildEmptyCXXFoldExpr(E->getEllipsisLoc(), E->getOperator()); + if (*NumExpansions == 1) erichkeane wrote:

[clang] [OpenACC] Enforce all 'collapse' intervening rules (PR #110684)

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

[clang] [clang][frontend] Add support for attribute plugins for statement attributes (PR #110334)

2024-10-02 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: So the problem with statement attributes is that we don't really have a good way to do instantiation of them on a template, which is why we held off on this in the first place. The infrastructure for instantiation DOES happen on decl attributes automati

[clang] [OpenACC] Enforce all 'collapse' intervening rules (PR #110684)

2024-10-01 Thread Erich Keane via cfe-commits
https://github.com/erichkeane created https://github.com/llvm/llvm-project/pull/110684 'collapse' makes the 'loop' construct apply to the next N nested loops, and 'loop' requires all associated loops be 'for' loops (or range-for). This patch adds this restriction, plus adds a number of infras

[clang] [clang] Fix the local parameter of void type inside the `Requires` expression. (PR #109831)

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

[clang] [OpenACC] Add 'collapse' clause AST/basic Sema implementation (PR #109461)

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

[clang] [Clang][TableGen] Change ClangDiagnosticEmitter to use const Record * (PR #110585)

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

[clang] Add Clang attribute to ensure that fields are initialized explicitly (PR #102040)

2024-09-30 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. I'm happy, pending Aaron's comments on the two diagnostic things. https://github.com/llvm/llvm-project/pull/102040 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/

[clang] [Clang] prevent recovery call expression from proceeding with explicit attributes and undeclared templates (PR #107786)

2024-09-30 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. Diag seems reasonable to me now. I want Aaron to take another look (he's sadly out this week, so it'll have to be when he gets back), but I think this seems to make sense here. https://github.com/llvm/llvm-project/pull/107786 _

[clang] Add Clang attribute to ensure that fields are initialized explicitly (PR #102040)

2024-09-30 Thread Erich Keane via cfe-commits
@@ -551,3 +551,14 @@ struct full_of_empty empty_test_2(void) { struct full_of_empty e; return e; // no-warning } + +struct with_explicit_field { + int x; + int y [[clang::requires_explicit_initialization]]; // expected-note 2{{'y' declared here}} erichke

[clang] Add Clang attribute to ensure that fields are initialized explicitly (PR #102040)

2024-09-30 Thread Erich Keane via cfe-commits
@@ -551,3 +551,14 @@ struct full_of_empty empty_test_2(void) { struct full_of_empty e; return e; // no-warning } + +struct with_explicit_field { + int x; + int y [[clang::requires_explicit_initialization]]; // expected-note 2{{'y' declared here}} erichke

[clang] Add Clang attribute to ensure that fields are initialized explicitly (PR #102040)

2024-09-30 Thread Erich Keane via cfe-commits
@@ -268,6 +268,69 @@ static void CheckStringInit(Expr *Str, QualType &DeclT, const ArrayType *AT, updateStringLiteralType(Str, DeclT); } +template +std::enable_if_t()( + std::declval()))>, + size_t> +forEachFieldRecursive(const RecordDec

[clang] Add Clang attribute to ensure that fields are initialized explicitly (PR #102040)

2024-09-30 Thread Erich Keane via cfe-commits
@@ -551,3 +551,14 @@ struct full_of_empty empty_test_2(void) { struct full_of_empty e; return e; // no-warning } + +struct with_explicit_field { + int x; + int y [[clang::requires_explicit_initialization]]; // expected-note 2{{'y' declared here}} erichke

[clang] Add Clang attribute to ensure that fields are initialized explicitly (PR #102040)

2024-09-30 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: Just about there IMO, still have an open on the two diagnostic things, but otherwise only a few nit-like things (but please update the tests, it makes it much easier to review/update in the future) https://github.com/llvm/llvm-project/pull/102040 __

[clang] Add Clang attribute to ensure that fields are initialized explicitly (PR #102040)

2024-09-30 Thread Erich Keane via cfe-commits
@@ -1472,3 +1472,56 @@ template struct Outer { }; }; Outer::Inner outerinner; + +void aggregate() { + struct NonAgg { +NonAgg() { } +[[clang::requires_explicit_initialization]] int f; // expected-warning {{'requires_explicit_initialization' attribute is ignored in

[clang] Add Clang attribute to ensure that fields are initialized explicitly (PR #102040)

2024-09-30 Thread Erich Keane via cfe-commits
@@ -268,6 +268,69 @@ static void CheckStringInit(Expr *Str, QualType &DeclT, const ArrayType *AT, updateStringLiteralType(Str, DeclT); } +template +std::enable_if_t()( + std::declval()))>, + size_t> +forEachFieldRecursive(const RecordDec

[clang] Add Clang attribute to ensure that fields are initialized explicitly (PR #102040)

2024-09-30 Thread Erich Keane via cfe-commits
@@ -5214,9 +5215,9 @@ unsigned RecordDecl::getODRHash() { // Only calculate hash on first call of getODRHash per record. ODRHash Hash; Hash.AddRecordDecl(this); - // For RecordDecl the ODRHash is stored in the remaining 26 - // bit of RecordDeclBits, adjust the hash to

[clang] Add Clang attribute to ensure that fields are initialized explicitly (PR #102040)

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

[clang] Add Clang attribute to ensure that fields are initialized explicitly (PR #102040)

2024-09-30 Thread Erich Keane via cfe-commits
@@ -5214,9 +5215,9 @@ unsigned RecordDecl::getODRHash() { // Only calculate hash on first call of getODRHash per record. ODRHash Hash; Hash.AddRecordDecl(this); - // For RecordDecl the ODRHash is stored in the remaining 26 - // bit of RecordDeclBits, adjust the hash to

[clang] Add Clang attribute to ensure that fields are initialized explicitly (PR #102040)

2024-09-30 Thread Erich Keane via cfe-commits
erichkeane wrote: See: https://discourse.llvm.org/t/review-availability/81342 https://github.com/llvm/llvm-project/pull/102040 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Add Clang attribute to ensure that fields are initialized explicitly (PR #102040)

2024-09-30 Thread Erich Keane via cfe-commits
erichkeane wrote: > @AaronBallman this seems to have progressed much further after your review > and is currently pending on input from you. Could you please do a round of > review here/in the RFC? (Or ask someone else from the community to address > your concerns and be a reviewer instead, no

[clang] Add Clang attribute to ensure that fields are initialized explicitly (PR #102040)

2024-09-30 Thread Erich Keane via cfe-commits
erichkeane wrote: > > THOUGH: that makes me wonder, have you played with virtual bases yet? Are > > we 'sane' for those? > > I have not, but those can't be aggregates, right? Right, good, yeah, that shouldn't be a problem then. > > The function should be pretty easy though > > > `// DFS for

[clang] Add Clang attribute to ensure that fields are initialized explicitly (PR #102040)

2024-09-30 Thread Erich Keane via cfe-commits
@@ -551,3 +551,14 @@ struct full_of_empty empty_test_2(void) { struct full_of_empty e; return e; // no-warning } + +struct with_explicit_field { + int x; + int y [[clang::requires_explicit_initialization]]; // expected-note {{declared}} erichkeane wrote:

[clang] [Clang] Implement CWG 2707 "Deduction guides cannot have a trailing requires-clause" (PR #110473)

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

[clang] [clang] Fix the local parameter of void type inside the `Requires` expression. (PR #109831)

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

[clang] [Clang][Concepts] Normalize SizeOfPackExpr's pack declaration (PR #110238)

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

[clang] Add Clang attribute to ensure that fields are initialized explicitly (PR #102040)

2024-09-30 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: There isn't a way to remove the 'request changes' without approval, but I did some debugging and see what I was assuming was wrong. So I don't have any concerns on the approach. However, in using it for the last few hours, I REALLY dislike the diagnost

[clang] [clang] Finish implementation of P0522 (PR #96023)

2024-09-30 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. I'm OK with this as long as it is the direction CWG is going. https://github.com/llvm/llvm-project/pull/96023 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-b

[clang] [clang] Improve deduction of reference typed NTTP (PR #110393)

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

[clang] [Clang][Sema] Retain the expanding index for unevaluated type constraints (PR #109518)

2024-09-30 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. I like the solution here, I think this is a good way of making our constraint instantiation more stable. Thanks! https://github.com/llvm/llvm-project/pull/109518 ___ cfe-commits mailing list c

[clang] Add Clang attribute to ensure that fields are initialized explicitly (PR #102040)

2024-09-27 Thread Erich Keane via cfe-commits
https://github.com/erichkeane requested changes to this pull request. Marking 'request-changes' not as there are changes needed, but that I have concerns about the implementation that I have to spend some time in a debugger to assuage. https://github.com/llvm/llvm-project/pull/102040 _

[clang] Add Clang attribute to ensure that fields are initialized explicitly (PR #102040)

2024-09-27 Thread Erich Keane via cfe-commits
@@ -4561,6 +4569,13 @@ static void TryConstructorInitialization(Sema &S, CXXConstructorDecl *CtorDecl = cast(Best->Function); if (Result != OR_Deleted) { +if (!IsListInit && Kind.getKind() == InitializationKind::IK_Default && erichkeane wrote: This is

[clang] Add Clang attribute to ensure that fields are initialized explicitly (PR #102040)

2024-09-27 Thread Erich Keane via cfe-commits
@@ -4561,6 +4569,13 @@ static void TryConstructorInitialization(Sema &S, CXXConstructorDecl *CtorDecl = cast(Best->Function); if (Result != OR_Deleted) { +if (!IsListInit && Kind.getKind() == InitializationKind::IK_Default && erichkeane wrote: Ah,yes.

[clang] Add Clang attribute to ensure that fields are initialized explicitly (PR #102040)

2024-09-27 Thread Erich Keane via cfe-commits
@@ -4561,6 +4569,13 @@ static void TryConstructorInitialization(Sema &S, CXXConstructorDecl *CtorDecl = cast(Best->Function); if (Result != OR_Deleted) { +if (!IsListInit && Kind.getKind() == InitializationKind::IK_Default && erichkeane wrote: You're

[clang] Add Clang attribute to ensure that fields are initialized explicitly (PR #102040)

2024-09-27 Thread Erich Keane via cfe-commits
@@ -4561,6 +4569,13 @@ static void TryConstructorInitialization(Sema &S, CXXConstructorDecl *CtorDecl = cast(Best->Function); if (Result != OR_Deleted) { +if (!IsListInit && Kind.getKind() == InitializationKind::IK_Default && erichkeane wrote: >Becaus

[clang] Add Clang attribute to ensure that fields are initialized explicitly (PR #102040)

2024-09-27 Thread Erich Keane via cfe-commits
@@ -2837,6 +2837,10 @@ bool QualType::hasNonTrivialToPrimitiveCopyCUnion(const RecordDecl *RD) { return RD->hasNonTrivialToPrimitiveCopyCUnion(); } +bool QualType::hasUninitializedExplicitInitFields(const RecordDecl *RD) { erichkeane wrote: Right, I would

[clang] Add Clang attribute to ensure that fields are initialized explicitly (PR #102040)

2024-09-27 Thread Erich Keane via cfe-commits
@@ -6457,6 +6472,18 @@ void InitializationSequence::InitializeFrom(Sema &S, } } + if (!S.getLangOpts().CPlusPlus && + Kind.getKind() == InitializationKind::IK_Default) { +RecordDecl *Rec = DestType->getAsRecordDecl(); +if (Rec && Rec->hasUninitializedExplic

[clang] Add Clang attribute to ensure that fields are initialized explicitly (PR #102040)

2024-09-27 Thread Erich Keane via cfe-commits
@@ -2837,6 +2837,10 @@ bool QualType::hasNonTrivialToPrimitiveCopyCUnion(const RecordDecl *RD) { return RD->hasNonTrivialToPrimitiveCopyCUnion(); } +bool QualType::hasUninitializedExplicitInitFields(const RecordDecl *RD) { erichkeane wrote: This is a bit o

[clang] Add Clang attribute to ensure that fields are initialized explicitly (PR #102040)

2024-09-27 Thread Erich Keane via cfe-commits
@@ -4561,6 +4569,13 @@ static void TryConstructorInitialization(Sema &S, CXXConstructorDecl *CtorDecl = cast(Best->Function); if (Result != OR_Deleted) { +if (!IsListInit && Kind.getKind() == InitializationKind::IK_Default && erichkeane wrote: Ok, per

[clang] Add Clang attribute to ensure that fields are initialized explicitly (PR #102040)

2024-09-27 Thread Erich Keane via cfe-commits
@@ -3141,6 +3148,10 @@ def warn_attribute_ignored_no_calls_in_stmt: Warning< "statement">, InGroup; +def warn_attribute_needs_aggregate : Warning< erichkeane wrote: I still disagree, in that misuse of this attribute should be harsher than a warning, we h

[clang] Add Clang attribute to ensure that fields are initialized explicitly (PR #102040)

2024-09-27 Thread Erich Keane via cfe-commits
@@ -743,6 +743,14 @@ void InitListChecker::FillInEmptyInitForField(unsigned Init, FieldDecl *Field, ILE->updateInit(SemaRef.Context, Init, Filler); return; } + +if (!VerifyOnly && Field->hasAttr()) { + SemaRef.Diag(ILE->getExprLoc(), diag::warn_field

[clang] Add Clang attribute to ensure that fields are initialized explicitly (PR #102040)

2024-09-27 Thread Erich Keane via cfe-commits
@@ -6457,6 +6472,18 @@ void InitializationSequence::InitializeFrom(Sema &S, } } + if (!S.getLangOpts().CPlusPlus && + Kind.getKind() == InitializationKind::IK_Default) { +RecordDecl *Rec = DestType->getAsRecordDecl(); +if (Rec && Rec->hasUninitializedExplic

[clang] Add Clang attribute to ensure that fields are initialized explicitly (PR #102040)

2024-09-27 Thread Erich Keane via cfe-commits
@@ -3141,6 +3148,10 @@ def warn_attribute_ignored_no_calls_in_stmt: Warning< "statement">, InGroup; +def warn_attribute_needs_aggregate : Warning< erichkeane wrote: just a quick grepping (and I gave up pretty quickly :D : `err_anyx86_interrupt_attribute`

[clang] Add Clang attribute to ensure that fields are initialized explicitly (PR #102040)

2024-09-27 Thread Erich Keane via cfe-commits
@@ -1472,3 +1472,56 @@ template struct Outer { }; }; Outer::Inner outerinner; + +void aggregate() { + struct NonAgg { +NonAgg() { } +[[clang::requires_explicit_initialization]] int f; // expected-warning {{attribute is ignored}} + }; + NonAgg nonagg; + (void)non

[clang] Add Clang attribute to ensure that fields are initialized explicitly (PR #102040)

2024-09-27 Thread Erich Keane via cfe-commits
@@ -4561,6 +4569,13 @@ static void TryConstructorInitialization(Sema &S, CXXConstructorDecl *CtorDecl = cast(Best->Function); if (Result != OR_Deleted) { +if (!IsListInit && Kind.getKind() == InitializationKind::IK_Default && +DestRecordDecl != nullptr && DestR

[clang] Add Clang attribute to ensure that fields are initialized explicitly (PR #102040)

2024-09-27 Thread Erich Keane via cfe-commits
@@ -6457,6 +6472,18 @@ void InitializationSequence::InitializeFrom(Sema &S, } } + if (!S.getLangOpts().CPlusPlus && + Kind.getKind() == InitializationKind::IK_Default) { +RecordDecl *Rec = DestType->getAsRecordDecl(); +if (Rec && Rec->hasUninitializedExplic

[clang] Add Clang attribute to ensure that fields are initialized explicitly (PR #102040)

2024-09-27 Thread Erich Keane via cfe-commits
@@ -551,3 +551,14 @@ struct full_of_empty empty_test_2(void) { struct full_of_empty e; return e; // no-warning } + +struct with_explicit_field { + int x; + int y [[clang::requires_explicit_initialization]]; // expected-note {{declared}} +}; + +void aggregate() { + struc

[clang] Add Clang attribute to ensure that fields are initialized explicitly (PR #102040)

2024-09-27 Thread Erich Keane via cfe-commits
@@ -1472,3 +1472,56 @@ template struct Outer { }; }; Outer::Inner outerinner; + +void aggregate() { + struct NonAgg { +NonAgg() { } +[[clang::requires_explicit_initialization]] int f; // expected-warning {{attribute is ignored}} + }; + NonAgg nonagg; + (void)non

[clang] Add Clang attribute to ensure that fields are initialized explicitly (PR #102040)

2024-09-27 Thread Erich Keane via cfe-commits
@@ -2302,6 +2302,10 @@ def err_init_list_bad_dest_type : Error< def warn_cxx20_compat_aggregate_init_with_ctors : Warning< "aggregate initialization of type %0 with user-declared constructors " "is incompatible with C++20">, DefaultIgnore, InGroup; +def warn_cxx20_compat_re

[clang] Add Clang attribute to ensure that fields are initialized explicitly (PR #102040)

2024-09-27 Thread Erich Keane via cfe-commits
@@ -2331,6 +2335,9 @@ def err_init_reference_member_uninitialized : Error< "reference member of type %0 uninitialized">; def note_uninit_reference_member : Note< "uninitialized reference member is here">; +def warn_field_requires_explicit_init : Warning< + "field %select{%

[clang] Add Clang attribute to ensure that fields are initialized explicitly (PR #102040)

2024-09-27 Thread Erich Keane via cfe-commits
@@ -2331,6 +2335,9 @@ def err_init_reference_member_uninitialized : Error< "reference member of type %0 uninitialized">; def note_uninit_reference_member : Note< "uninitialized reference member is here">; +def warn_field_requires_explicit_init : Warning< + "field %select{%

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

2024-09-26 Thread Erich Keane via cfe-commits
@@ -4712,12 +4715,13 @@ class FunctionEffect { public: /// Identifies the particular effect. enum class Kind : uint8_t { -None = 0, -NonBlocking = 1, -NonAllocating = 2, -Blocking = 3, -Allocating = 4 +NonBlocking = 0, +NonAllocating = 1, +Bl

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

2024-09-26 Thread Erich Keane via cfe-commits
@@ -571,6 +571,9 @@ New features if class of allocation and deallocation function mismatches. `Documentation `__. +- Function effects (the ``nonblocking`` and ``nonallocating`` "performance

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

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

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

2024-09-26 Thread Erich Keane via cfe-commits
@@ -4712,12 +4715,13 @@ class FunctionEffect { public: /// Identifies the particular effect. enum class Kind : uint8_t { -None = 0, -NonBlocking = 1, -NonAllocating = 2, -Blocking = 3, -Allocating = 4 +NonBlocking = 0, +NonAllocating = 1, +Bl

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

2024-09-26 Thread Erich Keane via cfe-commits
@@ -0,0 +1,1571 @@ +//=== 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-26 Thread Erich Keane via cfe-commits
@@ -571,6 +571,9 @@ New features if class of allocation and deallocation function mismatches. `Documentation `__. +- Function effects (the ``nonblocking`` and ``nonallocating`` "performance

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

2024-09-26 Thread Erich Keane via cfe-commits
@@ -571,6 +571,9 @@ New features if class of allocation and deallocation function mismatches. `Documentation `__. +- Function effects (the ``nonblocking`` and ``nonallocating`` "performance

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

2024-09-26 Thread Erich Keane via cfe-commits
@@ -3912,6 +3912,11 @@ llvm::Error ASTReader::ReadASTBlock(ModuleFile &F, FPPragmaOptions.swap(Record); break; +case DECLS_WITH_EFFECTS_TO_VERIFY: + for (unsigned I = 0, N = Record.size(); I != N; /*in loop*/) erichkeane wrote: AH, right,

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

2024-09-26 Thread Erich Keane via cfe-commits
@@ -8413,6 +8418,15 @@ void ASTReader::InitializeSema(Sema &S) { NewOverrides.applyOverrides(SemaObj->getLangOpts()); } + for (GlobalDeclID ID : DeclsWithEffectsToVerify) { +Decl *D = GetDecl(ID); +if (auto *FD = dyn_cast(D)) + SemaObj->addDeclWithEffec

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

2024-09-26 Thread Erich Keane via cfe-commits
@@ -4712,12 +4715,13 @@ class FunctionEffect { public: /// Identifies the particular effect. enum class Kind : uint8_t { -None = 0, -NonBlocking = 1, -NonAllocating = 2, -Blocking = 3, -Allocating = 4 +NonBlocking = 0, +NonAllocating = 1, +Bl

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

2024-09-26 Thread Erich Keane via cfe-commits
@@ -3912,6 +3912,11 @@ llvm::Error ASTReader::ReadASTBlock(ModuleFile &F, FPPragmaOptions.swap(Record); break; +case DECLS_WITH_EFFECTS_TO_VERIFY: + for (unsigned I = 0, N = Record.size(); I != N; /*in loop*/) erichkeane wrote: ```suggest

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

2024-09-26 Thread Erich Keane via cfe-commits
@@ -571,6 +571,9 @@ New features if class of allocation and deallocation function mismatches. `Documentation `__. +- Function effects (the ``nonblocking`` and ``nonallocating`` "performance

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

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

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

2024-09-26 Thread Erich Keane via cfe-commits
@@ -0,0 +1,1571 @@ +//=== 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-26 Thread Erich Keane via cfe-commits
@@ -3912,6 +3912,11 @@ llvm::Error ASTReader::ReadASTBlock(ModuleFile &F, FPPragmaOptions.swap(Record); break; +case DECLS_WITH_EFFECTS_TO_VERIFY: + for (unsigned I = 0, N = Record.size(); I != N; /*in loop*/) erichkeane wrote: Also, does

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

2024-09-26 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: First, thank you so much @Sirraide for doing such a thorough review here! I've been buried lately, so knowing you were taking care of this was really appreciated! Second, this patch looks really close! I have a couple of quick/small comments. The Rea

[clang] [clang/AST] Make it possible to use SwiftAttr in type context (PR #108631)

2024-09-26 Thread Erich Keane via cfe-commits
erichkeane wrote: > I think the interesting template cases are like: > > ``` > template struct S { > T foo(); > }; > > S a; > S b; > > void f() { > a.foo(); > b.foo(); > } > ``` > > The question is, whether we actually have the type attributes where we expect > to have them, or do we l

[clang] [Clang] Bugfixes and improved support for `AttributedType`s in lambdas (PR #85325)

2024-09-25 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. I don't see any reason to hold this up, and its waited long enough. So I'm going to consider this 'baked' enough in review. https://github.com/llvm/llvm-project/pull/85325 ___ cfe-commits ma

[clang] Add Clang attribute to ensure that fields are initialized explicitly (PR #102040)

2024-09-25 Thread Erich Keane via cfe-commits
@@ -4561,6 +4569,15 @@ static void TryConstructorInitialization(Sema &S, CXXConstructorDecl *CtorDecl = cast(Best->Function); if (Result != OR_Deleted) { +if (!IsListInit && Kind.getKind() == InitializationKind::IK_Default && +DestRecordDecl != nullptr && DestR

[clang] Add Clang attribute to ensure that fields are initialized explicitly (PR #102040)

2024-09-25 Thread Erich Keane via cfe-commits
@@ -6457,6 +6474,19 @@ void InitializationSequence::InitializeFrom(Sema &S, } } + if (!S.getLangOpts().CPlusPlus && + Kind.getKind() == InitializationKind::IK_Default) { +RecordDecl *Rec = DestType->getAsRecordDecl(); +if (Rec && Rec->hasUninitializedExplic

[clang] Add Clang attribute to ensure that fields are initialized explicitly (PR #102040)

2024-09-25 Thread Erich Keane via cfe-commits
@@ -4561,6 +4569,15 @@ static void TryConstructorInitialization(Sema &S, CXXConstructorDecl *CtorDecl = cast(Best->Function); if (Result != OR_Deleted) { +if (!IsListInit && Kind.getKind() == InitializationKind::IK_Default && +DestRecordDecl != nullptr && DestR

[clang] Add Clang attribute to ensure that fields are initialized explicitly (PR #102040)

2024-09-25 Thread Erich Keane via cfe-commits
@@ -2302,6 +2302,10 @@ def err_init_list_bad_dest_type : Error< def warn_cxx20_compat_aggregate_init_with_ctors : Warning< "aggregate initialization of type %0 with user-declared constructors " "is incompatible with C++20">, DefaultIgnore, InGroup; +def warn_cxx20_compat_re

[clang] Add Clang attribute to ensure that fields are initialized explicitly (PR #102040)

2024-09-25 Thread Erich Keane via cfe-commits
@@ -1682,7 +1690,7 @@ class DeclContext { /// True if a valid hash is stored in ODRHash. This should shave off some /// extra storage and prevent CXXRecordDecl to store unused bits. -uint64_t ODRHash : 26; +uint64_t ODRHash : 25; erichkeane wro

[clang] Add Clang attribute to ensure that fields are initialized explicitly (PR #102040)

2024-09-25 Thread Erich Keane via cfe-commits
@@ -1419,6 +1419,44 @@ is not specified. }]; } +def ExplicitInitDocs : Documentation { + let Category = DocCatField; + let Content = [{ +The ``clang::requires_explicit_initialization`` attribute indicates that the +field of an aggregate must be initialized explicitly by us

[clang] Add Clang attribute to ensure that fields are initialized explicitly (PR #102040)

2024-09-25 Thread Erich Keane via cfe-commits
@@ -3141,6 +3148,10 @@ def warn_attribute_ignored_no_calls_in_stmt: Warning< "statement">, InGroup; +def warn_attribute_needs_aggregate : Warning< erichkeane wrote: This seems like it should be an error here, mis-use of this should be an error IMO. http

[clang] [Clang] prevent recovery call expression from proceeding with explicit attributes and undeclared templates (PR #107786)

2024-09-25 Thread Erich Keane via cfe-commits
@@ -0,0 +1,32 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++20 %s + +namespace GH49093 { + class B { + public: +static int a() { return 0; } // expected-note {{member is declared here}} +decltype(a< 0 >(0)) test;// expected-error {{member 'a' used before its

[clang] Add Clang attribute to ensure that fields are initialized explicitly (PR #102040)

2024-09-24 Thread Erich Keane via cfe-commits
@@ -119,6 +119,15 @@ FIELD(HasInitMethod, 1, NO_MERGE) /// within anonymous unions or structs. FIELD(HasInClassInitializer, 1, NO_MERGE) +/// Custom attribute that is True if any field is marked as requiring explicit +/// initialization with [[clang::requires_explicit_initiali

[clang] [Clang][Sema] Refactor collection of multi-level template argument lists (PR #106585)

2024-09-24 Thread Erich Keane via cfe-commits
erichkeane wrote: I agree I think with your take on temp.expl.spec, we run into this in quite a few places. I'd like to hear from the others, but this is a paragraph I've used in the past to justify a lot of this sort of diagnostics. https://github.com/llvm/llvm-project/pull/106585 __

[clang] [Clang] prevent recovery call expression from proceeding with explicit attributes and undeclared templates (PR #107786)

2024-09-23 Thread Erich Keane via cfe-commits
@@ -0,0 +1,32 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++20 %s + +namespace GH49093 { + class B { + public: +static int a() { return 0; } // expected-note {{member is declared here}} +decltype(a< 0 >(0)) test;// expected-error {{member 'a' used before its

[clang] [Clang] prevent recovery call expression from proceeding with explicit attributes and undeclared templates (PR #107786)

2024-09-23 Thread Erich Keane via cfe-commits
@@ -0,0 +1,32 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++20 %s + +namespace GH49093 { + class B { + public: +static int a() { return 0; } // expected-note {{member is declared here}} +decltype(a< 0 >(0)) test;// expected-error {{member 'a' used before its

[clang] [clang] Ignore inline namespace for `hasName` (PR #109147)

2024-09-23 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: I have no problem with the code here, but don't know enough about ASTMatchers to be able to review this for 'well justified'. Do we have someone besides Aaron who does? Also, it needs a release note I think for the matcher change. https://github.com/ll

[clang] [AST] Avoid repeated hash lookups (NFC) (PR #109603)

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

[clang] [OpenACC] Add 'collapse' clause AST/basic Sema implementation (PR #109461)

2024-09-20 Thread Erich Keane via cfe-commits
https://github.com/erichkeane updated https://github.com/llvm/llvm-project/pull/109461 >From f25688a5f6242e4e16cad377fa281df665d0e38b Mon Sep 17 00:00:00 2001 From: erichkeane Date: Fri, 20 Sep 2024 09:38:32 -0700 Subject: [PATCH 1/3] [OpenACC] Add 'collapse' clause AST/basic Sema implementati

[clang] [OpenACC] Add 'collapse' clause AST/basic Sema implementation (PR #109461)

2024-09-20 Thread Erich Keane via cfe-commits
@@ -1583,6 +1618,33 @@ ExprResult SemaOpenACC::ActOnArraySectionExpr(Expr *Base, SourceLocation LBLoc, OK_Ordinary, ColonLoc, RBLoc); } +ExprResult SemaOpenACC::CheckCollapseLoopCount(Expr *LoopCount) { + if (!LoopCount) +return ExprError(); + + a

[clang] [OpenACC] Add 'collapse' clause AST/basic Sema implementation (PR #109461)

2024-09-20 Thread Erich Keane via cfe-commits
https://github.com/erichkeane updated https://github.com/llvm/llvm-project/pull/109461 >From f25688a5f6242e4e16cad377fa281df665d0e38b Mon Sep 17 00:00:00 2001 From: erichkeane Date: Fri, 20 Sep 2024 09:38:32 -0700 Subject: [PATCH 1/2] [OpenACC] Add 'collapse' clause AST/basic Sema implementati

[clang] [OpenACC] Add 'collapse' clause AST/basic Sema implementation (PR #109461)

2024-09-20 Thread Erich Keane via cfe-commits
https://github.com/erichkeane created https://github.com/llvm/llvm-project/pull/109461 The 'collapse' clause on a 'loop' construct is used to specify how many nested loops are associated with the 'loop' construct. It takes an optional 'force' tag, and an integer constant expression as argumen

[clang] [Clang] prevent recovery call expression from proceeding with explicit attributes and undeclared templates (PR #107786)

2024-09-20 Thread Erich Keane via cfe-commits
@@ -0,0 +1,32 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++20 %s + +namespace GH49093 { + class B { + public: +static int a() { return 0; } // expected-note {{member is declared here}} +decltype(a< 0 >(0)) test;// expected-error {{member 'a' used before its

[clang] [Clang][Sema] Refactor collection of multi-level template argument lists (PR #106585)

2024-09-20 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. 1 comment, otherwise LGTM. https://github.com/llvm/llvm-project/pull/106585 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] Refactor collection of multi-level template argument lists (PR #106585)

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

[clang] [Clang][Sema] Refactor collection of multi-level template argument lists (PR #106585)

2024-09-20 Thread Erich Keane via cfe-commits
@@ -11392,9 +11392,9 @@ class Sema final : public SemaBase { CXXScopeSpec &SS, IdentifierInfo *Name, SourceLocation NameLoc, const ParsedAttributesView &Attr, TemplateParameterList *TemplateParams, AccessSpecifier AS, SourceLocation ModulePrivateLoc, - So

[clang] Reapply "[Clang][Sema] Use the correct lookup context when building overloaded 'operator->' in the current instantiation (#104458)" (PR #109422)

2024-09-20 Thread Erich Keane via cfe-commits
@@ -10639,9 +10639,9 @@ class Sema final : public SemaBase { /// BuildOverloadedArrowExpr - Build a call to an overloaded @c operator-> /// (if one exists), where @c Base is an expression of class type and /// @c Member is the name of the member we're trying to find. -

[clang] Reapply "[Clang][Sema] Use the correct lookup context when building overloaded 'operator->' in the current instantiation (#104458)" (PR #109422)

2024-09-20 Thread Erich Keane via cfe-commits
@@ -8002,15 +7991,26 @@ ExprResult Sema::ActOnStartCXXMemberReference(Scope *S, Expr *Base, return ExprError(); } + bool IsDependent; erichkeane wrote: Please initialize this to false anyway. https://github.com/llvm/llvm-project/pull/1094

[clang] Reapply "[Clang][Sema] Use the correct lookup context when building overloaded 'operator->' in the current instantiation (#104458)" (PR #109422)

2024-09-20 Thread Erich Keane via cfe-commits
@@ -484,16 +484,19 @@ namespace N4 { template struct A { void not_instantiated(A a, A b, T c) { - a->x; - b->x; + a->x; // expected-error {{member reference type 'A' is not a pointer; did you mean to use '.'?}} + b->x; // expected-error {{member ref

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