[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

[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
https://github.com/erichkeane edited https://github.com/llvm/llvm-project/pull/109422 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[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
https://github.com/erichkeane commented: Does this need a release note? Also, can you point out the 'diff' from the previous commit? I'm really not a fan of the 'out' parameter, I'd prefer perhaps returning a `std::pair` + structured binding. WDYT? https://github.com/llvm/llvm-project/pul

[clang] [Clang][Sema] Fix templated array size calculation. (PR #96464)

2024-09-20 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. LGTM, feel free to merge. https://github.com/llvm/llvm-project/pull/96464 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] implement current direction of CWG2765 for string literal comparisons in constant evaluation (PR #109208)

2024-09-19 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. I'm happy once SOME level of solution for the index-starting-value is done (`NextStringLiteralVersion=rand()` 🤡). I think the avoided collisions is worth a touch of effort, but not much more. I think there is some concern from other

[clang] [clang] implement current direction of CWG2765 for string literal comparisons in constant evaluation (PR #109208)

2024-09-19 Thread Erich Keane via cfe-commits
@@ -324,6 +324,13 @@ class ASTContext : public RefCountedBase { /// This is lazily created. This is intentionally not serialized. mutable llvm::StringMap StringLiteralCache; + /// The next string literal "version" to allocate during constant evaluation. + /// This is us

[clang] [clang] implement current direction of CWG2765 for string literal comparisons in constant evaluation (PR #109208)

2024-09-19 Thread Erich Keane via cfe-commits
@@ -2142,11 +2150,81 @@ static const ValueDecl *GetLValueBaseDecl(const LValue &LVal) { return LVal.Base.dyn_cast(); } -static bool IsLiteralLValue(const LValue &Value) { - if (Value.getLValueCallIndex()) +// Information about an LValueBase that is some kind of string. +st

[clang] [clang] implement current direction of CWG2765 for string literal comparisons in constant evaluation (PR #109208)

2024-09-19 Thread Erich Keane via cfe-commits
@@ -74,6 +74,22 @@ C++ Specific Potentially Breaking Changes template void f(); +- During constant evaluation, comparisons between different evaluations of the + same string literal are now correctly treated as non-constant, and comparisons + between string literal

[clang] [clang] implement current direction of CWG2765 for string literal comparisons in constant evaluation (PR #109208)

2024-09-19 Thread Erich Keane via cfe-commits
@@ -2142,11 +2150,81 @@ static const ValueDecl *GetLValueBaseDecl(const LValue &LVal) { return LVal.Base.dyn_cast(); } -static bool IsLiteralLValue(const LValue &Value) { - if (Value.getLValueCallIndex()) +// Information about an LValueBase that is some kind of string. +st

[clang] [clang] implement current direction of CWG2765 for string literal comparisons in constant evaluation (PR #109208)

2024-09-19 Thread Erich Keane via cfe-commits
@@ -2142,11 +2150,81 @@ static const ValueDecl *GetLValueBaseDecl(const LValue &LVal) { return LVal.Base.dyn_cast(); } -static bool IsLiteralLValue(const LValue &Value) { - if (Value.getLValueCallIndex()) +// Information about an LValueBase that is some kind of string. +st

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

2024-09-19 Thread Erich Keane via cfe-commits
@@ -1419,6 +1419,35 @@ is not specified. }]; } +def ExplicitInitDocs : Documentation { erichkeane wrote: This is a little lacking for me? Semantics, limitations, examples of how this is intended to be used, warnings about 'make sure you own the type' sort

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

2024-09-19 Thread Erich Keane via cfe-commits
@@ -81,6 +82,7 @@ CXXRecordDecl::DefinitionData::DefinitionData(CXXRecordDecl *D) HasPrivateFields(false), HasProtectedFields(false), HasPublicFields(false), HasMutableFields(false), HasVariantMembers(false), HasOnlyCMembers(true), HasInitMethod(false), Has

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

2024-09-19 Thread Erich Keane via cfe-commits
@@ -6014,6 +6014,10 @@ static void handleNoMergeAttr(Sema &S, Decl *D, const ParsedAttr &AL) { D->addAttr(NoMergeAttr::Create(S.Context, AL)); } +static void handleExplicitInitAttr(Sema &S, Decl *D, const ParsedAttr &AL) { + D->addAttr(ExplicitInitAttr::Create(S.Context, A

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

2024-09-19 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] Add Clang attribute to ensure that fields are initialized explicitly (PR #102040)

2024-09-19 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: I think this needs to work in C as well, and we should have tests for that too. I see this as more useful in C than C++, and there isn't a good reason to restrict it. Also, needs a release note. https://github.com/llvm/llvm-project/pull/102040 ___

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

2024-09-19 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] [clang] implement current direction of CWG2765 for string literal comparisons in constant evaluation (PR #109208)

2024-09-19 Thread Erich Keane via cfe-commits
@@ -2142,11 +2150,81 @@ static const ValueDecl *GetLValueBaseDecl(const LValue &LVal) { return LVal.Base.dyn_cast(); } -static bool IsLiteralLValue(const LValue &Value) { - if (Value.getLValueCallIndex()) +// Information about an LValueBase that is some kind of string. +st

[clang] [clang] implement current direction of CWG2765 for string literal comparisons in constant evaluation (PR #109208)

2024-09-19 Thread Erich Keane via cfe-commits
@@ -324,6 +324,13 @@ class ASTContext : public RefCountedBase { /// This is lazily created. This is intentionally not serialized. mutable llvm::StringMap StringLiteralCache; + /// The next string literal "version" to allocate during constant evaluation. + /// This is us

[clang] [clang] implement current direction of CWG2765 for string literal comparisons in constant evaluation (PR #109208)

2024-09-19 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: Needs a release note https://github.com/llvm/llvm-project/pull/109208 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] implement current direction of CWG2765 for string literal comparisons in constant evaluation (PR #109208)

2024-09-19 Thread Erich Keane via cfe-commits
@@ -2142,11 +2150,81 @@ static const ValueDecl *GetLValueBaseDecl(const LValue &LVal) { return LVal.Base.dyn_cast(); } -static bool IsLiteralLValue(const LValue &Value) { - if (Value.getLValueCallIndex()) +// Information about an LValueBase that is some kind of string. +st

[clang] [clang] implement current direction of CWG2765 for string literal comparisons in constant evaluation (PR #109208)

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

[clang] Reland "[Utils] add update-verify-tests.py" (#108630)" (PR #108658)

2024-09-18 Thread Erich Keane via cfe-commits
erichkeane wrote: > > > > +1, it's why I stopped recommending this approach in my reviews. While I agree for the most part, there are quite a few diagnostics that are absurdly verbose (particularly ones with "did you mean to FLOOP it?"). I think partial matches are good/fine, but they need

[clang] Reland "[Utils] add update-verify-tests.py" (#108630)" (PR #108658)

2024-09-18 Thread Erich Keane via cfe-commits
erichkeane wrote: >I don't know the solution, but I think there is some inherent flaw when it >comes to how -verify tests operate currently, in that you need to trust that >the author formatted the test to accurately reflect reality. In part why I push for bookmarks, it makes it clear on the o

[clang] [clang-tools-extra] Remove clang-pseudo (PR #109154)

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

[clang] [clang-tools-extra] Remove clang-pseudo (PR #109154)

2024-09-18 Thread Erich Keane via cfe-commits
@@ -43,6 +43,8 @@ infrastructure are described first, followed by tool-specific sections. Major New Features -- +- The ``clang-pseudo`` tool has been removed. erichkeane wrote: A link to the RFC might be nice here, lets folks see the WHY. ht

[clang] [clang-tools-extra] Remove clang-pseudo (PR #109154)

2024-09-18 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. I think the release note should be mroe detailed and give some help as to the WHY here, and not just 'we removed it'. https://github.com/llvm/llvm-project/pull/109154 ___ cfe-commits mailing li

[clang] [C++20] [Modules] Offer -fmodules-embed-all-files option (PR #107194)

2024-09-18 Thread Erich Keane via cfe-commits
@@ -484,6 +511,13 @@ fragment is disabled by default. These checks can be enabled by specifying and you encounter incorrect or missing diagnostics, please report them via the `community issue tracker `_. +Privacy Issue +--

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

2024-09-17 Thread Erich Keane via cfe-commits
@@ -585,8 +585,8 @@ static bool CheckConstraintSatisfaction( ArrayRef TemplateArgs = TemplateArgsLists.getNumSubstitutedLevels() > 0 - ? TemplateArgsLists.getOutermost() - : ArrayRef {}; + ? TemplateArgsLists.getInnermost() e

[clang] [Clang] Avoid transforming lambdas when rebuilding immediate expressions (PR #108693)

2024-09-17 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. I was going to comment on the amount of NFC changes here, but as Corentin already approved, I think we're OK for this for now. LGTM as well. https://github.com/llvm/llvm-project/pull/108693

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

2024-09-17 Thread Erich Keane via cfe-commits
@@ -585,8 +585,8 @@ static bool CheckConstraintSatisfaction( ArrayRef TemplateArgs = TemplateArgsLists.getNumSubstitutedLevels() > 0 - ? TemplateArgsLists.getOutermost() - : ArrayRef {}; + ? TemplateArgsLists.getInnermost() e

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

2024-09-17 Thread Erich Keane via cfe-commits
@@ -585,8 +585,8 @@ static bool CheckConstraintSatisfaction( ArrayRef TemplateArgs = TemplateArgsLists.getNumSubstitutedLevels() > 0 - ? TemplateArgsLists.getOutermost() - : ArrayRef {}; + ? TemplateArgsLists.getInnermost() e

[clang] [llvm] [Utils] Add new --update-tests flag to llvm-lit (PR #108425)

2024-09-17 Thread Erich Keane via cfe-commits
erichkeane wrote: I mentioned on a separate commit here, but as a reviewer/code-owner, I very much dislike the existence of tooling like this. I believe it to be actively harmful to the project. https://github.com/llvm/llvm-project/pull/108425 ___ cf

[clang] Reland "[Utils] add update-verify-tests.py" (#108630)" (PR #108658)

2024-09-17 Thread Erich Keane via cfe-commits
erichkeane wrote: As a CFE reviewer, I very much hate the existence of this script (and the CodeGen equivalents, but that is a separate discussion). This existing means I can no longer trust that a test is a reflection of what the author intended to write, as they might have just run this and

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

2024-09-17 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. Thanks for the ping, I'd forgotten about this one! I'm happy for the most part, I have 1 question and a couple nits. https://github.com/llvm/llvm-project/pull/106585 ___ cfe-commits mailing li

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

2024-09-17 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] [Clang][Sema] Refactor collection of multi-level template argument lists (PR #106585)

2024-09-17 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-17 Thread Erich Keane via cfe-commits
@@ -309,35 +309,35 @@ bool TemplateDecl::isTypeAlias() const { void RedeclarableTemplateDecl::anchor() {} RedeclarableTemplateDecl::CommonBase *RedeclarableTemplateDecl::getCommonPtr() const { - if (Common) -return Common; + if (CommonBase *C = Common.getPointer())

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

2024-09-17 Thread Erich Keane via cfe-commits
@@ -585,8 +585,8 @@ static bool CheckConstraintSatisfaction( ArrayRef TemplateArgs = TemplateArgsLists.getNumSubstitutedLevels() > 0 - ? TemplateArgsLists.getOutermost() - : ArrayRef {}; + ? TemplateArgsLists.getInnermost() e

[clang] [Clang] Mark Clang 19 language changes as being released [NFC] (PR #108978)

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

[clang] [clang] Increase VecLib bitfield size to 4 bits in CodeGenOptions.def (PR #108804)

2024-09-17 Thread Erich Keane via cfe-commits
@@ -375,8 +375,13 @@ ENUM_CODEGENOPT(Inlining, InliningMethod, 2, NormalInlining) /// The maximum stack size a function can have to be considered for inlining. VALUE_CODEGENOPT(InlineMaxStackSize, 32, UINT_MAX) +// Ensure the VecLib bitfield has enough space for future vector

[clang] [clang] Increase VecLib bitfield size to 4 bits in CodeGenOptions.def (PR #108804)

2024-09-17 Thread Erich Keane via cfe-commits
@@ -375,8 +375,13 @@ ENUM_CODEGENOPT(Inlining, InliningMethod, 2, NormalInlining) /// The maximum stack size a function can have to be considered for inlining. VALUE_CODEGENOPT(InlineMaxStackSize, 32, UINT_MAX) +// Ensure the VecLib bitfield has enough space for future vector

[clang] [Clang][Sema] Fix templated array size calculation. (PR #96464)

2024-09-17 Thread Erich Keane via cfe-commits
erichkeane wrote: > > It seems reasonable to me, but I want @cor3ntin to review this, he's the > > one who got his foot stuck in array bounds for a while :D > > However, this patch needs a few changes: > > 1- A better patch title, perhaps improved commit message 2- Release note > > 1. Parti

[clang] [Clang] Do not perform integral promotion if operands of expression `x ? : y` have the same type (PR #108837)

2024-09-16 Thread Erich Keane via cfe-commits
@@ -0,0 +1,19 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s -fexperimental-new-constant-interpreter erichkeane wrote: Should run with BOTH constexpr interpreters. https://github.com/llvm/llvm-

[clang] [Clang] Do not perform integral promotion if operands of expression `x ? : y` have the same type (PR #108837)

2024-09-16 Thread Erich Keane via cfe-commits
@@ -8785,14 +8785,11 @@ ExprResult Sema::ActOnConditionalOp(SourceLocation QuestionLoc, commonExpr = result.get(); } // We usually want to apply unary conversions *before* saving, except -// in the special case of a C++ l-value conditional. -if (!(getLang

[clang] [Clang] Do not perform integral promotion if operands of expression `x ? : y` have the same type (PR #108837)

2024-09-16 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: I too am very concerned about the lack of tests here, there are some disappearing conditions I cannot help but think are there for a good reason, and would like to see some study as to why those where there and when. I'm also concerned about the constex

[clang] [Clang] Do not perform integral promotion if operands of expression `x ? : y` have the same type (PR #108837)

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

[clang] [Parser][BoundsSafety] Print attribute as macro if it's system defined (PR #107619)

2024-09-16 Thread Erich Keane via cfe-commits
@@ -5055,6 +5058,17 @@ void Parser::ParseLexedCAttribute(LateParsedAttribute &LA, bool EnterScope, ParseGNUAttributeArgs(&LA.AttrName, LA.AttrNameLoc, Attrs, nullptr, nullptr, SourceLocation(), ParsedAttr::Form::GNU(), nullptr); + const auto &SM = P

[clang] [clang-tools-extra] Fix OOM in FormatDiagnostic (PR #108187)

2024-09-16 Thread Erich Keane via cfe-commits
erichkeane wrote: @igelbox: That seems to be a problem with this patch! If it is something you cannot fix/get a review up for very quickly so we can accept/get it in, we'll have to revert this. Please let us know ASAP what you'd like to do. https://github.com/llvm/llvm-project/pull/108187 __

[clang] [Parser][BoundsSafety] Print attribute as macro if it's system defined (PR #107619)

2024-09-16 Thread Erich Keane via cfe-commits
@@ -493,9 +500,11 @@ class ParsedAttr final /// Set the macro identifier info object that this parsed attribute was /// declared in if it was declared in a macro. Also set the expansion location /// of the macro. - void setMacroIdentifier(IdentifierInfo *MacroName, Sour

[clang] [Parser][BoundsSafety] Print attribute as macro if it's system defined (PR #107619)

2024-09-16 Thread Erich Keane via cfe-commits
@@ -1105,16 +1120,16 @@ enum AttributeDeclKind { inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB, const ParsedAttr &At) { - DB.AddTaggedVal(reinterpret_cast(At.getAttrName()), + const IdentifierInfo *Att

[clang] [Parser][BoundsSafety] Print attribute as macro if it's system defined (PR #107619)

2024-09-16 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: I apparently forgot to commit some comments here! https://github.com/llvm/llvm-project/pull/107619 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-co

[clang] [Parser][BoundsSafety] Print attribute as macro if it's system defined (PR #107619)

2024-09-16 Thread Erich Keane via cfe-commits
@@ -5055,6 +5058,17 @@ void Parser::ParseLexedCAttribute(LateParsedAttribute &LA, bool EnterScope, ParseGNUAttributeArgs(&LA.AttrName, LA.AttrNameLoc, Attrs, nullptr, nullptr, SourceLocation(), ParsedAttr::Form::GNU(), nullptr); + const auto &SM = P

[clang] [Parser][BoundsSafety] Print attribute as macro if it's system defined (PR #107619)

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

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

2024-09-16 Thread Erich Keane via cfe-commits
@@ -6037,13 +6038,24 @@ class AttributedType : public Type, public llvm::FoldingSetNode { private: friend class ASTContext; // ASTContext creates these + const Attr *Attribute; + QualType ModifiedType; QualType EquivalentType; AttributedType(QualType canon, attr

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

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

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

2024-09-16 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: So I think this patch is doing too much, I'd like to see the changes to `AttributedType` split into a separate patch so we can talk about the `swift_attr` alone. As far as moving this attribute to be a Type Attribute, that comes with a ton of concerns

[clang] Try to fix llvm/llvm-project#41441 (PR #96464)

2024-09-16 Thread Erich Keane via cfe-commits
erichkeane wrote: It seems reasonable to me, but I want @cor3ntin to review this, he's the one who got his foot stuck in array bounds for a while :D However, this patch needs a few changes: 1- A better patch title, perhaps improved commit message 2- Release note https://github.com/llvm/llvm

[clang] [clang] Remove an incorrect assertion in ConstantFoldAttrs (PR #105789)

2024-09-16 Thread Erich Keane via cfe-commits
erichkeane wrote: > > CC @AaronBallman for an opinion about the AST represenation > > This is a bit awkward in that it's only used for the `annotate` attributes' > argument lists, which should pass all of their arguments down to LLVM IR. > However, we don't typically generate LLVM IR for disca

  1   2   3   4   5   6   7   8   9   10   >