[clang] [Clang][Parser] Remove the concept from the DeclContext if the definition is invalid (PR #111179)

2024-10-04 Thread Shafik Yaghmour via cfe-commits
@@ -337,6 +343,8 @@ Parser::ParseConceptDefinition(const ParsedTemplateInfo &TemplateInfo, ExprResult ConstraintExprResult = Actions.CorrectDelayedTyposInExpr(ParseConstraintExpression()); if (ConstraintExprResult.isInvalid()) { +if (AddedToScope) ---

[clang] [clang] fix assert in ADL finding entity in the implicit global module (PR #109882)

2024-09-26 Thread Shafik Yaghmour via cfe-commits
@@ -115,7 +115,7 @@ C++ Language Changes - Allow single element access of GCC vector/ext_vector_type object to be constant expression. Supports the `V.xyzw` syntax and other tidbits as seen in OpenCL. Selecting multiple elements is left as a future work. -- Implement `CWG18

[clang] [clang] Use std::optional::value_or (NFC) (PR #109894)

2024-09-26 Thread Shafik Yaghmour via cfe-commits
shafik wrote: Next time please provide a better summary for your PR. This is super important for downstream folks debugging build breaks. In general this is important for reviews to compare what they expect with the actual diff. In this case something like "replace the use of conditional opera

[clang] [clang] Allow class with anonymous union member to be const-default-constructible even if a union member has a default member initializer (#95854) (PR #96301)

2024-09-23 Thread Shafik Yaghmour via cfe-commits
@@ -0,0 +1,43 @@ +// RUN: %clang_cc1 -std=c++23 -fsyntax-only -verify %s + +struct A { shafik wrote: We should also test this case: ```cpp struct A { union { int n; int m=0; }; }; const A a; ``` https://github.com/llvm/llvm-project/pull/96301 _

[clang] [clang] fix the unexpected control flow in ParseTentative.cpp (PR #109298)

2024-09-20 Thread Shafik Yaghmour via cfe-commits
shafik wrote: CC @tbaederr this does not look like equivalent code to me based on your original isue but maybe I am confused. https://github.com/llvm/llvm-project/pull/109298 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.o

[clang] [C++20][Modules] Restore inliness of constexpr/consteval functions defined in-class (PR #109470)

2024-09-20 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: The link you gave for the regression is not a llvm commit, is that the correct commit you meant to point to? https://github.com/llvm/llvm-project/pull/109470 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

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

2024-09-18 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: In case I don't get a chance to look at this in more detail right away can you please reference specific CWG issues in the summary and in comments in the code? Thank you. https://github.com/llvm/llvm-project/pull/109208 _

[clang] [clang][Sema] Fix assertion in `tryDiagnoseOverloadedCast` (PR #108021)

2024-09-17 Thread Shafik Yaghmour via cfe-commits
Alejandro =?utf-8?q?=C3=81lvarez_Ayll=C3=B3n?=, Alejandro =?utf-8?q?=C3=81lvarez_Ayll=C3=B3n?= Message-ID: In-Reply-To: https://github.com/shafik approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/108021 ___ cfe-commits mailin

[clang] [Clang] prevented assertion failure by handling integral to boolean conversions for boolean vectors (PR #108657)

2024-09-16 Thread Shafik Yaghmour via cfe-commits
@@ -9868,7 +9868,12 @@ static bool tryVectorConvertAndSplat(Sema &S, ExprResult *scalar, // if necessary. CastKind scalarCast = CK_NoOp; - if (vectorEltTy->isIntegralType(S.Context)) { + if (vectorEltTy->isBooleanType()) { +if (scalarTy->isIntegralType(S.Context)) +

[clang] [Clang] prevented assertion failure by handling integral to boolean conversions for boolean vectors (PR #108657)

2024-09-16 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: Please add more details to the summary to explain what the fix actually does. https://github.com/llvm/llvm-project/pull/108657 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/m

[clang] [Clang] prevented assertion failure by handling integral to boolean conversions for boolean vectors (PR #108657)

2024-09-16 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik edited https://github.com/llvm/llvm-project/pull/108657 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Allow user defined conversion implicit cast to _Complex types in constant expressions (PR #108758)

2024-09-16 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: You need to add more details to the summary something like: the fix was to handle `CK_UserDefinedConversion` in `ComplexExprEvaluator::VisitCastExpr` as opposed to treating it as an error. https://github.com/llvm/llvm-project/pull/108758 __

[clang] [Clang] Reject `this void` explicit object parameters (CWG2915) (PR #108817)

2024-09-16 Thread Shafik Yaghmour via cfe-commits
shafik wrote: > LGTM but it would be nice to do the other changes to cxx_dr_status as a > separate (NFC) commit We should always strive to keep unrelated changes separate. There are a lot of good reasons for this. The most basic is that if we have to revert then we lose both set of changes bu

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

2024-09-16 Thread Shafik Yaghmour via cfe-commits
@@ -0,0 +1,19 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s shafik wrote: I think this test should go in `clang/test/Sema/conditional-expr.c` and we should add a section of the GNU extension there. I am also a bit concerned that we don't have a spe

[clang] [Clang] handle invalid close location in static assert declaration (PR #108701)

2024-09-14 Thread Shafik Yaghmour via cfe-commits
shafik wrote: > > So this looks like a regression: https://gcc.godbolt.org/z/h6GexT18E > > @shafik https://gcc.godbolt.org/z/Ebvnjrc8e Interesting it crashes in trunk w/o `c++20`: https://gcc.godbolt.org/z/h9xa8eaqo but the backtrace looks the same. We should test this in C++20 and C++23 as w

[clang] [Clang] handle invalid close location in static assert declaration (PR #108701)

2024-09-14 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik requested changes to this pull request. So this looks like a regression: https://gcc.godbolt.org/z/h6GexT18E Can we figure out which PR this regression came from and make sure the code change makes sense in light of that PR? Also please add a more detailed summary to

[clang] [Clang] handle invalid close location in static assert declaration (PR #108701)

2024-09-14 Thread Shafik Yaghmour via cfe-commits
shafik wrote: So this looks like a regression: https://gcc.godbolt.org/z/h6GexT18E Can we figure out which PR this regression came from and make sure the code change makes sense in light of that PR? Also please add a more detailed summary to this PR, describing why the crash happens and the

[clang] Add code completion for C++20 keywords. (PR #107982)

2024-09-12 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: What about `module`, `import` and `export`? https://github.com/llvm/llvm-project/pull/107982 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][Sema] Fix assertion in `tryDiagnoseOverloadedCast` (PR #108021)

2024-09-12 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: Thank you for the fix. Is this from a bug report, if so it should be mentioned in the summary. The summary itself could be a big clearer, maybe a small code example could help. I think this also needs a release note. https://github.com/llvm/llvm-project/p

[clang] [clang][Sema] Fix assertion in `tryDiagnoseOverloadedCast` (PR #108021)

2024-09-12 Thread Shafik Yaghmour via cfe-commits
@@ -446,7 +446,12 @@ static bool tryDiagnoseOverloadedCast(Sema &S, CastType CT, : InitializationKind::CreateCast(/*type range?*/ range); InitializationSequence sequence(S, entity, initKind, src); - assert(sequence.Failed() && "initialization succeeded on second try?");

[clang] [clang][Sema] Fix assertion in `tryDiagnoseOverloadedCast` (PR #108021)

2024-09-12 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik edited https://github.com/llvm/llvm-project/pull/108021 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Fix the behavior of __COUNT__ macros when PCH is enabled (PR #105591)

2024-09-12 Thread Shafik Yaghmour via cfe-commits
@@ -1243,12 +1247,19 @@ bool ASTUnit::Parse(std::shared_ptr PCHContainerOps, } std::unique_ptr Act( - new TopLevelDeclTrackerAction(*this)); + new TopLevelDeclTrackerAction(*this, true)); shafik wrote: We should use [bugprone-argument-comment]

[clang] [clang] Don't emit bogus dangling diagnostics when `[[gsl::Owner]]` and `[[clang::lifetimebound]]` are used together. (PR #108280)

2024-09-11 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: Can you add some more details to the summary e.g. "The fix adds an additional check in isGSLOwner() for Owner attribute" or something along those lines. https://github.com/llvm/llvm-project/pull/108280 ___ cfe-comm

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

2024-09-05 Thread Shafik Yaghmour via cfe-commits
@@ -6298,6 +6298,15 @@ class Sema final : public SemaBase { using ImmediateInvocationCandidate = llvm::PointerIntPair; + enum class LifetimeExtendingContext { +None, // Not in a lifetime extending context. +FlagOnly, // A flag indicating whether we are in l

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

2024-09-05 Thread Shafik Yaghmour via cfe-commits
shafik wrote: I am not sure I see all the examples from: https://cplusplus.github.io/CWG/issues/1696.html https://github.com/llvm/llvm-project/pull/97308 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https:

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

2024-09-05 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik edited https://github.com/llvm/llvm-project/pull/97308 ___ 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 #97308)

2024-09-05 Thread Shafik Yaghmour via cfe-commits
@@ -5578,19 +5579,35 @@ ExprResult Sema::BuildCXXDefaultInitExpr(SourceLocation Loc, FieldDecl *Field) { ImmediateCallVisitor V(getASTContext()); if (!NestedDefaultChecking) V.TraverseDecl(Field); - if (V.HasImmediateCalls) { + + // CWG1815 + // Support lifetime ext

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

2024-09-05 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: I think I need a second run through https://github.com/llvm/llvm-project/pull/97308 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Reapply "[Clang] Implement P3034R1 Module Declarations Shouldn’t be Macros" (PR #102135)

2024-09-05 Thread Shafik Yaghmour via cfe-commits
@@ -652,14 +647,14 @@ bool Parser::ParseTopLevelDecl(DeclGroupPtrTy &Result, // Recognize context-sensitive C++20 'export module' and 'export import' // declarations. case tok::identifier: { - IdentifierInfo *II = NextToken().getIdentifierInfo(); - if ((II

[clang] Reapply "[Clang] Implement P3034R1 Module Declarations Shouldn’t be Macros" (PR #102135)

2024-09-05 Thread Shafik Yaghmour via cfe-commits
@@ -4558,6 +4574,12 @@ bool Lexer::LexDependencyDirectiveToken(Token &Result) { Result.setRawIdentifierData(TokPtr); if (!isLexingRawMode()) { const IdentifierInfo *II = PP->LookUpIdentifierInfo(Result); + if (Result.isModuleContextualKeyword()) { +//

[clang] Reapply "[Clang] Implement P3034R1 Module Declarations Shouldn’t be Macros" (PR #102135)

2024-09-05 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: Minor comments, I agree with @cor3ntin that you should split this into two PRs. It will be much better to review in smaller form. https://github.com/llvm/llvm-project/pull/102135 ___ cfe-commits mailing list cfe-co

[clang] Reapply "[Clang] Implement P3034R1 Module Declarations Shouldn’t be Macros" (PR #102135)

2024-09-05 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik edited https://github.com/llvm/llvm-project/pull/102135 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Workaround dependent source location issues (PR #106925)

2024-09-03 Thread Shafik Yaghmour via cfe-commits
@@ -5443,11 +5443,24 @@ struct EnsureImmediateInvocationInDefaultArgs // Rewrite to source location to refer to the context in which they are used. ExprResult TransformSourceLocExpr(SourceLocExpr *E) { -if (E->getParentContext() == SemaRef.CurContext) +DeclContext

[clang] [Clang] Treat default template argument as constant expressions (PR #107073)

2024-09-03 Thread Shafik Yaghmour via cfe-commits
@@ -97,3 +97,29 @@ void foo() { } #endif + +#if __cplusplus >= 202002L +void GH107048() { + constexpr int x{}; + const int y{}; + auto b = []{}; + using A = decltype([]{}); + + int z; // expected-note {{'z' declared here}} + auto c = []{ +// expected-error@-1 {{no ma

[clang] [clang] Fix crash in code with StmtExpr and atomic char load in Expr::EvaluateAsRValue. (PR #106751)

2024-08-30 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: @tbaederr I am not confident this is the right approach. If we compare the non-statement-expression case: https://godbolt.org/z/vseWeh5jP We don't have the same issue as the original case: https://godbolt.org/z/Gh13WcMEz So I suspect there is something abo

[clang] [clang][bytecode] Add InitLinkScope for temporary variables (PR #106552)

2024-08-29 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: Can you add more details to the summary explaining why the fix is necessary. https://github.com/llvm/llvm-project/pull/106552 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/ma

[clang] [NFC][Sema] Move `Sema::AssignmentAction` into its own scoped enum (PR #106453)

2024-08-28 Thread Shafik Yaghmour via cfe-commits
@@ -8819,8 +8822,8 @@ Expr *OpenMPIterationSpaceChecker::buildNumIterations( NewSize, Type->hasSignedIntegerRepresentation() || C.getTypeSize(Type) < NewSize); if (!SemaRef.Context.hasSameType(Diff.get()->getType(), NewType)) { -Di

[clang] [NFC][Sema] Move `Sema::AssignmentAction` into its own scoped enum (PR #106453)

2024-08-28 Thread Shafik Yaghmour via cfe-commits
@@ -9469,7 +9473,8 @@ static ExprResult buildCounterUpdate( if (!SemaRef.Context.hasSameType(Update.get()->getType(), VarRef.get()->getType())) { Update = SemaRef.PerformImplicitConversion( - Update.get(), VarRef.get()->ge

[clang] [NFC][Sema] Move `Sema::AssignmentAction` into its own scoped enum (PR #106453)

2024-08-28 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik edited https://github.com/llvm/llvm-project/pull/106453 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [NFC][Sema] Move `Sema::AssignmentAction` into its own scoped enum (PR #106453)

2024-08-28 Thread Shafik Yaghmour via cfe-commits
@@ -9491,8 +9496,8 @@ static ExprResult widenIterationCount(unsigned Bits, Expr *E, Sema &SemaRef) { return ExprResult(E); // OK to convert to signed, because new type has more bits than old. QualType NewType = C.getIntTypeForBitwidth(Bits, /*Signed=*/true); - return

[clang] [NFC][Sema] Move `Sema::AssignmentAction` into its own scoped enum (PR #106453)

2024-08-28 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik approved this pull request. LGTM except for nitpicks https://github.com/llvm/llvm-project/pull/106453 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] fix broken canonicalization of DeducedTemplateSpecializationType (PR #95202)

2024-08-27 Thread Shafik Yaghmour via cfe-commits
shafik wrote: Looks like this is linked to a clang-19 regression: https://github.com/llvm/llvm-project/issues/106182 https://github.com/llvm/llvm-project/pull/95202 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin

[clang] [Clang] prevent assertion failure when converting vectors to int/float with invalid expressions (PR #105727)

2024-08-27 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: Thank you for the fix, can you add more details to the summary, in this case some details on the fix and why it works would be helpful. https://github.com/llvm/llvm-project/pull/105727 ___ cfe-commits mailing list

[clang] [clang][Sema] Fix diagnostic for function overloading in extern "C" (PR #106033)

2024-08-26 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: This make sense to me, @dwblaikie wdyt? https://github.com/llvm/llvm-project/pull/106033 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Allow class with anonymous union member to be const-default-constructible even if a union member has a default member initializer (#95854) (PR #96301)

2024-08-26 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: I don't think the test failures look related to the changes can you push and empty change to see if rerunning the tests comes up clean? https://github.com/llvm/llvm-project/pull/96301 ___ cfe-commits mailing list c

[clang] Deprecate -fheinous-gnu-extensions; introduce a new warning flag (PR #105821)

2024-08-23 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/105821 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] [Parser] Improve diagnostic for `friend concept` (PR #105121)

2024-08-20 Thread Shafik Yaghmour via cfe-commits
@@ -3139,6 +3139,19 @@ Parser::DeclGroupPtrTy Parser::ParseCXXClassMemberDeclaration( return Actions.BuildDeclaratorGroup(Decls); } + // Befriending a concept is invalid and would already fail if + // we did nothing here, but this allows us to issue a more + // helpf

[clang] [NFC] Replace bool <= bool comparison (PR #102948)

2024-08-20 Thread Shafik Yaghmour via cfe-commits
shafik wrote: Can we add more context to the summary i.e. "cppcheck comparisonOfBoolWithBoolError flagged the use of ..." https://github.com/llvm/llvm-project/pull/102948 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/

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

2024-08-19 Thread Shafik Yaghmour via cfe-commits
shafik wrote: Can you please add more details in your summary about the problem and how the PR will fix the problem. Having detailed summaries for got log is important. Also for the code reviewer as well, I should get a good snapshot of the problem and fix from the summary. https://github.com

[clang] [C++23] Fix infinite recursion (Clang 19.x regression) (PR #104829)

2024-08-19 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik approved this pull request. https://github.com/llvm/llvm-project/pull/104829 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [C++23] Fix infinite recursion (Clang 19.x regression) (PR #104829)

2024-08-19 Thread Shafik Yaghmour via cfe-commits
@@ -20,3 +19,29 @@ struct S : HasVT { HasD<> v; }; +// Ensure we don't get infinite recursion from the check, however. See GH104802 +namespace GH104802 { +class foo { // expected-note {{definition of 'GH104802::foo' is not complete until the closing '}'}} + foo a;

[clang] [C++23] Fix infinite recursion (Clang 19.x regression) (PR #104829)

2024-08-19 Thread Shafik Yaghmour via cfe-commits
@@ -20,3 +19,15 @@ struct S : HasVT { HasD<> v; }; +// Ensure we don't get infinite recursion from the check, however. See GH104802 +namespace GH104802 { +class foo { // expected-note {{definition of 'GH104802::foo' is not complete until the closing '}'}} + foo a;

[clang] [clang] fix divide by zero in ComplexExprEvaluator (PR #104666)

2024-08-19 Thread Shafik Yaghmour via cfe-commits
shafik wrote: For future reference the summary here is not really sufficient. Since this what usually goes in the git log they should be enough details for folks reading the git log to understand what the change was. The summary should explain the problem and provide a summary of the fix as we

[clang] [Clang] prevent assertion failure by avoiding casts on type declarations that require complete types (PR #101426)

2024-07-31 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik edited https://github.com/llvm/llvm-project/pull/101426 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] prevent assertion failure by avoiding casts on type declarations that require complete types (PR #101426)

2024-07-31 Thread Shafik Yaghmour via cfe-commits
@@ -9267,14 +9267,14 @@ bool Sema::RequireLiteralType(SourceLocation Loc, QualType T, if (!RT) return true; - const CXXRecordDecl *RD = cast(RT->getDecl()); - // A partially-defined class type can't be a literal type, because a literal // class type must have a t

[clang] [Clang] prevent assertion failure by avoiding casts on type declarations that require complete types (PR #101426)

2024-07-31 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik edited https://github.com/llvm/llvm-project/pull/101426 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] prevent assertion failure by avoiding casts on type declarations that require complete types (PR #101426)

2024-07-31 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: This looks good but you need to add a bit more details to your summary, more specifically what case caused the bug to emerge. I am also curious why this does not show up in C++, we obtain a similar diagnostic but no crash. https://github.com/llvm/llvm-pro

[clang] [clang][ExprConst] allow single element access of vector object to be constant expression (PR #101126)

2024-07-30 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: Thank you for working to get this PR finished up. I see at least two comments from the previous PR not addressed here. Please, let's try and get those addressed. @AaronBallman wanted a test to make sure we reject `&V[0]` which I don't see: https://github.c

[clang] [clang][ExprConst] allow single element access of vector object to be constant expression (PR #101126)

2024-07-30 Thread Shafik Yaghmour via cfe-commits
@@ -442,6 +446,16 @@ namespace { MostDerivedArraySize = 2; MostDerivedPathLength = Entries.size(); } + +void addVectorElementUnchecked(QualType EltTy, uint64_t Size, + uint64_t Idx) { + Entries.push_back(PathEntry::Arra

[clang] [clang][ExprConst] allow single element access of vector object to be constant expression (PR #101126)

2024-07-30 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik edited https://github.com/llvm/llvm-project/pull/101126 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][NFC] Add Type::isPointerOrReferenceType() (PR #101206)

2024-07-30 Thread Shafik Yaghmour via cfe-commits
@@ -75,7 +75,7 @@ bool Qualifiers::isStrictSupersetOf(Qualifiers Other) const { const IdentifierInfo* QualType::getBaseTypeIdentifier() const { const Type* ty = getTypePtr(); NamedDecl *ND = nullptr; - if (ty->isPointerType() || ty->isReferenceType()) + if (ty->isPointerO

[clang] [clang][NFC] Add Type::isPointerOrReferenceType() (PR #101206)

2024-07-30 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik edited https://github.com/llvm/llvm-project/pull/101206 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][NFC] Add Type::isPointerOrReferenceType() (PR #101206)

2024-07-30 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/101206 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][ASTImporter] Fix typos in trailing return testing on lambda p… (PR #101031)

2024-07-30 Thread Shafik Yaghmour via cfe-commits
shafik wrote: > Another PR would fix the crash when this one is landed. Can you land the fix for the crash first? If the other PR gets reverted it creates a lot of churn, so it would preferable to land that first. Assuming it is not somehow dependent on this fix. https://github.com/llvm/llv

[clang] [Clang] Implement P2280R4 Using unknown pointers and references in constant expressions (PR #95474)

2024-07-30 Thread Shafik Yaghmour via cfe-commits
@@ -314,53 +316,69 @@ class APValue { DataType Data; public: - APValue() : Kind(None) {} - explicit APValue(APSInt I) : Kind(None) { + bool allowConstexprUnknown() const { return AllowConstexprUnknown; } + + void setConstexprUnknown() { AllowConstexprUnknown = true; } --

[clang] [Clang] Implement P2280R4 Using unknown pointers and references in constant expressions (PR #95474)

2024-07-30 Thread Shafik Yaghmour via cfe-commits
@@ -314,53 +316,69 @@ class APValue { DataType Data; public: - APValue() : Kind(None) {} - explicit APValue(APSInt I) : Kind(None) { + bool allowConstexprUnknown() const { return AllowConstexprUnknown; } + + void setConstexprUnknown() { AllowConstexprUnknown = true; } +

[clang] [Clang] Implement P2280R4 Using unknown pointers and references in constant expressions (PR #95474)

2024-07-30 Thread Shafik Yaghmour via cfe-commits
@@ -1917,6 +1929,16 @@ APValue &CallStackFrame::createTemporary(const KeyT *Key, QualType T, return createLocal(Base, Key, T, Scope); } +APValue & +CallStackFrame::createConstexprUnknownAPValues(const VarDecl *Key, + APValue::LV

[clang] [Clang] Implement P2280R4 Using unknown pointers and references in constant expressions (PR #95474)

2024-07-30 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik updated https://github.com/llvm/llvm-project/pull/95474 >From 69b09ea5b0f0a1c5419c488ade29b6fedc6de773 Mon Sep 17 00:00:00 2001 From: Shafik Yaghmour Date: Thu, 13 Jun 2024 14:20:50 -0700 Subject: [PATCH 1/5] [Clang] Implement P2280R4 Using unknown pointers and refere

[clang] [Clang] Implement P2280R4 Using unknown pointers and references in constant expressions (PR #95474)

2024-07-29 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik updated https://github.com/llvm/llvm-project/pull/95474 >From 69b09ea5b0f0a1c5419c488ade29b6fedc6de773 Mon Sep 17 00:00:00 2001 From: Shafik Yaghmour Date: Thu, 13 Jun 2024 14:20:50 -0700 Subject: [PATCH 1/4] [Clang] Implement P2280R4 Using unknown pointers and refere

[clang] [Clang] Implement P2280R4 Using unknown pointers and references in constant expressions (PR #95474)

2024-07-29 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik updated https://github.com/llvm/llvm-project/pull/95474 >From 69b09ea5b0f0a1c5419c488ade29b6fedc6de773 Mon Sep 17 00:00:00 2001 From: Shafik Yaghmour Date: Thu, 13 Jun 2024 14:20:50 -0700 Subject: [PATCH 1/2] [Clang] Implement P2280R4 Using unknown pointers and refere

[clang] [Clang][AST] {CXXDefaultArgExpr, CXXDefaultInitExpr}::hasRewrittenInit return true iff the init expression was really rebuild (PR #99748)

2024-07-26 Thread Shafik Yaghmour via cfe-commits
@@ -1579,11 +1579,11 @@ void JSONNodeDumper::VisitMaterializeTemporaryExpr( } void JSONNodeDumper::VisitCXXDefaultArgExpr(const CXXDefaultArgExpr *Node) { - attributeOnlyIfTrue("hasRewrittenInit", Node->hasRewrittenInit()); + JOS.attribute("hasRewrittenInit", Node->hasRewrit

[clang] [Clang][AST] {CXXDefaultArgExpr, CXXDefaultInitExpr}::hasRewrittenInit return true iff the init expression was really rebuild (PR #99748)

2024-07-26 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik edited https://github.com/llvm/llvm-project/pull/99748 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][AST] {CXXDefaultArgExpr, CXXDefaultInitExpr}::hasRewrittenInit return true iff the init expression was really rebuild (PR #99748)

2024-07-26 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: The code mostly makes sense, can we update the summary to clarify the goal of this change? This is what goes in the git log and it is important this is detailed enough to understand the change w/o looking at the details of the change itself. https://github

[clang] [clang-cl] [Sema] Support MSVC non-const lvalue to user-defined temporary reference (PR #99833)

2024-07-25 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: I would like @AaronBallman to review this before committing. https://github.com/llvm/llvm-project/pull/99833 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/c

[clang] Fix #99858 (PR #99859)

2024-07-25 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: Thank you for submitting a potential fix. First of all this needs a reproducer, one to verify the existing issue and two because we need to add a test to insure we fix and three we need the rest to make sure we don't regress the fix in later releases. The

[clang] [Clang] Initializer list on RHS of assignment (PR #100548)

2024-07-25 Thread Shafik Yaghmour via cfe-commits
@@ -14578,21 +14578,51 @@ ExprResult Sema::CreateBuiltinBinOp(SourceLocation OpLoc, BinaryOperatorKind Opc, Expr *LHSExpr, Expr *RHSExpr) { if (getLangOpts().CPlusPlus11 && isa(RHSExpr)) { -// The sy

[clang] [NFC] Move RegisterBuiltinMacro function into the Preprocessor class (PR #100142)

2024-07-24 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: Seems sensible @cor3ntin wdyt? https://github.com/llvm/llvm-project/pull/100142 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Fix confusing diagnositcs related to explicit this parameters (PR #100351)

2024-07-24 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: Thank you for this PR, could please put a little more detail in the summary since that is what will be seen by folks using git log. https://github.com/llvm/llvm-project/pull/100351 ___ cfe-commits mailing list cfe-

[clang] [clang][Sema] Don't mark VarDecls of bindings in tuple-like decompositions as implicit (PR #100355)

2024-07-24 Thread Shafik Yaghmour via cfe-commits
shafik wrote: > The structure of the AST is not stable but whoever change is would have to > fix the code anyway as it's all the same project so it's a non-issue (as long > as you add sufficient test coverage) I agree relying on the AST is fine w/ sufficient testing. https://github.com/llvm/

[clang] Avoid accessing unset optional, workaround for #100095 (PR #100408)

2024-07-24 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: Can you please add a reference to https://github.com/llvm/llvm-project/issues/100095 in the summary so folks just reading the git log have more context w/o going to the commit itself. I would like to see a more flushed out long-term plan for fixing this pro

[clang] [Clang] Refactor uses of `Cand->Function` in SemaOverload.cpp (PR #98965)

2024-07-24 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik closed https://github.com/llvm/llvm-project/pull/98965 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [ExprConstant] Handle shift overflow the same way as other kinds of overflow (PR #99579)

2024-07-24 Thread Shafik Yaghmour via cfe-commits
shafik wrote: > There's some existing coverage of the affected diagnostics, which shows we > continue to produce those diagnostics... but I added a few more tests for > in-class static member variables. Thank you! https://github.com/llvm/llvm-project/pull/99579 ___

[clang] [Clang] Refactor uses of `Cand->Function` in SemaOverload.cpp (PR #98965)

2024-07-24 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/98965 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [ExprConstant] Handle shift overflow the same way as other kinds of overflow (PR #99579)

2024-07-20 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: Thank you for the additional tests, so I am not sure if the coverage is sufficient I see changed under the following diagnostic: note_constexpr_negative_shift note_constexpr_large_shift note_constexpr_lshift_of_negative note_constexpr_lshift_discards but I

[clang] [ExprConstant] Handle shift overflow the same way as other kinds of overflow (PR #99579)

2024-07-19 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: I think I am bit surprised more tests are not affected by this change considering you modified the handling in several places. It seems we should be adding more test coverage with this change. https://github.com/llvm/llvm-project/pull/99579

[clang] Fix assertion failure during conversion function overload resolution. (PR #98671)

2024-07-18 Thread Shafik Yaghmour via cfe-commits
@@ -1519,7 +1519,8 @@ bool Sema::IsAtLeastAsConstrained(NamedDecl *D1, auto IsExpectedEntity = [](const FunctionDecl *FD) { FunctionDecl::TemplatedKind Kind = FD->getTemplatedKind(); return Kind == FunctionDecl::TK_NonTemplate || - Kind == FunctionDe

[clang] [clang] Add deprecation warning for `-Ofast` driver option (PR #98736)

2024-07-17 Thread Shafik Yaghmour via cfe-commits
@@ -931,7 +931,9 @@ def O : Joined<["-"], "O">, Group, def O_flag : Flag<["-"], "O">, Visibility<[ClangOption, CC1Option, FC1Option]>, Alias, AliasArgs<["1"]>; def Ofast : Joined<["-"], "Ofast">, Group, - Visibility<[ClangOption, CC1Option, FlangOption]>; + Visibility<[Clan

[clang] [Clang] Refactor uses of `Cand->Function` in SemaOverload.cpp (PR #98965)

2024-07-17 Thread Shafik Yaghmour via cfe-commits
@@ -11846,19 +11854,21 @@ static void DiagnoseFailedEnableIfAttr(Sema &S, OverloadCandidate *Cand) { } static void DiagnoseFailedExplicitSpec(Sema &S, OverloadCandidate *Cand) { - ExplicitSpecifier ES = ExplicitSpecifier::getFromDecl(Cand->Function); + assert(Cand->Function

[clang] [Clang] Refactor uses of `Cand->Function` in SemaOverload.cpp (PR #98965)

2024-07-17 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik edited https://github.com/llvm/llvm-project/pull/98965 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Refactor uses of `Cand->Function` in SemaOverload.cpp (PR #98965)

2024-07-17 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik requested changes to this pull request. https://github.com/llvm/llvm-project/pull/98965 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Refactor uses of `Cand->Function` in SemaOverload.cpp (PR #98965)

2024-07-17 Thread Shafik Yaghmour via cfe-commits
@@ -9994,8 +9995,9 @@ Sema::AddArgumentDependentLookupCandidates(DeclarationName Name, CandEnd = CandidateSet.end(); Cand != CandEnd; ++Cand) if (Cand->Function) { - Fns.erase(Cand->Function); - if (FunctionTemplateDecl *

[clang] [Clang] Refactor uses of `Cand->Function` in SemaOverload.cpp (PR #98965)

2024-07-17 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik approved this pull request. Thank you for this refactor, just a couple of minor comments but otherwise looks good. Please fix first and then merge after it passes tests, if you need someone to merge for you please let me know. https://github.com/llvm/llvm-project/pull

[clang] [Clang] Refactor uses of `Cand->Function` in SemaOverload.cpp (PR #98965)

2024-07-17 Thread Shafik Yaghmour via cfe-commits
@@ -11846,19 +11854,21 @@ static void DiagnoseFailedEnableIfAttr(Sema &S, OverloadCandidate *Cand) { } static void DiagnoseFailedExplicitSpec(Sema &S, OverloadCandidate *Cand) { - ExplicitSpecifier ES = ExplicitSpecifier::getFromDecl(Cand->Function); + assert(Cand->Function

[clang] [Clang] Refactor uses of `Cand->Function` in SemaOverload.cpp (PR #98965)

2024-07-17 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik edited https://github.com/llvm/llvm-project/pull/98965 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Implement P2280R4 Using unknown pointers and references in constant expressions (PR #95474)

2024-07-17 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik updated https://github.com/llvm/llvm-project/pull/95474 >From 69b09ea5b0f0a1c5419c488ade29b6fedc6de773 Mon Sep 17 00:00:00 2001 From: Shafik Yaghmour Date: Thu, 13 Jun 2024 14:20:50 -0700 Subject: [PATCH] [Clang] Implement P2280R4 Using unknown pointers and references

[clang] [clang] Extend lifetime analysis to support assignments for pointer-like objects. (PR #99032)

2024-07-16 Thread Shafik Yaghmour via cfe-commits
@@ -1284,16 +1294,26 @@ void checkExprLifetime(Sema &SemaRef, const InitializedEntity &Entity, auto LTResult = getEntityLifetime(&Entity); LifetimeKind LK = LTResult.getInt(); const InitializedEntity *ExtendingEntity = LTResult.getPointer(); - checkExprLifetimeImpl(Sema

[clang] [clang] replaced the usage of `asctime` with `strftime` (PR #99075)

2024-07-16 Thread Shafik Yaghmour via cfe-commits
@@ -1722,10 +1722,12 @@ void Preprocessor::ExpandBuiltinMacro(Token &Tok) { // MSVC, ICC, GCC, VisualAge C++ extension. The generated string should be // of the form "Ddd Mmm dd hh::mm::ss ", which is returned by asctime. const char *Result; +char TimeStrin

[clang] [clang] Prevent dangling StringRefs (PR #98699)

2024-07-16 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik edited https://github.com/llvm/llvm-project/pull/98699 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Prevent dangling StringRefs (PR #98699)

2024-07-16 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: This LGTM but when someone blocks you should wait for approval before landing the change. https://github.com/llvm/llvm-project/pull/98699 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.o

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-07-13 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: Quick drive by comment https://github.com/llvm/llvm-project/pull/98788 ___ 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   >