[clang] [Clang][Parser] Accept P2741R3 (static_assert with user-generated message) in C++11 as an extension (PR #102044)

2024-09-16 Thread Erich Keane via cfe-commits
erichkeane wrote: @yashssh : We can take this offline (see slack), but Feature Test Macros are intended to change. The values listed in the standard are the 'minimum' value for a compiler that implemented every feature in the standard. The expectation is that an implementation will use a nu

[clang] [clangl[TableGen] Change Diagnostic Emitter to use const RecordKeeper (PR #108209)

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

[clang] [Clang][Parser] Build up QualifiedTemplateName for typo correction (PR #108148)

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

[clang] Reapply "[Clang][CWG1815] Support lifetime extension of temporary created by aggregate initialization using a default member initializer" (PR #108039)

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

[clang] Reapply "[Clang][CWG1815] Support lifetime extension of temporary created by aggregate initialization using a default member initializer" (PR #108039)

2024-09-11 Thread Erich Keane via cfe-commits
@@ -2509,8 +2509,9 @@ Parser::DeclGroupPtrTy Parser::ParseDeclGroup(ParsingDeclSpec &DS, // P2718R0 - Lifetime extension in range-based for loops. if (getLangOpts().CPlusPlus23) { -auto &LastRecord = Actions.ExprEvalContexts.back(); +auto &LastReco

[clang] Reapply "[Clang][CWG1815] Support lifetime extension of temporary created by aggregate initialization using a default member initializer" (PR #108039)

2024-09-11 Thread Erich Keane via cfe-commits
@@ -7810,9 +7813,11 @@ class Sema final : public SemaBase { } bool isInLifetimeExtendingContext() const { -assert(!ExprEvalContexts.empty() && erichkeane wrote: Ah! I should have thought that was the case. No need to add it back, thanks for clarify

[clang] Reapply "[Clang][CWG1815] Support lifetime extension of temporary created by aggregate initialization using a default member initializer" (PR #108039)

2024-09-11 Thread Erich Keane via cfe-commits
@@ -2509,8 +2509,9 @@ Parser::DeclGroupPtrTy Parser::ParseDeclGroup(ParsingDeclSpec &DS, // P2718R0 - Lifetime extension in range-based for loops. if (getLangOpts().CPlusPlus23) { -auto &LastRecord = Actions.ExprEvalContexts.back(); +auto &LastReco

[clang] Reapply "[Clang][CWG1815] Support lifetime extension of temporary created by aggregate initialization using a default member initializer" (PR #108039)

2024-09-11 Thread Erich Keane via cfe-commits
@@ -7810,9 +7813,11 @@ class Sema final : public SemaBase { } bool isInLifetimeExtendingContext() const { -assert(!ExprEvalContexts.empty() && erichkeane wrote: Sure, but why would this be in a case where we're not in an evaluation context? You're r

[clang] [Clang][Parser] Build up QualifiedTemplateName for typo correction (PR #108148)

2024-09-11 Thread Erich Keane via cfe-commits
erichkeane wrote: > Given how late in the cycle it is, I would say we shouldn't backport _now_ > but if we do another point release of 19.x, then we should backport then. Offline, Aaron and I discussed the changes this release cycle, and I think I agree with this. We're too close to the curre

[clang] Reapply "[Clang][CWG1815] Support lifetime extension of temporary created by aggregate initialization using a default member initializer" (PR #108039)

2024-09-11 Thread Erich Keane via cfe-commits
@@ -120,10 +120,11 @@ void aggregateWithReferences() { clang_analyzer_dump(viaReference);// expected-warning-re {{&lifetime_extended_object{RefAggregate, viaReference, S{{[0-9]+}}} }} clang_analyzer_dump(viaReference.rx); // expected-warning-re {{&lifetime_extended_obj

[clang] Reapply "[Clang][CWG1815] Support lifetime extension of temporary created by aggregate initialization using a default member initializer" (PR #108039)

2024-09-11 Thread Erich Keane via cfe-commits
@@ -7810,9 +7813,11 @@ class Sema final : public SemaBase { } bool isInLifetimeExtendingContext() const { -assert(!ExprEvalContexts.empty() && - "Must be in an expression evaluation context"); -return ExprEvalContexts.back().InLifetimeExtendingContext; +

[clang] Reapply "[Clang][CWG1815] Support lifetime extension of temporary created by aggregate initialization using a default member initializer" (PR #108039)

2024-09-11 Thread Erich Keane via cfe-commits
@@ -7810,9 +7813,11 @@ class Sema final : public SemaBase { } bool isInLifetimeExtendingContext() const { -assert(!ExprEvalContexts.empty() && erichkeane wrote: What cases are we wanting to check our lifetime extending context when there is possibly

[clang] Reapply "[Clang][CWG1815] Support lifetime extension of temporary created by aggregate initialization using a default member initializer" (PR #108039)

2024-09-11 Thread Erich Keane via cfe-commits
@@ -2509,8 +2509,9 @@ Parser::DeclGroupPtrTy Parser::ParseDeclGroup(ParsingDeclSpec &DS, // P2718R0 - Lifetime extension in range-based for loops. if (getLangOpts().CPlusPlus23) { -auto &LastRecord = Actions.ExprEvalContexts.back(); +auto &LastReco

[clang] [Clang][Parser] Build up QualifiedTemplateName for typo correction (PR #108148)

2024-09-11 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. I think this change is sensible/innocuous enough. While the clangd justification is somewhat motivating, it would depend on where we want to backport it to. it seems to me that a x.0.0 release would probably be acceptable for backport

[clang] [clang-tools-extra] [clang] Extend diagnose_if to accept more detailed warning information (PR #70976)

2024-09-11 Thread Erich Keane via cfe-commits
@@ -179,13 +180,85 @@ class DiagnosticMapping { class DiagnosticIDs : public RefCountedBase { public: /// The level of the diagnostic, after it has been through mapping. - enum Level { -Ignored, Note, Remark, Warning, Error, Fatal + enum Level : uint8_t { Ignored, Note,

[clang] [clang-tools-extra] [clang] Extend diagnose_if to accept more detailed warning information (PR #70976)

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

[clang] [clang-tools-extra] [clang] Extend diagnose_if to accept more detailed warning information (PR #70976)

2024-09-11 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. I think this is fine to commit, sorry my review took so long! https://github.com/llvm/llvm-project/pull/70976 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-b

[clang] [clang-tools-extra] [clang] Extend diagnose_if to accept more detailed warning information (PR #70976)

2024-09-11 Thread Erich Keane via cfe-commits
@@ -179,13 +180,85 @@ class DiagnosticMapping { class DiagnosticIDs : public RefCountedBase { public: /// The level of the diagnostic, after it has been through mapping. - enum Level { -Ignored, Note, Remark, Warning, Error, Fatal + enum Level : uint8_t { Ignored, Note,

[clang] [clang-tools-extra] [clang] Extend diagnose_if to accept more detailed warning information (PR #70976)

2024-09-11 Thread Erich Keane via cfe-commits
@@ -82,7 +83,7 @@ namespace clang { /// to either Ignore (nothing), Remark (emit a remark), Warning /// (emit a warning) or Error (emit as an error). It allows clients to /// map ERRORs to Error or Fatal (stop emitting diagnostics after this one). -enum class

[clang] [Clang] Introduce FunctionParmPackDecl for expanded lambda captures (PR #107995)

2024-09-10 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: This seems reasonable to me, and the code itself is fine. I wouldn't mind a few of the others getting a chance to make a comment on it, and for me myself to consider the implications of it. So this just needs time to bake in my head. https://github.co

[clang] [clang-tools-extra] [clangd] show lambda name instead of operator() in signature help (PR #101857)

2024-09-10 Thread Erich Keane via cfe-commits
@@ -876,6 +876,11 @@ class Sema; /// function pointer or reference (C++ [over.call.object]). FunctionDecl *Function; +/// LambdaName - When the OverloadCandidate is for a +/// lambda's operator(), points to the declaration of +/// the lambda variable. +

[clang] [clang-tools-extra] [clangd] show lambda name instead of operator() in signature help (PR #101857)

2024-09-09 Thread Erich Keane via cfe-commits
@@ -6292,11 +6298,16 @@ SemaCodeCompletion::ProduceCallSignatureHelp(Expr *Fn, ArrayRef Args, SmallVector ArgExprs(1, NakedFn); ArgExprs.append(ArgsWithoutDependentTypes.begin(), ArgsWithoutDependentTypes.end()); +auto *const Lam

[clang] [clang-tools-extra] [clangd] show lambda name instead of operator() in signature help (PR #101857)

2024-09-09 Thread Erich Keane via cfe-commits
@@ -10204,15 +10205,14 @@ class Sema final : public SemaBase { /// both @c a1 and @c a2. If @p SuppressUserConversions, then don't /// allow user-defined conversions via constructors or conversion /// operators. - void - AddMethodCandidate(CXXMethodDecl *Method, DeclAcc

[clang] [clang-tools-extra] [clangd] show lambda name instead of operator() in signature help (PR #101857)

2024-09-09 Thread Erich Keane via cfe-commits
@@ -876,6 +876,11 @@ class Sema; /// function pointer or reference (C++ [over.call.object]). FunctionDecl *Function; +/// LambdaName - When the OverloadCandidate is for a +/// lambda's operator(), points to the declaration of +/// the lambda variable. +

[clang] [Parser][NFC] Move the core parsing of an attribute into a separate method (PR #107300)

2024-09-06 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. OK with this for now, once the parse function name changes. https://github.com/llvm/llvm-project/pull/107300 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bi

[clang] [Parser][NFC] Move the core parsing of an attribute into a separate method (PR #107300)

2024-09-06 Thread Erich Keane via cfe-commits
@@ -2943,6 +2943,9 @@ class Parser : public CodeCompletionHandler { return false; } + bool ParseGNUSingleAttribute(ParsedAttributes &Attrs, SourceLocation &EndLoc, erichkeane wrote: >I'm not sure how? It would change the purpose of this patch. If yo

[clang] [Clang] Don't assert non-empty packs for FunctionParmPackExprs (PR #107561)

2024-09-06 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. I think with the test, I'm happy. Please give other folks ~24 hrs to get a chance to take a look in case there is something I missed. https://github.com/llvm/llvm-project/pull/107561 ___ cfe-c

[clang] [Clang] Don't assert non-empty packs for FunctionParmPackExprs (PR #107561)

2024-09-06 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: This looks reasonable, I want to think on it a little and give others a chance to look at it, plus I want ot make sure we didn't lose test coverage. Else LGTM. https://github.com/llvm/llvm-project/pull/107561 ___

[clang] [Clang] Don't assert non-empty packs for FunctionParmPackExprs (PR #107561)

2024-09-06 Thread Erich Keane via cfe-commits
@@ -1,13 +0,0 @@ -// RUN: %clang_cc1 -std=c++17 %s -fsyntax-only -verify - -template void g(Ts... p1s) { - (void)[&](auto... p2s) { ([&] { p1s; p2s; }, ...); }; -} - -void f1() { - g(); -} - -template void g2(Ts... p1s) { - (void)[&](auto... p2s) { [&] { p1s; p2s; }; }; // ex

[clang] [clang-tools-extra] [clangd] show lambda name instead of operator() in signature help (PR #101857)

2024-09-06 Thread Erich Keane via cfe-commits
@@ -6292,11 +6298,16 @@ SemaCodeCompletion::ProduceCallSignatureHelp(Expr *Fn, ArrayRef Args, SmallVector ArgExprs(1, NakedFn); ArgExprs.append(ArgsWithoutDependentTypes.begin(), ArgsWithoutDependentTypes.end()); +auto *const Lam

[clang] [clang-tools-extra] [clangd] show lambda name instead of operator() in signature help (PR #101857)

2024-09-06 Thread Erich Keane via cfe-commits
@@ -876,6 +876,11 @@ class Sema; /// function pointer or reference (C++ [over.call.object]). FunctionDecl *Function; +/// LambdaName - When the OverloadCandidate is for a +/// lambda's operator(), points to the declaration of +/// the lambda variable. +

[clang] [clang-tools-extra] [clangd] show lambda name instead of operator() in signature help (PR #101857)

2024-09-06 Thread Erich Keane via cfe-commits
@@ -4022,7 +4022,10 @@ CodeCompleteConsumer::OverloadCandidate::CreateSignatureString( std::string Name; llvm::raw_string_ostream OS(Name); -FDecl->getDeclName().print(OS, Policy); +auto const DeclName = (getKind() == CK_Lambda) erichkeane wro

[clang] [clang-tools-extra] [clangd] show lambda name instead of operator() in signature help (PR #101857)

2024-09-06 Thread Erich Keane via cfe-commits
@@ -2390,7 +2390,8 @@ static bool LookupQualifiedNameInUsingDirectives(Sema &S, LookupResult &R, } bool Sema::LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx, - bool InUnqualifiedLookup) { + bool InUnqual

[clang] [clang-tools-extra] [clangd] show lambda name instead of operator() in signature help (PR #101857)

2024-09-06 Thread Erich Keane via cfe-commits
@@ -10204,15 +10205,14 @@ class Sema final : public SemaBase { /// both @c a1 and @c a2. If @p SuppressUserConversions, then don't /// allow user-defined conversions via constructors or conversion /// operators. - void - AddMethodCandidate(CXXMethodDecl *Method, DeclAcc

[clang] [clang-tools-extra] [clangd] show lambda name instead of operator() in signature help (PR #101857)

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

[clang] [clang-tools-extra] [clangd] show lambda name instead of operator() in signature help (PR #101857)

2024-09-06 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: I'm not sold on this patch, particularly the changes to the overload. I also wonder if we would better off having `CXXRecordDecl` save its 'variable' for lambdas (and look it up from there) rather than this. https://github.com/llvm/llvm-project/pull/1

[clang] [Parser][NFC] Move the core parsing of an attribute into a separate method (PR #107300)

2024-09-06 Thread Erich Keane via cfe-commits
@@ -2943,6 +2943,9 @@ class Parser : public CodeCompletionHandler { return false; } + bool ParseGNUSingleAttribute(ParsedAttributes &Attrs, SourceLocation &EndLoc, erichkeane wrote: Ah, I see. The WG14 specified one is `__builtin_has_c_attribute`, cor

[clang] [Clang] Set `__cpp_explicit_this_parameter` (PR #107451)

2024-09-05 Thread Erich Keane via cfe-commits
erichkeane wrote: It appears that https://github.com/llvm/llvm-project/pull/95112 is actually pretty close... are we better off holding off on this until after that goes in? https://github.com/llvm/llvm-project/pull/107451 ___ cfe-commits mailing l

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2024-09-05 Thread Erich Keane via cfe-commits
erichkeane wrote: > That might not be enough. A function might not be used (or even referenced) > in the TU that defines it, but only in other TUs. But it would certainly > catch a number of issues already. Right, though catching that ends up being pretty impossible. The most you could do is

[clang] [clang-tools-extra] [clang] Implement CWG2398 provisional TTP matching to class templates (PR #94981)

2024-09-05 Thread Erich Keane via cfe-commits
@@ -9219,7 +9222,8 @@ class Sema final : public SemaBase { /// \returns true if an error occurred, false otherwise. bool CheckTemplateArgumentList( TemplateDecl *Template, SourceLocation TemplateLoc, - TemplateArgumentListInfo &TemplateArgs, bool PartialTemplateA

[clang] [Clang] Fix crash with `source_location` in lambda declarators. (PR #107411)

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

[clang] [Clang] Fix crash with `source_location` in lambda declarators. (PR #107411)

2024-09-05 Thread Erich Keane via cfe-commits
erichkeane wrote: Woops! Had the wrong tab open and typed in the wrong 'fixes', did not mean to close this. The patch was supposed to fix https://github.com/llvm/llvm-project/issues/107052 https://github.com/llvm/llvm-project/pull/107411 ___ cfe-com

[clang] [Clang] Fix crash with `source_location` in lambda declarators. (PR #107411)

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

[clang] [Clang] Fix crash with `source_location` in lambda declarators. (PR #107411)

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

[clang] [Clang] Fix crash with `source_location` in lambda declarators. (PR #107411)

2024-09-05 Thread Erich Keane via cfe-commits
@@ -2287,6 +2288,15 @@ APValue SourceLocExpr::EvaluateInContext(const ASTContext &Ctx, Context = getParentContext(); } + // If we are currently parsing a lambda declarator, we might not have a fully + // formed call operator declaration yet, and we could not form a fu

[clang] [Parser][NFC] Move the core parsing of an attribute into a separate method (PR #107300)

2024-09-05 Thread Erich Keane via cfe-commits
@@ -2943,6 +2943,9 @@ class Parser : public CodeCompletionHandler { return false; } + bool ParseGNUSingleAttribute(ParsedAttributes &Attrs, SourceLocation &EndLoc, erichkeane wrote: I don't have a preference for any of the 3 names, but a comment explai

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

2024-09-05 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: I'm happy enough with it as is, I'd like @Sirraide to do 1 last pass, but if he approves, so do I. https://github.com/llvm/llvm-project/pull/99656 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https:/

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

2024-09-04 Thread Erich Keane via cfe-commits
@@ -0,0 +1,1566 @@ +//=== 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-04 Thread Erich Keane via cfe-commits
@@ -0,0 +1,1566 @@ +//=== 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-04 Thread Erich Keane via cfe-commits
@@ -8392,6 +8397,20 @@ void ASTReader::InitializeSema(Sema &S) { NewOverrides.applyOverrides(SemaObj->getLangOpts()); } + if (!DeclsWithEffectsToVerify.empty()) { +for (GlobalDeclID ID : DeclsWithEffectsToVerify) { + Decl *D = GetDecl(ID); + FunctionEf

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

2024-09-04 Thread Erich Keane via cfe-commits
@@ -10950,6 +10950,51 @@ def warn_imp_cast_drops_unaligned : Warning< InGroup>; // Function effects +def warn_func_effect_violation : Warning< + "'%0' %select{function|constructor|destructor|lambda|block|constructor's member initializer}1 " erichkeane wrot

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

2024-09-04 Thread Erich Keane via cfe-commits
@@ -4932,6 +4938,78 @@ class FunctionEffectsRef { void dump(llvm::raw_ostream &OS) const; }; +/// A mutable set of FunctionEffect::Kind. +class FunctionEffectKindSet { + // For now this only needs to be a bitmap. + constexpr static size_t EndBitPos = 8; + using KindBitsT

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

2024-09-04 Thread Erich Keane via cfe-commits
@@ -15099,6 +15037,106 @@ class Sema final : public SemaBase { std::string getFixItZeroLiteralForType(QualType T, SourceLocation Loc) const; ///@} + + // erichkeane wrote: @endilll ? https://github.com/llvm/llvm-project/pull/99656 __

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

2024-09-04 Thread Erich Keane via cfe-commits
@@ -10950,6 +10950,51 @@ def warn_imp_cast_drops_unaligned : Warning< InGroup>; // Function effects +def warn_func_effect_violation : Warning< + "'%0' %select{function|constructor|destructor|lambda|block|constructor's member initializer}1 " erichkeane wrot

[clang] [clang-tools-extra] [clang] Implement CWG2398 provisional TTP matching to class templates (PR #94981)

2024-09-04 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: I've not done as in depth of a review as Corentin, but I approve of the direction here, I think the approach is correct, and most of the changes are fairly mechanical. So once Corentin is happy with the changes, so am I. https://github.com/llvm/llvm-pr

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2024-09-04 Thread Erich Keane via cfe-commits
erichkeane wrote: Rather than this being "not added in the header file", should we just make this one of the attributes that is disallowed after the thing has been 'referenced'? Or is that a dumb suggestion here? https://github.com/llvm/llvm-project/pull/67520

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

2024-09-04 Thread Erich Keane via cfe-commits
@@ -186,4 +218,370 @@ bool Sema::CheckCountedByAttrOnField(FieldDecl *FD, Expr *E, bool CountInBytes, return false; } +SourceRange Sema::BoundsSafetySourceRangeFor(const CountAttributedType *CATy) { erichkeane wrote: I agree with Sirraide here, but would h

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

2024-09-04 Thread Erich Keane via cfe-commits
@@ -3343,6 +3363,8 @@ class CountAttributedType final static bool classof(const Type *T) { return T->getTypeClass() == CountAttributed; } + + StringRef GetAttributeName(bool WithMacroPrefix) const; erichkeane wrote: ```suggestion StringRef getAttrib

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

2024-09-04 Thread Erich Keane via cfe-commits
@@ -186,4 +218,370 @@ bool Sema::CheckCountedByAttrOnField(FieldDecl *FD, Expr *E, bool CountInBytes, return false; } +SourceRange Sema::BoundsSafetySourceRangeFor(const CountAttributedType *CATy) { + // Note: This implementation relies on `CountAttributedType` being uniqu

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

2024-09-04 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: I did a pass, I think @Sirraide is on the right direction in his reviews here, but the general direction of this patch is also completely acceptable. https://github.com/llvm/llvm-project/pull/106321 ___ cfe-com

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

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

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

2024-09-04 Thread Erich Keane via cfe-commits
@@ -13559,6 +13562,27 @@ QualType Sema::CheckAssignmentOperands(Expr *LHSExpr, ExprResult &RHS, QualType LHSType = LHSExpr->getType(); QualType RHSType = CompoundType.isNull() ? RHS.get()->getType() : CompoundType; + + if (RHS.

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

2024-09-04 Thread Erich Keane via cfe-commits
@@ -4932,6 +4938,78 @@ class FunctionEffectsRef { void dump(llvm::raw_ostream &OS) const; }; +/// A mutable set of FunctionEffect::Kind. +class FunctionEffectKindSet { + // For now this only needs to be a bitmap. + constexpr static size_t EndBitPos = 8; + using KindBitsT

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

2024-09-04 Thread Erich Keane via cfe-commits
@@ -0,0 +1,1566 @@ +//=== 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-04 Thread Erich Keane via cfe-commits
@@ -8392,6 +8397,20 @@ void ASTReader::InitializeSema(Sema &S) { NewOverrides.applyOverrides(SemaObj->getLangOpts()); } + if (!DeclsWithEffectsToVerify.empty()) { +for (GlobalDeclID ID : DeclsWithEffectsToVerify) { + Decl *D = GetDecl(ID); + FunctionEf

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

2024-09-04 Thread Erich Keane via cfe-commits
@@ -0,0 +1,1566 @@ +//=== SemaFunctionEffects.cpp - Sema handling of function effects -===// erichkeane wrote: I've had a hard time with the review of this file, so I haven't done a close look. Hopefully someone who understands this better than me has

[clang] Disallow btf_type_tag in C++ mode (PR #107238)

2024-09-04 Thread Erich Keane via cfe-commits
@@ -225,6 +225,11 @@ Attribute Changes in Clang more cases where the returned reference outlives the object. (#GH100567) +- Now correctly diagnosing use of ``btf_type_tag`` in C++ and ignoring it; this + attribute is a C-only attribute, and was causing crashes with templa

[clang] Disallow btf_type_tag in C++ mode (PR #107238)

2024-09-04 Thread Erich Keane via cfe-commits
@@ -225,6 +225,11 @@ Attribute Changes in Clang more cases where the returned reference outlives the object. (#GH100567) +- Now correctly diagnosing use of ``btf_type_tag`` in C++ and ignoring it; this erichkeane wrote: ```suggestion - Clang now correctly

[clang] Disallow btf_type_tag in C++ mode (PR #107238)

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

[clang] Disallow btf_type_tag in C++ mode (PR #107238)

2024-09-04 Thread Erich Keane via cfe-commits
@@ -6490,6 +6490,15 @@ static void HandleBTFTypeTagAttribute(QualType &Type, const ParsedAttr &Attr, TypeProcessingState &State) { Sema &S = State.getSema(); + // This attribute is only supported in C. + // FIXME: we should implement

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

2024-09-03 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-03 Thread Erich Keane via cfe-commits
@@ -52,38 +52,6 @@ using namespace sema; //===--===/ namespace { -namespace TemplateInstArgsHelpers { erichkeane wrote: Awe, I thought this was clever/useful :) https://github.com/llvm/llvm

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

2024-09-03 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: I'll have to take another look at this when I get more time for it, but I'm glad this is getting further attention. I'd refactored this only a year or two ago (preivously it was a single really long function with a loop), so it is disappointing that we

[clang] [clang-tools-extra] [clang] Extend diagnose_if to accept more detailed warning information (PR #70976)

2024-09-03 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: I'm a little cold on review here, so I don't want to accept this, but I did a scroll through and don't have any problems here. Additionally, a bunch of whitespace changes are still in this, which is making it difficult tor eview. https://github.com/llv

[clang] [clang-tools-extra] [clang] Extend diagnose_if to accept more detailed warning information (PR #70976)

2024-09-03 Thread Erich Keane via cfe-commits
@@ -101,91 +102,164 @@ namespace clang { }; } -class DiagnosticMapping { - LLVM_PREFERRED_TYPE(diag::Severity) - unsigned Severity : 3; - LLVM_PREFERRED_TYPE(bool) - unsigned IsUser : 1; - LLVM_PREFERRED_TYPE(bool) - unsigned IsPragma : 1; - LLVM_PREFERRED_TYPE(bo

[clang] [clang-tools-extra] [clang] Extend diagnose_if to accept more detailed warning information (PR #70976)

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

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

2024-09-03 Thread Erich Keane via cfe-commits
@@ -177,6 +177,26 @@ static bool isLanguageDefinedBuiltin(const SourceManager &SourceMgr, return false; } +static bool isReservedAttrName(Preprocessor &PP, IdentifierInfo *II) { erichkeane wrote: > Because we don't support any non-standard attributes witho

[clang] [clang] fix sema init crashing on initialization sequences (PR #98102)

2024-09-03 Thread Erich Keane via cfe-commits
@@ -5576,6 +5576,10 @@ static void TryOrBuildParenListInitialization( ExprResult ER; ER = IS.Perform(S, SubEntity, SubKind, Arg ? MultiExprArg(Arg) : std::nullopt); + + if (ER.isInvalid()) erichkeane wrote: For `ExprResul

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

2024-09-03 Thread Erich Keane via cfe-commits
@@ -177,6 +177,26 @@ static bool isLanguageDefinedBuiltin(const SourceManager &SourceMgr, return false; } +static bool isReservedAttrName(Preprocessor &PP, IdentifierInfo *II) { erichkeane wrote: I concur with Aaron. The point of this restriction is to pe

[clang] added regcall struct by reg support (PR #95257)

2024-09-03 Thread Erich Keane via cfe-commits
erichkeane wrote: As background: That chunking behavior was not in the specification document that I was provided internally when I implemented that. IIRC at the time, regcall wasn't actually documented externally, so that documentation likely post-dates when I did my implementation. https:/

[clang] [BitInt] Expose a _BitInt literal suffix in C++ (PR #86586)

2024-06-07 Thread Erich Keane via cfe-commits
@@ -1117,6 +1118,31 @@ NumericLiteralParser::NumericLiteralParser(StringRef TokSpelling, if (isImaginary) break; // Cannot be repeated. isImaginary = true; continue; // Success. +case '_': + if (isFPConstant) +break; // Invalid for floats

[clang] [lldb] [clang][AST] fix ast-print of extern with >=2 declarators, fixed (PR #93913)

2024-06-07 Thread Erich Keane via cfe-commits
erichkeane wrote: > > I see the 2nds commit doesn't add any tests! Please make it do so > > I've tried and I'm not quite sure how to do it. The issue is we need to test > AST printing of «implicitly declared» functions, such as builtins and > functions instrumented by lldb, such as `log` for l

[clang] [clang] always use resolved arguments for default argument deduction (PR #94756)

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

[clang] [lldb] [clang][AST] fix ast-print of extern with >=2 declarators, fixed (PR #93913)

2024-06-07 Thread Erich Keane via cfe-commits
erichkeane wrote: I see the 2nds commit doesn't add any tests! Please make it do so, else LGTM (plus might want to do a 'merge' commit to reset the CI to a more stable state). https://github.com/llvm/llvm-project/pull/93913 ___ cfe-commits mailing li

[clang] [libcxx] [Clang] Implement resolution for CWG1835 (PR #92957)

2024-06-06 Thread Erich Keane via cfe-commits
@@ -1790,24 +1782,25 @@ ExprResult Sema::ActOnMemberAccessExpr(Scope *S, Expr *Base, const TemplateArgumentListInfo *TemplateArgs; DecomposeUnqualifiedId(Id, TemplateArgsBuffer, NameInfo, TemplateArgs); - - bool IsArrow = (OpKind == tok::arrow); +

[clang] [libcxx] [Clang] Implement resolution for CWG1835 (PR #92957)

2024-06-06 Thread Erich Keane via cfe-commits
@@ -390,29 +390,37 @@ bool Sema::isAcceptableNestedNameSpecifier(const NamedDecl *SD, /// (e.g., Base::), perform name lookup for that identifier as a /// nested-name-specifier within the given scope, and return the result of that /// name lookup. -NamedDecl *Sema::FindFirstQu

[clang] [libcxx] [Clang] Implement resolution for CWG1835 (PR #92957)

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

[clang] [libcxx] [Clang] Implement resolution for CWG1835 (PR #92957)

2024-06-06 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. Sorry this took so long! Apparently I'd left some comments without finishing my review. Did another look through, everything looks good, just some minor nits. Apply/merge at your convenience. https://github.com/llvm/llvm-project/pull

[clang] [libcxx] [Clang] Implement resolution for CWG1835 (PR #92957)

2024-06-06 Thread Erich Keane via cfe-commits
@@ -1442,19 +1442,27 @@ SourceLocation CXXUnresolvedConstructExpr::getBeginLoc() const { CXXDependentScopeMemberExpr::CXXDependentScopeMemberExpr( const ASTContext &Ctx, Expr *Base, QualType BaseType, bool IsArrow, SourceLocation OperatorLoc, NestedNameSpecifierLoc Qua

[clang] [clang][Sema] Add missing scope flags to Scope::dumpImpl (PR #94529)

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

[clang] [OpenACC] Loop construct basic Sema and AST work (PR #93742)

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

[clang] Disable constexpr function body checking in more situations (PR #94347)

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

[clang] [clang] Add tests for Core issues about friend templates (PR #94288)

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

[clang] Disable constexpr function body checking in more situations (PR #94347)

2024-06-04 Thread Erich Keane via cfe-commits
@@ -2469,11 +2469,20 @@ static bool CheckConstexprFunctionBody(Sema &SemaRef, const FunctionDecl *Dcl, // base class sub-objects shall be a constexpr constructor. // // Note that this rule is distinct from the "requirements for a constexpr - // function", so is not

[clang] Disable constexpr function body checking in more situations (PR #94347)

2024-06-04 Thread Erich Keane via cfe-commits
@@ -505,6 +505,9 @@ COMPATIBLE_LANGOPT(IncrementalExtensions, 1, 0, " True if we want to process sta BENIGN_LANGOPT(CheckNew, 1, 0, "Do not assume C++ operator new may not return NULL") +BENIGN_LANGOPT(CheckConstexprFunctionBodies, 1, 1, + "True if we want to

[clang] Disable constexpr function body checking in more situations (PR #94347)

2024-06-04 Thread Erich Keane via cfe-commits
@@ -961,6 +961,10 @@ def Wdeprecated : Flag<["-"], "Wdeprecated">, Group, HelpText<"Enable warnings for deprecated constructs and define __DEPRECATED">; def Wno_deprecated : Flag<["-"], "Wno-deprecated">, Group, Visibility<[ClangOption, CC1Option]>; +def Winvalid_constexp

[clang] [Clang] Static and explicit object member functions with the same parameter-type-lists (PR #93430)

2024-06-04 Thread Erich Keane via cfe-commits
@@ -5813,6 +5813,23 @@ static TypoCorrection TryTypoCorrectionForCall(Sema &S, Expr *Fn, return TypoCorrection(); } +static bool isParenthetizedAndQualifiedAddressOfExpr(Expr *Fn) { + if (!isa(Fn)) +return false; + + Fn = Fn->IgnoreParens(); erichkean

[clang] [Clang] Static and explicit object member functions with the same parameter-type-lists (PR #93430)

2024-06-04 Thread Erich Keane via cfe-commits
@@ -7807,6 +7833,7 @@ void Sema::AddTemplateOverloadCandidate( Candidate.IgnoreObjectArgument = isa(Candidate.Function) && !isa(Candidate.Function); +Candidate.TookAddressOfOverload = false; erichkeane wrote: Feel like Candidate should

[clang] [Clang] Static and explicit object member functions with the same parameter-type-lists (PR #93430)

2024-06-04 Thread Erich Keane via cfe-commits
@@ -3048,10 +3050,12 @@ class OverloadExpr : public Expr { Result.HasFormOfMemberPointer = (E == Ovl && Ovl->getQualifier()); Result.IsAddressOfOperand = true; + Result.IsAddressOfOperandWithParen = HasParen; erichkeane wrote: Cleanup nit: I

[clang] [Clang] Static and explicit object member functions with the same parameter-type-lists (PR #93430)

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

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