[clang] [CIR] Streamline creation of mlir::IntegerAttrs using mlir::Builder (PR #141830)

2025-05-28 Thread Erich Keane via cfe-commits
@@ -428,13 +422,28 @@ class CIRBaseBuilderTy : public mlir::OpBuilder { return OpBuilder::InsertPoint(block, block->begin()); }; - mlir::IntegerAttr getSizeFromCharUnits(mlir::MLIRContext *ctx, - clang::CharUnits size) { -// N

[clang] [CIR] Streamline creation of mlir::IntegerAttrs using mlir::Builder (PR #141830)

2025-05-28 Thread Erich Keane via cfe-commits
@@ -428,13 +422,28 @@ class CIRBaseBuilderTy : public mlir::OpBuilder { return OpBuilder::InsertPoint(block, block->begin()); }; - mlir::IntegerAttr getSizeFromCharUnits(mlir::MLIRContext *ctx, - clang::CharUnits size) { -// N

[clang] [CIR] Streamline creation of mlir::IntegerAttrs using mlir::Builder (PR #141830)

2025-05-28 Thread Erich Keane via cfe-commits
@@ -428,13 +422,28 @@ class CIRBaseBuilderTy : public mlir::OpBuilder { return OpBuilder::InsertPoint(block, block->begin()); }; - mlir::IntegerAttr getSizeFromCharUnits(mlir::MLIRContext *ctx, - clang::CharUnits size) { -// N

[clang] [CIR] Streamline creation of mlir::IntegerAttrs using mlir::Builder (PR #141830)

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

[clang] [CIR] Streamline creation of mlir::IntegerAttrs using mlir::Builder (PR #141830)

2025-05-28 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. what amounts to 2 nits. https://github.com/llvm/llvm-project/pull/141830 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Update testds for global vars (PR #141854)

2025-05-28 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. Typo in the title (s/testds/tests/), else lgtm. https://github.com/llvm/llvm-project/pull/141854 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/li

[clang] [Clang] add fix-it hints for unknown attributes (PR #141305)

2025-05-28 Thread Erich Keane via cfe-commits
@@ -7867,15 +7865,16 @@ void Sema::checkUnusedDeclAttributes(Declarator &D) { void Sema::DiagnoseUnknownAttribute(const ParsedAttr &AL) { std::string NormalizedFullName = '\'' + AL.getNormalizedFullName() + '\''; + SourceRange NR = AL.getNormalizedRange();

[clang] [Clang] add fix-it hints for unknown attributes (PR #141305)

2025-05-28 Thread Erich Keane via cfe-commits
@@ -7867,15 +7865,16 @@ void Sema::checkUnusedDeclAttributes(Declarator &D) { void Sema::DiagnoseUnknownAttribute(const ParsedAttr &AL) { std::string NormalizedFullName = '\'' + AL.getNormalizedFullName() + '\''; + SourceRange NR = AL.getNormalizedRange();

[clang] Include [[clang::require_explicit_initialization]] warnings in system headers (PR #141133)

2025-05-28 Thread Erich Keane via cfe-commits
erichkeane wrote: > @erichkeane the question of whether `S s{}; s.f = ...;` should be deemed as a > relaxation of `S s{.f = ...};` came up during the initial RFC. From memory, > the conclusion was that it's something we could relax in a v2 of the RFC, but > it is a _significant_ amount of work

[clang] [C23] Handle type compatibility of unnamed records (PR #141783)

2025-05-28 Thread Erich Keane via cfe-commits
@@ -359,3 +359,35 @@ struct alignment { // c17-error {{redefinition of 'alignment'}} \ c23-error {{type 'struct alignment' has a member with an attribute which currently causes the types to be treated as though they are incompatible}} int x; }; + +//

[clang] [C23] Handle type compatibility of unnamed records (PR #141783)

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

[clang] [C23] Handle type compatibility of unnamed records (PR #141783)

2025-05-28 Thread Erich Keane via cfe-commits
@@ -1751,9 +1751,20 @@ static bool IsStructurallyEquivalent(StructuralEquivalenceContext &Context, // fulfill the preceding requirements. ... Otherwise, the structure, union, // or enumerated types are incompatible. - if (!NameIsStructurallyEquivalent(*D1, *D2)) { + //

[clang] [clang][Sema] Diagnose exceptions only in non-dependent context in discarded `try/catch/throw` blocks (PR #139859)

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

[clang] [clang][Sema] Diagnose exceptions only in non-dependent context in discarded `try/catch/throw` blocks (PR #139859)

2025-05-28 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. LGTM! I'll merge this for you, as I believe you dont' have commit rights. https://github.com/llvm/llvm-project/pull/139859 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.

[clang] [Clang] Reset ArgPackSubstIndex before rewriting CTAD template parameters (PR #141741)

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

[clang] [Clang] Reset ArgPackSubstIndex before rewriting CTAD template parameters (PR #141741)

2025-05-28 Thread Erich Keane via cfe-commits
@@ -1099,6 +1099,10 @@ BuildDeductionGuideForTypeAlias(Sema &SemaRef, // parameters, used for building `TemplateArgsForBuildingFPrime`. SmallVector TransformedDeducedAliasArgs( AliasTemplate->getTemplateParameters()->size()); + // We might be already within a pack ex

[clang] [Clang] Optimize some `getBeginLoc` implementations (PR #141058)

2025-05-28 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. 1 request for a static-assert, else LGTM. https://github.com/llvm/llvm-project/pull/141058 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo

[clang] [Clang] Optimize some `getBeginLoc` implementations (PR #141058)

2025-05-28 Thread Erich Keane via cfe-commits
@@ -2901,34 +2907,44 @@ class CallExpr : public Expr { // // * An optional of type FPOptionsOverride. // - // Note that we store the offset in bytes from the this pointer to the start - // of the trailing objects. It would be perfectly possible to compute it - // based

[clang] [Clang] Optimize some `getBeginLoc` implementations (PR #141058)

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

[clang] [Clang] Reapply CWG2369 "Ordering between constraints and substitution" (PR #122423)

2025-05-28 Thread Erich Keane via cfe-commits
@@ -522,6 +522,12 @@ enum class TemplateSubstitutionKind : char { llvm::PointerUnion * findInstantiationOf(const Decl *D); +/// Similar to \p findInstantiationOf(), but it wouldn't assert if the +/// instantiation was not found within the current instantiation

[clang] [C] Fix parsing of [[clang::assume]] (PR #141747)

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

[clang] [CIR] Defer declarations and tentative definitions (PR #141700)

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

[clang] [Clang] add fix-it hints for unknown attributes (PR #141305)

2025-05-28 Thread Erich Keane via cfe-commits
@@ -672,12 +672,13 @@ static Attr *ProcessStmtAttribute(Sema &S, Stmt *St, const ParsedAttr &A, !(A.existsInTarget(S.Context.getTargetInfo()) || (S.Context.getLangOpts().SYCLIsDevice && Aux && A.existsInTarget(*Aux { -S.Diag(A.getLoc(), A.isRegul

[clang] [Clang] add fix-it hints for unknown attributes (PR #141305)

2025-05-28 Thread Erich Keane via cfe-commits
@@ -7867,15 +7865,16 @@ void Sema::checkUnusedDeclAttributes(Declarator &D) { void Sema::DiagnoseUnknownAttribute(const ParsedAttr &AL) { std::string NormalizedFullName = '\'' + AL.getNormalizedFullName() + '\''; + SourceRange NR = AL.getNormalizedRange();

[clang] [Clang] add fix-it hints for unknown attributes (PR #141305)

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

[clang] [Clang] add fix-it hints for unknown attributes (PR #141305)

2025-05-28 Thread Erich Keane via cfe-commits
@@ -1842,8 +1842,7 @@ void Parser::ProhibitCXX11Attributes(ParsedAttributes &Attrs, continue; if (AL.getKind() == ParsedAttr::UnknownAttribute) { if (WarnOnUnknownAttrs) -Diag(AL.getLoc(), diag::warn_unknown_attribute_ignored) -<< AL << AL.g

[clang] [Clang] add fix-it hints for unknown attributes (PR #141305)

2025-05-28 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: I'm really in favor of this direction, this is great, thank you! I have a few suggestions here (and if there is good reason, feel free to ignore the ones re return-type & setting invalid in particular), but this is pretty good for me. https://github.co

[clang] [SystemZ][z/OS] Implement #pragma export (PR #141671)

2025-05-27 Thread Erich Keane via cfe-commits
@@ -1395,6 +1411,171 @@ bool Parser::HandlePragmaMSAllocText(StringRef PragmaName, return true; } +NestedNameSpecifier * +Parser::zOSParseIdentifier(StringRef PragmaName, + const IdentifierInfo *IdentName) { + NestedNameSpecifier *NestedId = nullp

[clang] [SystemZ][z/OS] Implement #pragma export (PR #141671)

2025-05-27 Thread Erich Keane via cfe-commits
@@ -1395,6 +1411,171 @@ bool Parser::HandlePragmaMSAllocText(StringRef PragmaName, return true; } +NestedNameSpecifier * +Parser::zOSParseIdentifier(StringRef PragmaName, + const IdentifierInfo *IdentName) { + NestedNameSpecifier *NestedId = nullp

[clang] [SystemZ][z/OS] Implement #pragma export (PR #141671)

2025-05-27 Thread Erich Keane via cfe-commits
@@ -568,6 +574,11 @@ void Parser::initializePragmaHandlers() { MaxTokensTotalPragmaHandler = std::make_unique(); PP.AddPragmaHandler("clang", MaxTokensTotalPragmaHandler.get()); + if (getLangOpts().ZOSExt) { erichkeane wrote: This isn't particularly ZOS

[clang] [SystemZ][z/OS] Implement #pragma export (PR #141671)

2025-05-27 Thread Erich Keane via cfe-commits
@@ -1395,6 +1411,171 @@ bool Parser::HandlePragmaMSAllocText(StringRef PragmaName, return true; } +NestedNameSpecifier * +Parser::zOSParseIdentifier(StringRef PragmaName, + const IdentifierInfo *IdentName) { + NestedNameSpecifier *NestedId = nullp

[clang] [SystemZ][z/OS] Implement #pragma export (PR #141671)

2025-05-27 Thread Erich Keane via cfe-commits
@@ -1395,6 +1411,171 @@ bool Parser::HandlePragmaMSAllocText(StringRef PragmaName, return true; } +NestedNameSpecifier * +Parser::zOSParseIdentifier(StringRef PragmaName, + const IdentifierInfo *IdentName) { + NestedNameSpecifier *NestedId = nullp

[clang] [SystemZ][z/OS] Implement #pragma export (PR #141671)

2025-05-27 Thread Erich Keane via cfe-commits
@@ -2278,6 +2278,39 @@ class Sema final : public SemaBase { ActOnPragmaMSFunction(SourceLocation Loc, const llvm::SmallVectorImpl &NoBuiltins); + /// A label from a C++ #pragma export, for a symbol that we + /// haven't seen the declaration for yet.

[clang] [SystemZ][z/OS] Implement #pragma export (PR #141671)

2025-05-27 Thread Erich Keane via cfe-commits
@@ -918,6 +918,11 @@ WebAssembly Support AVR Support ^^^ +SystemZ Support +^^^ + +- Add support for `#pragma export` for z/OS erichkeane wrote: We definitely need a much better intro/documentation here in the release notes. https://github

[clang] [SystemZ][z/OS] Implement #pragma export (PR #141671)

2025-05-27 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: I only made it through the first bit of hte implementation, but parsing doesn't seem right to me, it doesn't recovery nicely as far as I can tell. AS far as the design here, it isn't clear to me how this manages all of the C++ lookup/scoping/etc, and I

[clang] [SystemZ][z/OS] Implement #pragma export (PR #141671)

2025-05-27 Thread Erich Keane via cfe-commits
@@ -1395,6 +1411,171 @@ bool Parser::HandlePragmaMSAllocText(StringRef PragmaName, return true; } +NestedNameSpecifier * +Parser::zOSParseIdentifier(StringRef PragmaName, + const IdentifierInfo *IdentName) { + NestedNameSpecifier *NestedId = nullp

[clang] [SystemZ][z/OS] Implement #pragma export (PR #141671)

2025-05-27 Thread Erich Keane via cfe-commits
@@ -1395,6 +1411,171 @@ bool Parser::HandlePragmaMSAllocText(StringRef PragmaName, return true; } +NestedNameSpecifier * +Parser::zOSParseIdentifier(StringRef PragmaName, + const IdentifierInfo *IdentName) { + NestedNameSpecifier *NestedId = nullp

[clang] [SystemZ][z/OS] Implement #pragma export (PR #141671)

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

[clang] Include [[clang::require_explicit_initialization]] warnings in system headers (PR #141133)

2025-05-27 Thread Erich Keane via cfe-commits
erichkeane wrote: I think the unevaluated contexts DOES help a bunch, though I'm still concerned about the ability of the library to create 'temproary' objects/etc via some sort of default construction/aggregate construction, to then fill in the rest. https://github.com/llvm/llvm-project/pul

[clang] Include [[clang::require_explicit_initialization]] warnings in system headers (PR #141133)

2025-05-27 Thread Erich Keane via cfe-commits
erichkeane wrote: > > I don't think this is a good idea, warning on EVERY use of this is > > incorrect in system headers. IT is going to result in a ton of > > we-want-to-be-suppressed-positives > > Thanks @erichkeane. I think I fundamentally disagree with this. The entire > intention of this

[clang] Include [[clang::require_explicit_initialization]] warnings in system headers (PR #141133)

2025-05-27 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: I don't think this is a good idea, warning on EVERY use of this is incorrect in system headers. IT is going to result in a ton of we-want-to-be-suppressed-positives I also don't think we can have a heuristic that wouldn't have an absurd amount of fals

[clang] [C2y] Fix _Countof handling of VLAs (PR #141621)

2025-05-27 Thread Erich Keane via cfe-commits
@@ -3574,20 +3574,26 @@ ScalarExprEmitter::VisitUnaryExprOrTypeTraitExpr( CGF.EmitIgnoredExpr(E->getArgumentExpr()); } -auto VlaSize = CGF.getVLASize(VAT); -llvm::Value *size = VlaSize.NumElts; - // For sizeof and __datasizeof, we nee

[clang] [C2y] Fix _Countof handling of VLAs (PR #141621)

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

[clang] [clang][Sema] Diagnose exceptions only in non-dependent context in discarded `try/catch/throw` blocks (PR #139859)

2025-05-27 Thread Erich Keane via cfe-commits
@@ -9162,6 +9162,8 @@ StmtResult TreeTransform::TransformCXXTryStmt(CXXTryStmt *S) { Handlers.push_back(Handler.getAs()); } + getSema().DiagnoseExceptionUse(S->getTryLoc(), /* IsTry */ true); erichkeane wrote: ```suggestion getSema().DiagnoseExcepti

[clang] [clang][Sema] Diagnose exceptions only in non-dependent context in discarded `try/catch/throw` blocks (PR #139859)

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

[clang] [clang][Sema] Diagnose exceptions only in non-dependent context in discarded `try/catch/throw` blocks (PR #139859)

2025-05-27 Thread Erich Keane via cfe-commits
@@ -853,10 +853,9 @@ ExprResult Sema::BuildCXXThrow(SourceLocation OpLoc, Expr *Ex, getLangOpts().OpenMPIsTargetDevice && (T.isNVPTX() || T.isAMDGCN()); // Don't report an error if 'throw' is used in system headers or in an OpenMP // target region compiled for a GPU

[clang] [clang][Sema] Diagnose exceptions only in non-dependent context in discarded `try/catch/throw` blocks (PR #139859)

2025-05-27 Thread Erich Keane via cfe-commits
@@ -4410,6 +4409,21 @@ StmtResult Sema::ActOnCXXTryBlock(SourceLocation TryLoc, Stmt *TryBlock, Handlers); } +void Sema::DiagnoseExceptionUse(SourceLocation Loc, bool IsTry) { + const llvm::Triple &T = Context.getTargetInfo().getTriple(); + const

[clang] [clang][Sema] Diagnose exceptions only in non-dependent context in discarded `try/catch/throw` blocks (PR #139859)

2025-05-27 Thread Erich Keane via cfe-commits
@@ -4410,6 +4409,21 @@ StmtResult Sema::ActOnCXXTryBlock(SourceLocation TryLoc, Stmt *TryBlock, Handlers); } +void Sema::DiagnoseExceptionUse(SourceLocation Loc, bool IsTry) { + const llvm::Triple &T = Context.getTargetInfo().getTriple(); + const

[clang] [clang][Sema] Diagnose exceptions only in non-dependent context in discarded `try/catch/throw` blocks (PR #139859)

2025-05-27 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: Mostly happy, handful of changes but none are design changes. https://github.com/llvm/llvm-project/pull/139859 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listi

[clang] [clang][Sema] Diagnose exceptions only in non-dependent context in discarded `try/catch/throw` blocks (PR #139859)

2025-05-27 Thread Erich Keane via cfe-commits
@@ -14384,6 +14386,8 @@ TreeTransform::TransformCXXThrowExpr(CXXThrowExpr *E) { if (SubExpr.isInvalid()) return ExprError(); + getSema().DiagnoseExceptionUse(E->getThrowLoc(), /* IsTry */ false); erichkeane wrote: ```suggestion getSema().DiagnoseExc

[clang] [clang][Sema] Diagnose exceptions only in non-dependent context in discarded `try/catch/throw` blocks (PR #139859)

2025-05-27 Thread Erich Keane via cfe-commits
@@ -4304,10 +4304,9 @@ StmtResult Sema::ActOnCXXTryBlock(SourceLocation TryLoc, Stmt *TryBlock, getLangOpts().OpenMPIsTargetDevice && (T.isNVPTX() || T.isAMDGCN()); // Don't report an error if 'try' is used in system headers or in an OpenMP // target region compiled

[clang] [Clang] Fix a regression introduced by #138518 (PR #141342)

2025-05-27 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/141342 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Fix a regression introduced by #138518 (PR #141342)

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

[clang] [Clang] Fix a regression introduced by #138518 (PR #141342)

2025-05-27 Thread Erich Keane via cfe-commits
@@ -13783,9 +13783,11 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init, bool DirectInit) { VDecl->getLocation(), DirectInit, Init); MultiExprArg Args = Init; -if (CXXDirectInit) - Args = MultiExprArg(CXXDirectInit->getExprs(), -

[clang] [C2y] Correctly handle incomplete types in generic selections (PR #141596)

2025-05-27 Thread Erich Keane via cfe-commits
@@ -1874,9 +1874,11 @@ ExprResult Sema::CreateGenericSelectionExpr( if (D != 0) { Diag(Types[i]->getTypeLoc().getBeginLoc(), D) -<< Types[i]->getTypeLoc().getSourceRange() -<< Types[i]->getType(); - TypeErrorFound = true; +

[clang] [libcxx] [Clang] Add __builtin_common_reference (PR #121199)

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

[clang] [Clang] Reapply CWG2369 "Ordering between constraints and substitution" (PR #122423)

2025-05-27 Thread Erich Keane via cfe-commits
@@ -522,6 +522,12 @@ enum class TemplateSubstitutionKind : char { llvm::PointerUnion * findInstantiationOf(const Decl *D); +/// Similar to \p findInstantiationOf(), but it wouldn't assert if the +/// instantiation was not found within the current instantiation

[clang] [Clang] Reapply CWG2369 "Ordering between constraints and substitution" (PR #122423)

2025-05-27 Thread Erich Keane via cfe-commits
@@ -8054,8 +8056,9 @@ bool Sema::CheckNonDependentConversions( bool HasThisConversion = Method && !isa(Method); unsigned ThisConversions = HasThisConversion ? 1 : 0; - Conversions = - CandidateSet.allocateConversionSequences(ThisConversions + Args.size()); + Convers

[clang] [C2y] Correctly handle incomplete types in generic selections (PR #141596)

2025-05-27 Thread Erich Keane via cfe-commits
@@ -1874,9 +1874,11 @@ ExprResult Sema::CreateGenericSelectionExpr( if (D != 0) { Diag(Types[i]->getTypeLoc().getBeginLoc(), D) -<< Types[i]->getTypeLoc().getSourceRange() -<< Types[i]->getType(); - TypeErrorFound = true; +

[clang] [libcxx] [Clang] Add __builtin_common_reference (PR #121199)

2025-05-27 Thread Erich Keane via cfe-commits
@@ -3231,6 +3241,230 @@ static QualType builtinCommonTypeImpl(Sema &S, TemplateName BaseTemplate, } } +static QualType CopyCV(QualType From, QualType To) { + if (From.isConstQualified()) +To.addConst(); + if (From.isVolatileQualified()) +To.addVolatile(); + retur

[clang] [libcxx] [Clang] Add __builtin_common_reference (PR #121199)

2025-05-27 Thread Erich Keane via cfe-commits
@@ -50,3 +50,29 @@ def __builtin_common_type : BuiltinTemplate< Template<[Class<"TypeMember">], "HasTypeMember">, Class<"HasNoTypeMember">, Class<"Ts", /*is_variadic=*/1>]>; + +// template class," +// template class> class BasicCommonReferenceT,"

[clang] [libcxx] [Clang] Add __builtin_common_reference (PR #121199)

2025-05-27 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. This seems reasonable to me? I'm not a huge fan of how much is being put into `SemaTemplate.cpp` to support all the builtins though. I'm wondering if we need to split that up in a follow-up and have a `SemaTemplateBuiltins` for all of

[clang] [C2y] Correctly handle incomplete types in generic selections (PR #141596)

2025-05-27 Thread Erich Keane via cfe-commits
@@ -1874,9 +1874,11 @@ ExprResult Sema::CreateGenericSelectionExpr( if (D != 0) { Diag(Types[i]->getTypeLoc().getBeginLoc(), D) -<< Types[i]->getTypeLoc().getSourceRange() -<< Types[i]->getType(); - TypeErrorFound = true; +

[clang] [C2y] Correctly handle incomplete types in generic selections (PR #141596)

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

[clang] [Clang] Explain why a type trait evaluated to false. (PR #141238)

2025-05-23 Thread Erich Keane via cfe-commits
@@ -1917,3 +1917,190 @@ ExprResult Sema::BuildExpressionTrait(ExpressionTrait ET, SourceLocation KWLoc, return new (Context) ExpressionTraitExpr(KWLoc, ET, Queried, Value, RParen, Context.BoolTy); } + +static std::optional StdNameToTypeTrait(StringRef Name) { + return

[clang] [Clang] Explain why a type trait evaluated to false. (PR #141238)

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

[clang] [Clang] Explain why a type trait evaluated to false. (PR #141238)

2025-05-23 Thread Erich Keane via cfe-commits
@@ -1917,3 +1917,190 @@ ExprResult Sema::BuildExpressionTrait(ExpressionTrait ET, SourceLocation KWLoc, return new (Context) ExpressionTraitExpr(KWLoc, ET, Queried, Value, RParen, Context.BoolTy); } + +static std::optional StdNameToTypeTrait(StringRef Name) { + return

[clang] [Clang] Explain why a type trait evaluated to false. (PR #141238)

2025-05-23 Thread Erich Keane via cfe-commits
@@ -1917,3 +1917,190 @@ ExprResult Sema::BuildExpressionTrait(ExpressionTrait ET, SourceLocation KWLoc, return new (Context) ExpressionTraitExpr(KWLoc, ET, Queried, Value, RParen, Context.BoolTy); } + +static std::optional StdNameToTypeTrait(StringRef Name) { + return

[clang] [Clang][NFC] Move the type trait logic to a separate file. (PR #141245)

2025-05-23 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. Just a copy&paste refactor that makes a lot of sense. Thanks! https://github.com/llvm/llvm-project/pull/141245 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi

[clang] [Clang] Explain why a type trait evaluated to false. (PR #141238)

2025-05-23 Thread Erich Keane via cfe-commits
@@ -0,0 +1,539 @@ +//===- SemaTypeTraits.cpp - Semantic Analysis for C++ Type Traits -===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Ap

[clang] [Clang] Explain why a type trait evaluated to false. (PR #141238)

2025-05-23 Thread Erich Keane via cfe-commits
@@ -5590,69 +5590,8 @@ static bool isTriviallyEqualityComparableType(Sema &S, QualType Type, SourceLoca CanonicalType, /*CheckIfTriviallyCopyable=*/false); } -static bool IsCXXTriviallyRelocatableType(Sema &S, const CXXRecordDecl *RD) { - if (std::optional Info = -

[clang] [Clang] Explain why a type trait evaluated to false. (PR #141238)

2025-05-23 Thread Erich Keane via cfe-commits
@@ -0,0 +1,539 @@ +//===- SemaTypeTraits.cpp - Semantic Analysis for C++ Type Traits -===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Ap

[clang] [Clang] Explain why a type trait evaluated to false. (PR #141238)

2025-05-23 Thread Erich Keane via cfe-commits
@@ -1762,6 +1762,29 @@ def err_user_defined_msg_constexpr : Error< "%sub{subst_user_defined_msg}0 must be produced by a " "constant expression">; +// Type traits explanations +def note_unsatisfied_trait : Note<"%0 is not %enum_select{" + "%

[clang] [OpenACC][CIR] Add lowering for 'copy' array indexes (PR #140971)

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

[clang] [OpenACC][CIR] Add lowering for 'copy' array indexes (PR #140971)

2025-05-23 Thread Erich Keane via cfe-commits
https://github.com/erichkeane updated https://github.com/llvm/llvm-project/pull/140971 >From ec6359330368ed72d6e4354afdcf6d0a32f9a2f9 Mon Sep 17 00:00:00 2001 From: erichkeane Date: Tue, 20 May 2025 08:55:39 -0700 Subject: [PATCH 1/2] [OpenACC][CIR] Add lowering for 'copy' array indexes The ar

[clang] [CIR] Add alignment support for global, store, and load ops (PR #141163)

2025-05-23 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. Seems reasonable https://github.com/llvm/llvm-project/pull/141163 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Optimize some `getBeginLoc` implementations (PR #141058)

2025-05-22 Thread Erich Keane via cfe-commits
@@ -3028,6 +3043,19 @@ class CallExpr : public Expr { bool hasStoredFPFeatures() const { return CallExprBits.HasFPFeatures; } + bool usesMemberSyntax() const { +return CallExprBits.ExplicitObjectMemFunUsingMemberSyntax; + } + void setUsesMemberSyntax(bool V = true) {

[clang] [Clang] Optimize some `getBeginLoc` implementations (PR #141058)

2025-05-22 Thread Erich Keane via cfe-commits
@@ -3187,9 +3215,48 @@ class CallExpr : public Expr { SourceLocation getRParenLoc() const { return RParenLoc; } void setRParenLoc(SourceLocation L) { RParenLoc = L; } - SourceLocation getBeginLoc() const LLVM_READONLY; - SourceLocation getEndLoc() const LLVM_READONLY; +

[clang] [Clang] Optimize some `getBeginLoc` implementations (PR #141058)

2025-05-22 Thread Erich Keane via cfe-commits
@@ -1510,41 +1519,41 @@ CallExpr *CallExpr::Create(const ASTContext &Ctx, Expr *Fn, unsigned NumArgs = std::max(Args.size(), MinNumArgs); unsigned SizeOfTrailingObjects = CallExpr::sizeOfTrailingObjects( /*NumPreArgs=*/0, NumArgs, FPFeatures.requiresTrailingStorage()

[clang] [Clang] Optimize some `getBeginLoc` implementations (PR #141058)

2025-05-22 Thread Erich Keane via cfe-commits
@@ -1510,41 +1519,41 @@ CallExpr *CallExpr::Create(const ASTContext &Ctx, Expr *Fn, unsigned NumArgs = std::max(Args.size(), MinNumArgs); unsigned SizeOfTrailingObjects = CallExpr::sizeOfTrailingObjects( /*NumPreArgs=*/0, NumArgs, FPFeatures.requiresTrailingStorage()

[clang] [Clang] Optimize some `getBeginLoc` implementations (PR #141058)

2025-05-22 Thread Erich Keane via cfe-commits
@@ -3028,6 +3043,19 @@ class CallExpr : public Expr { bool hasStoredFPFeatures() const { return CallExprBits.HasFPFeatures; } + bool usesMemberSyntax() const { +return CallExprBits.ExplicitObjectMemFunUsingMemberSyntax; + } + void setUsesMemberSyntax(bool V = true) {

[clang] [Clang] Optimize some `getBeginLoc` implementations (PR #141058)

2025-05-22 Thread Erich Keane via cfe-commits
@@ -3187,9 +3215,48 @@ class CallExpr : public Expr { SourceLocation getRParenLoc() const { return RParenLoc; } void setRParenLoc(SourceLocation L) { RParenLoc = L; } - SourceLocation getBeginLoc() const LLVM_READONLY; - SourceLocation getEndLoc() const LLVM_READONLY; +

[clang] [CIR] Simplify error emission to return failures directly (PR #141032)

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

[clang] [CIR] Implement `AnyScalarType` constraint (PR #141033)

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

[clang] [OpenACC][CIR] Add lowering for 'copy' array indexes (PR #140971)

2025-05-21 Thread Erich Keane via cfe-commits
https://github.com/erichkeane created https://github.com/llvm/llvm-project/pull/140971 The array indexes(and sections) are represented by the acc.bounds operation, which this ensures we fill in properly. The lowerbound is required, so we always get that. The upperbound or extent is required.

[clang] [C] Fix crash-on-invalid due to infinite recursion (PR #140925)

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

[clang] [clang][TableGen] Fix Duplicate Entries in TableGen (PR #140828)

2025-05-21 Thread Erich Keane via cfe-commits
@@ -3727,12 +3734,26 @@ static void GenerateHasAttrSpellingStringSwitch( } } -std::string TestStr = !Test.empty() - ? Test + " ? " + itostr(Version) + " : 0" - : itostr(Version); -if (Scope.empty() ||

[clang] [clang][TableGen] Fix Duplicate Entries in TableGen (PR #140828)

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

[clang] [C2y] Add stdcountof.h (PR #140890)

2025-05-21 Thread Erich Keane via cfe-commits
@@ -260,6 +260,7 @@ static bool isBuiltinHeaderName(StringRef FileName) { .Case("stdarg.h", true) .Case("stdatomic.h", true) .Case("stdbool.h", true) + .Case("stdcountof.h", true) erichkeane wrote: These too! https:/

[clang] [C2y] Add stdcountof.h (PR #140890)

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

[clang] [C2y] Add stdcountof.h (PR #140890)

2025-05-21 Thread Erich Keane via cfe-commits
@@ -252,8 +252,8 @@ static bool warnByDefaultOnWrongCase(StringRef Include) { .Cases("assert.h", "complex.h", "ctype.h", "errno.h", "fenv.h", true) erichkeane wrote: The fact that these aren't tablegened somewhere is frightening! https://github.com/llvm/llv

[clang] [C2y] Add stdcountof.h (PR #140890)

2025-05-21 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. I still have no problem with this, but it is now into things I have zero confidence reviewing :) Please have someone who has ever used modules review this. https://github.com/llvm/llvm-project/pull/140890 __

[clang] [Clang] add typo correction for unknown attribute names (PR #140629)

2025-05-21 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. Thought I'd already +1ed! with teh copyright headers, this LGTM. https://github.com/llvm/llvm-project/pull/140629 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/

[clang] [C2y] Add stdcountof.h (PR #140890)

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

[clang] [CIR] Add support for recursive record layouts (PR #140811)

2025-05-20 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. Want someone else to poke at it, but nothing from my end. https://github.com/llvm/llvm-project/pull/140811 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/

[clang] [CIR] Upstream support for string literals (PR #140796)

2025-05-20 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: still ok, 1 nit. https://github.com/llvm/llvm-project/pull/140796 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream support for string literals (PR #140796)

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

[clang] [CIR] Upstream support for string literals (PR #140796)

2025-05-20 Thread Erich Keane via cfe-commits
@@ -26,6 +26,34 @@ class CIRGenBuilderTy : public cir::CIRBaseBuilderTy { CIRGenBuilderTy(mlir::MLIRContext &mlirContext, const CIRGenTypeCache &tc) : CIRBaseBuilderTy(mlirContext), typeCache(tc) {} + /// Get a cir::ConstArrayAttr for a string literal. + /// Note: Th

[clang] [CIR] Upstream support for string literals (PR #140796)

2025-05-20 Thread Erich Keane via cfe-commits
@@ -26,6 +26,34 @@ class CIRGenBuilderTy : public cir::CIRBaseBuilderTy { CIRGenBuilderTy(mlir::MLIRContext &mlirContext, const CIRGenTypeCache &tc) : CIRBaseBuilderTy(mlirContext), typeCache(tc) {} + /// Get a cir::ConstArrayAttr for a string literal. + /// Note: Th

[clang] [CIR] Upstream support for string literals (PR #140796)

2025-05-20 Thread Erich Keane via cfe-commits
@@ -26,6 +26,34 @@ class CIRGenBuilderTy : public cir::CIRBaseBuilderTy { CIRGenBuilderTy(mlir::MLIRContext &mlirContext, const CIRGenTypeCache &tc) : CIRBaseBuilderTy(mlirContext), typeCache(tc) {} + /// Get a cir::ConstArrayAttr for a string literal. + /// Note: Th

  1   2   3   4   5   6   7   8   9   10   >