[clang] [clang] Add test for CWG1341 (PR #67965)

2023-10-02 Thread Shafik Yaghmour via cfe-commits
shafik wrote: Thank you for the tests. https://github.com/llvm/llvm-project/pull/67965 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [libc++] Implement ranges::contains_subrange (PR #66963)

2023-10-02 Thread Shafik Yaghmour via cfe-commits
shafik wrote: Please make sure you add a description to your PR. This is what usually goes into the git log and we want those entries to be as descriptive and helpful for folks who read the git logs, thank you. https://github.com/llvm/llvm-project/pull/66963 ___

[clang] [libc++] Implement ranges::contains_subrange (PR #66963)

2023-10-02 Thread Shafik Yaghmour via cfe-commits
shafik wrote: Please make sure you add a description to your PR. This is what usually goes into the git log and we want those entries to be as descriptive and helpful for folks who read the git logs, thank you. https://github.com/llvm/llvm-project/pull/66963 ___

[clang] [clang] Add test for CWG472 (PR #67948)

2023-10-02 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: None of the implementations seem to agree with the resolution of the DR: https://godbolt.org/z/a7nEvW5Gr https://github.com/llvm/llvm-project/pull/67948 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https

[clang] [NFC][clang] change remaining context-dependent type nodes to ContextualFoldingSet (PR #67751)

2023-10-02 Thread Shafik Yaghmour via cfe-commits
shafik wrote: Thank you for improving the description. The description is usually what ends up in the git log and so it is important for that summary there to be as helpful and descriptive as possible. https://github.com/llvm/llvm-project/pull/67751 ___

[clang] [clang] Add test for CWG2267 (PR #67931)

2023-10-02 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/67931 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [Clang] Fix crash when ill-formed code is treated as a deduction guide (PR #67373)

2023-10-02 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik closed https://github.com/llvm/llvm-project/pull/67373 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][ExprConst] Fix crash on uninitialized array subobject (PR #67817)

2023-10-01 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: I am a bit concerned we don't fully understand how to recover the old diagnostic. I left a comment that I think may help but I think we need to understand this a bit better before committing to a fix. https://github.com/llvm/llvm-project/pull/67817

[clang] [clang][ExprConst] Fix crash on uninitialized array subobject (PR #67817)

2023-10-01 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik edited https://github.com/llvm/llvm-project/pull/67817 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][ExprConst] Fix crash on uninitialized array subobject (PR #67817)

2023-10-01 Thread Shafik Yaghmour via cfe-commits
@@ -2411,10 +2411,15 @@ static bool CheckEvaluationResult(CheckEvaluationResultKind CERK, const FieldDecl *SubobjectDecl, CheckedTemporaries &CheckedTemps) { if (!Value.hasValue()) { -assert(SubobjectDec

[clang-tools-extra] [Support] Add KnownBits::computeForSubBorrow (PR #67788)

2023-10-01 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik edited https://github.com/llvm/llvm-project/pull/67788 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Support] Add KnownBits::computeForSubBorrow (PR #67788)

2023-10-01 Thread Shafik Yaghmour via cfe-commits
@@ -85,6 +85,18 @@ KnownBits KnownBits::computeForAddSub(bool Add, bool NSW, return KnownOut; } +KnownBits KnownBits::computeForSubBorrow(const KnownBits &LHS, KnownBits RHS, + const KnownBits &Borrow) { + assert(Borrow.getBitWidth()

[clang] [Clang] Add __datasizeof (PR #67805)

2023-10-01 Thread Shafik Yaghmour via cfe-commits
@@ -0,0 +1,34 @@ +// RUN: %clang_cc1 -fsyntax-only -triple x86_64-linux-gnu -verify %s shafik wrote: Maybe we should add tests to show parallels with `sizeof` e.g` *void* types and incomplete types. Also w/o parens etc https://github.com/llvm/llvm-project/pu

[clang] [Clang] Add __datasizeof (PR #67805)

2023-10-01 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: Looks good but Aaron should look at it as well. https://github.com/llvm/llvm-project/pull/67805 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Add __datasizeof (PR #67805)

2023-10-01 Thread Shafik Yaghmour via cfe-commits
@@ -5038,19 +5039,19 @@ void CXXNameMangler::mangleExpression(const Expr *E, unsigned Arity, Out << 'a'; MangleAlignofSizeofArg(); break; +case UETT_DataSizeOf: { + Context.getDiags().Report(diag::err_cannot_mangle_expression) + << "__datasi

[clang] [Clang] Add __datasizeof (PR #67805)

2023-10-01 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik edited https://github.com/llvm/llvm-project/pull/67805 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [NFC][clang] change remaining context-dependent type nodes to ContextualFoldingSet (PR #67751)

2023-10-01 Thread Shafik Yaghmour via cfe-commits
shafik wrote: Thank you for the PR. Could you provide some context in the PR description? From the title it sounds like there were prior changes that this is finishing. It would be helpful to have a link to those prior changes. https://github.com/llvm/llvm-project/pull/67751 __

[clang] [Clang] Fix crash when ill-formed code is treated as a deduction guide (PR #67373)

2023-09-30 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik updated https://github.com/llvm/llvm-project/pull/67373 >From beab5db738483795ecb0bace2842acdbb1c9869a Mon Sep 17 00:00:00 2001 From: Shafik Yaghmour Date: Mon, 25 Sep 2023 13:56:43 -0700 Subject: [PATCH 1/2] [Clang] Fix crash when ill-formed code is treated as a dedu

[clang] [clang][Interp] Handle CXXScalarValueInitExprs (PR #67147)

2023-09-29 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik approved this pull request. https://github.com/llvm/llvm-project/pull/67147 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][Interp] Handle CXXScalarValueInitExprs (PR #67147)

2023-09-29 Thread Shafik Yaghmour via cfe-commits
@@ -31,6 +31,33 @@ static_assert(b, ""); constexpr int one = true; static_assert(one == 1, ""); +constexpr bool b2 = bool(); +static_assert(!b2, ""); + +namespace ScalarTypes { + constexpr int ScalarInitInt = int(); + static_assert(ScalarInitInt == 0, ""); + constexpr float

[clang] [clang][Interp] Handle CXXScalarValueInitExprs (PR #67147)

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

[clang] [clang][Interp] Fix returning nullptr from functions (PR #67229)

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

[clang] [clang][Interp] Fix returning nullptr from functions (PR #67229)

2023-09-29 Thread Shafik Yaghmour via cfe-commits
@@ -209,7 +209,7 @@ bool Ret(InterpState &S, CodePtr &PC, APValue &Result) { // FIXME: We could be calling isLive() here, but the emitted diagnostics // seem a little weird, at least if the returned expression is of // pointer type. shafik wrote: C

[clang] [clang][Interp] Fix returning nullptr from functions (PR #67229)

2023-09-29 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/67229 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][Interp] Fix returning nullptr from functions (PR #67229)

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

[clang] [clang][Interp] Zero-init remaining string literal elements (PR #66862)

2023-09-29 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik approved this pull request. https://github.com/llvm/llvm-project/pull/66862 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Fix a crash from nested ArrayInitLoopExpr (PR #67722)

2023-09-29 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: Apologies for the post commit review, just have one question. https://github.com/llvm/llvm-project/pull/67722 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/c

[clang] [clang] Fix a crash from nested ArrayInitLoopExpr (PR #67722)

2023-09-29 Thread Shafik Yaghmour via cfe-commits
@@ -10977,6 +10987,9 @@ bool ArrayExprEvaluator::VisitArrayInitLoopExpr(const ArrayInitLoopExpr *E) { return false; Success = false; } + +// Make sure we run the destructors too. +Scope.destroy(); shafik wrote: So we don't have to ch

[clang] [clang] Fix a crash from nested ArrayInitLoopExpr (PR #67722)

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

[clang] [Clang] Fix crash when ill-formed code is treated as a deduction guide (PR #67373)

2023-09-29 Thread Shafik Yaghmour via cfe-commits
shafik wrote: ping https://github.com/llvm/llvm-project/pull/67373 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [Clang] Fix crash when ill-formed code is treated as a deduction guide (PR #67373)

2023-09-29 Thread Shafik Yaghmour via cfe-commits
shafik wrote: ping https://github.com/llvm/llvm-project/pull/67373 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [Clang] Fix crash when ill-formed code is treated as a deduction guide (PR #67373)

2023-09-29 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik updated https://github.com/llvm/llvm-project/pull/67373 >From beab5db738483795ecb0bace2842acdbb1c9869a Mon Sep 17 00:00:00 2001 From: Shafik Yaghmour Date: Mon, 25 Sep 2023 13:56:43 -0700 Subject: [PATCH] [Clang] Fix crash when ill-formed code is treated as a deductio

[clang-tools-extra] [Clang] Fix crash when ill-formed code is treated as a deduction guide (PR #67373)

2023-09-29 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik updated https://github.com/llvm/llvm-project/pull/67373 >From beab5db738483795ecb0bace2842acdbb1c9869a Mon Sep 17 00:00:00 2001 From: Shafik Yaghmour Date: Mon, 25 Sep 2023 13:56:43 -0700 Subject: [PATCH] [Clang] Fix crash when ill-formed code is treated as a deductio

[clang] [clang] implement common sugared type of inst-dependent DecltypeType (PR #67739)

2023-09-28 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik approved this pull request. Thank you for the quick fix. LGTM, please add a release note. https://github.com/llvm/llvm-project/pull/67739 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/

[clang] [clang] Fix a crash from nested ArrayInitLoopExpr (PR #67722)

2023-09-28 Thread Shafik Yaghmour via cfe-commits
shafik wrote: Thank you for the fix! I don't think I understand the bug based on your description. You say >the reason is that after evaluating the first iteration, we note a failure and >would return, however during analyzing the second snippet You start saying *first iteration* and then r

[clang-tools-extra] [Clang] Fix crash when visting a fold expression in a default argument (PR #67514)

2023-09-28 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik closed https://github.com/llvm/llvm-project/pull/67514 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[libunwind] [Clang] Fix crash when visting a fold expression in a default argument (PR #67514)

2023-09-28 Thread Shafik Yaghmour via cfe-commits
shafik wrote: I am going to merge this because I was informed that libc++ build is triggered unnecessarily because I merged main into my branch. https://github.com/llvm/llvm-project/pull/67514 ___ cfe-commits mailing list cfe-commits@lists.llvm.org ht

[clang] [clang][Interp] Zero-init remaining string literal elements (PR #66862)

2023-09-28 Thread Shafik Yaghmour via cfe-commits
@@ -350,3 +350,22 @@ namespace ZeroInit { static_assert(b.f[0] == 0.0, ""); static_assert(b.f[1] == 0.0, ""); } + +namespace StringZeroFill { + struct A { +char c[12]; + }; + constexpr A a = { "abc" }; + static_assert(a.c[0] == 'a', ""); + static_assert(a.c[1] == '

[clang] [clang][Interp] Zero-init remaining string literal elements (PR #66862)

2023-09-28 Thread Shafik Yaghmour via cfe-commits
@@ -350,3 +350,22 @@ namespace ZeroInit { static_assert(b.f[0] == 0.0, ""); static_assert(b.f[1] == 0.0, ""); } + +namespace StringZeroFill { + struct A { +char c[12]; + }; + constexpr A a = { "abc" }; + static_assert(a.c[0] == 'a', ""); + static_assert(a.c[1] == '

[clang] [clang][Interp] Zero-init remaining string literal elements (PR #66862)

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

[clang] [clang][Interp] Zero-init remaining string literal elements (PR #66862)

2023-09-28 Thread Shafik Yaghmour via cfe-commits
@@ -858,8 +858,8 @@ bool ByteCodeExprGen::VisitStringLiteral(const StringLiteral *E) { // If the initializer string is too long, a diagnostic has already been // emitted. Read only the array length from the string literal. - unsigned N = - std::min(unsigned(CAT->get

[clang] [clang][Interp] Zero-init remaining string literal elements (PR #66862)

2023-09-28 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: Minor comments on testing but I am curious about the size question. https://github.com/llvm/llvm-project/pull/66862 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/list

[libunwind] [Clang] Fix crash when visting a fold expression in a default argument (PR #67514)

2023-09-28 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik updated https://github.com/llvm/llvm-project/pull/67514 >From e2e0e10e13748ba9369b73c7547c035ee75dfffa Mon Sep 17 00:00:00 2001 From: Shafik Yaghmour Date: Tue, 26 Sep 2023 18:55:44 -0700 Subject: [PATCH] [Clang] Fix crash when visting a fold expression in a default a

[clang-tools-extra] [Clang] Fix crash when visting a fold expression in a default argument (PR #67514)

2023-09-28 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik updated https://github.com/llvm/llvm-project/pull/67514 >From e2e0e10e13748ba9369b73c7547c035ee75dfffa Mon Sep 17 00:00:00 2001 From: Shafik Yaghmour Date: Tue, 26 Sep 2023 18:55:44 -0700 Subject: [PATCH] [Clang] Fix crash when visting a fold expression in a default a

[clang] [Clang] Fix crash when visting a fold expression in a default argument (PR #67514)

2023-09-27 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik updated https://github.com/llvm/llvm-project/pull/67514 >From e2e0e10e13748ba9369b73c7547c035ee75dfffa Mon Sep 17 00:00:00 2001 From: Shafik Yaghmour Date: Tue, 26 Sep 2023 18:55:44 -0700 Subject: [PATCH] [Clang] Fix crash when visting a fold expression in a default a

[clang] [Clang] Handle sema of noexcept condition in their evaluation context. (PR #67538)

2023-09-27 Thread Shafik Yaghmour via cfe-commits
shafik wrote: I wonder does this also fix this: https://github.com/llvm/llvm-project/issues/67058 https://github.com/llvm/llvm-project/pull/67538 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/c

[clang] [Clang] Handle consteval expression in array bounds expressions (PR #66222)

2023-09-27 Thread Shafik Yaghmour via cfe-commits
@@ -15090,8 +15093,9 @@ static void CheckImplicitConversion(Sema &S, Expr *E, QualType T, if (SourceBT && TargetBT && SourceBT->isIntegerType() && TargetBT->isFloatingType() && !IsListInit) { // Determine the number of precision bits in the source integer type. -

[clang] [Clang] Handle consteval expression in array bounds expressions (PR #66222)

2023-09-27 Thread Shafik Yaghmour via cfe-commits
@@ -5490,6 +5490,9 @@ TreeTransform::TransformDependentSizedArrayType(TypeLocBuilder &TLB, EnterExpressionEvaluationContext Unevaluated( SemaRef, Sema::ExpressionEvaluationContext::ConstantEvaluated); + // VLA bounds are not truly constant. shafik wr

[clang] [Clang] Fix crash when visting a fold expression in a default argument (PR #67514)

2023-09-26 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik created https://github.com/llvm/llvm-project/pull/67514 CheckDefaultArgumentVisitor::Visit(...) assumes that the children of Expr will not be NULL. This is not a valid assumption and when we have a CXXFoldExpr the children can be NULL and this causes a crash. Fixes:

[clang-tools-extra] [libcxx] Allow string to use SSO in constant evaluation. (PR #66576)

2023-09-26 Thread Shafik Yaghmour via cfe-commits
@@ -0,0 +1,22 @@ +//===--===// +// +// 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: Apac

[clang] [libcxx] Allow string to use SSO in constant evaluation. (PR #66576)

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

[clang-tools-extra] [libcxx] Allow string to use SSO in constant evaluation. (PR #66576)

2023-09-26 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: I think this is fine but I agree we should have a compat warning for this and I would like to see more testing as well. https://github.com/llvm/llvm-project/pull/66576 ___ cfe-commits mailing list cfe-commits@lists

[clang-tools-extra] [libcxx] Allow string to use SSO in constant evaluation. (PR #66576)

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

[clang] [Clang] Fix crash when ill-formed code is treated as a deduction guide (PR #67373)

2023-09-26 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik resolved https://github.com/llvm/llvm-project/pull/67373 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Fix crash when ill-formed code is treated as a deduction guide (PR #67373)

2023-09-26 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik resolved https://github.com/llvm/llvm-project/pull/67373 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Fix crash when ill-formed code is treated as a deduction guide (PR #67373)

2023-09-26 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik updated https://github.com/llvm/llvm-project/pull/67373 >From beab5db738483795ecb0bace2842acdbb1c9869a Mon Sep 17 00:00:00 2001 From: Shafik Yaghmour Date: Mon, 25 Sep 2023 13:56:43 -0700 Subject: [PATCH] [Clang] Fix crash when ill-formed code is treated as a deductio

[clang] [Clang] Fix crash when ill-formed code is treated as a deduction guide (PR #67373)

2023-09-25 Thread Shafik Yaghmour via cfe-commits
@@ -171,3 +171,12 @@ namespace CtorTemplateBeatsNonTemplateConversionFn { Foo f(Derived d) { return d; } // expected-error {{invokes a deleted function}} Foo g(Derived d) { return Foo(d); } // ok, calls constructor } + +namespace GH65522 { +template +class B3 : A3 { + tem

[clang] [Clang] Fix crash when ill-formed code is treated as a deduction guide (PR #67373)

2023-09-25 Thread Shafik Yaghmour via cfe-commits
shafik wrote: I was originally going to roll-up this fix as part of: https://reviews.llvm.org/D148474 but it felt distinct enough to fix on its own and then rebase the other PR afterwards. https://github.com/llvm/llvm-project/pull/67373 ___ cfe-commi

[clang] [Clang] Fix crash when ill-formed code is treated as a deduction guide (PR #67373)

2023-09-25 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik created https://github.com/llvm/llvm-project/pull/67373 In some cases where ill-formed code could be interpreted as a deduction guide we can crash because we reach an unreachable path. This fixes this issue by introducing a diagnostic instead. Fixes: https://github.c

[clang] Diagnose problematic uses of constructor/destructor attribute (PR #67360)

2023-09-25 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: Should they be valid for `constexpr` functions? https://github.com/llvm/llvm-project/pull/67360 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Diagnose problematic uses of constructor/destructor attribute (PR #67360)

2023-09-25 Thread Shafik Yaghmour via cfe-commits
@@ -2352,26 +2352,61 @@ static void handleUnusedAttr(Sema &S, Decl *D, const ParsedAttr &AL) { D->addAttr(::new (S.Context) UnusedAttr(S.Context, AL)); } -static void handleConstructorAttr(Sema &S, Decl *D, const ParsedAttr &AL) { - uint32_t priority = ConstructorAttr::Def

[clang] Diagnose problematic uses of constructor/destructor attribute (PR #67360)

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

[clang] [Clang] Fix CXXRewrittenBinaryOperator::getDecomposedForm to handle case when spaceship operator returns comparison category by reference (PR #66270)

2023-09-25 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik closed https://github.com/llvm/llvm-project/pull/66270 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Fix CXXRewrittenBinaryOperator::getDecomposedForm to handle case when spaceship operator returns comparison category by reference (PR #66270)

2023-09-25 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik updated https://github.com/llvm/llvm-project/pull/66270 >From b934841d7fc3d3447b23a9718a38742943f76916 Mon Sep 17 00:00:00 2001 From: Shafik Yaghmour Date: Wed, 13 Sep 2023 11:09:28 -0700 Subject: [PATCH 1/3] [Clang] Fix CXXRewrittenBinaryOperator::getDecomposedForm t

[clang-tools-extra] [Clang] Fix CXXRewrittenBinaryOperator::getDecomposedForm to handle case when spaceship operator returns comparison category by reference (PR #66270)

2023-09-25 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik updated https://github.com/llvm/llvm-project/pull/66270 >From b934841d7fc3d3447b23a9718a38742943f76916 Mon Sep 17 00:00:00 2001 From: Shafik Yaghmour Date: Wed, 13 Sep 2023 11:09:28 -0700 Subject: [PATCH 1/2] [Clang] Fix CXXRewrittenBinaryOperator::getDecomposedForm t

[clang] [Clang] Fix CXXRewrittenBinaryOperator::getDecomposedForm to handle case when spaceship operator returns comparison category by reference (PR #66270)

2023-09-25 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik updated https://github.com/llvm/llvm-project/pull/66270 >From b934841d7fc3d3447b23a9718a38742943f76916 Mon Sep 17 00:00:00 2001 From: Shafik Yaghmour Date: Wed, 13 Sep 2023 11:09:28 -0700 Subject: [PATCH 1/2] [Clang] Fix CXXRewrittenBinaryOperator::getDecomposedForm t

[clang] [clang][Interp] Handle CXXScalarValueInitExprs (PR #67147)

2023-09-23 Thread Shafik Yaghmour via cfe-commits
Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: https://github.com/shafik edited https://github.com/llvm/llvm-project/pull/67147 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][Interp] Handle CXXScalarValueInitExprs (PR #67147)

2023-09-23 Thread Shafik Yaghmour via cfe-commits
Timm =?utf-8?q?B=C3=A4der?= Message-ID: In-Reply-To: https://github.com/shafik commented: Thank you for the additions, almost there :-) https://github.com/llvm/llvm-project/pull/67147 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://l

[clang] [clang][Interp] Handle CXXScalarValueInitExprs (PR #67147)

2023-09-23 Thread Shafik Yaghmour via cfe-commits
Timm =?utf-8?q?B=C3=A4der?= Message-ID: In-Reply-To: @@ -31,6 +31,28 @@ static_assert(b, ""); constexpr int one = true; static_assert(one == 1, ""); +constexpr bool b2 = bool(); +static_assert(!b2, ""); + +namespace ScalarTypes { + constexpr int ScalarInitInt = int(); + s

[clang] [clang][Interp] Handle CXXScalarValueInitExprs (PR #67147)

2023-09-22 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: Looks good but I want more tests. https://github.com/llvm/llvm-project/pull/67147 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][Interp] Handle CXXScalarValueInitExprs (PR #67147)

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

[clang] [clang][Interp] Handle CXXScalarValueInitExprs (PR #67147)

2023-09-22 Thread Shafik Yaghmour via cfe-commits
@@ -31,6 +31,13 @@ static_assert(b, ""); constexpr int one = true; static_assert(one == 1, ""); +constexpr bool b2 = bool(); shafik wrote: There are a lot of scalars: https://eel.is/c++draft/basic.types.general#9 Can we have a test for each case? https://gi

[clang] [clang] Turn -Wenum-constexpr-conversion into a hard error (PR #67170)

2023-09-22 Thread Shafik Yaghmour via cfe-commits
shafik wrote: This change is a lot more involved, this is on my list of things to do. See the discussion here: https://reviews.llvm.org/D150226 https://github.com/llvm/llvm-project/pull/67170 ___ cfe-commits mailing list cfe-commits@lists.llvm.org h

[clang] [clang][Sema] Fix crash introduced in b2cd9db589335d5885c04df83003a623cf2f05ff (PR #66954)

2023-09-20 Thread Shafik Yaghmour via cfe-commits
shafik wrote: Thanks for the quick fix! https://github.com/llvm/llvm-project/pull/66954 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Implement [[msvc::no_unique_address]] (PR #65675)

2023-09-19 Thread Shafik Yaghmour via cfe-commits
@@ -3317,6 +3353,7 @@ ASTContext::getASTRecordLayout(const RecordDecl *D) const { Builder.EndsWithZeroSizedObject, Builder.LeadsWithZeroSizedBase, Builder.Bases, Builder.VBases); } else { + MicrosoftRecordLayoutBuilder Builder(*this, /*EmptySubobje

[clang] Implement [[msvc::no_unique_address]] (PR #65675)

2023-09-19 Thread Shafik Yaghmour via cfe-commits
@@ -3317,6 +3353,7 @@ ASTContext::getASTRecordLayout(const RecordDecl *D) const { Builder.EndsWithZeroSizedObject, Builder.LeadsWithZeroSizedBase, Builder.Bases, Builder.VBases); } else { + MicrosoftRecordLayoutBuilder Builder(*this, /*EmptySubobje

[clang-tools-extra] [clang] remove ClassScopeFunctionSpecializationDecl (PR #66636)

2023-09-18 Thread Shafik Yaghmour via cfe-commits
@@ -4086,7 +4073,7 @@ FunctionDecl *Sema::SubstSpaceshipAsEqualEqual(CXXRecordDecl *RD, Decl *R; if (auto *MD = dyn_cast(Spaceship)) { R = Instantiator.VisitCXXMethodDecl( -MD, nullptr, std::nullopt, +MD, nullptr, shafik wrote: To be c

[clang] [clang] remove ClassScopeFunctionSpecializationDecl (PR #66636)

2023-09-18 Thread Shafik Yaghmour via cfe-commits
@@ -4086,7 +4073,7 @@ FunctionDecl *Sema::SubstSpaceshipAsEqualEqual(CXXRecordDecl *RD, Decl *R; if (auto *MD = dyn_cast(Spaceship)) { R = Instantiator.VisitCXXMethodDecl( -MD, nullptr, std::nullopt, +MD, nullptr, shafik wrote: ```sugg

[clang] [clang] remove ClassScopeFunctionSpecializationDecl (PR #66636)

2023-09-18 Thread Shafik Yaghmour via cfe-commits
@@ -650,17 +642,16 @@ void ASTDeclWriter::VisitFunctionDecl(FunctionDecl *D) { DependentFunctionTemplateSpecializationInfo * DFTSInfo = D->getDependentSpecializationInfo(); -// Templates. -Record.push_back(DFTSInfo->getNumTemplates()); -for (int i=0, e =

[clang-tools-extra] [clang] remove ClassScopeFunctionSpecializationDecl (PR #66636)

2023-09-18 Thread Shafik Yaghmour via cfe-commits
@@ -1016,21 +1003,20 @@ void ASTDeclReader::VisitFunctionDecl(FunctionDecl *FD) { } case FunctionDecl::TK_DependentFunctionTemplateSpecialization: { // Templates. -UnresolvedSet<8> TemplDecls; -unsigned NumTemplates = Record.readInt(); -while (NumTemplates-

[clang-tools-extra] [clang] remove ClassScopeFunctionSpecializationDecl (PR #66636)

2023-09-18 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: Mostly minor fixes and or questions. https://github.com/llvm/llvm-project/pull/66636 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] remove ClassScopeFunctionSpecializationDecl (PR #66636)

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

[clang] [clang] Fix null dereference on return in lambda attribute statement expr (PR #66643)

2023-09-18 Thread Shafik Yaghmour via cfe-commits
shafik wrote: LGTM https://github.com/llvm/llvm-project/pull/66643 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Introduce paged vector (PR #66430)

2023-09-15 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: Thank you for this contributions, I just have one comment so far on testing. We should make sure any new ADT is very well tested before landing it. https://github.com/llvm/llvm-project/pull/66430 ___ cfe-commits m

[clang] Introduce paged vector (PR #66430)

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

[clang] Introduce paged vector (PR #66430)

2023-09-15 Thread Shafik Yaghmour via cfe-commits
@@ -0,0 +1,84 @@ +//===- llvm/unittest/ADT/PagedVectorTest.cpp --===// +// +// 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: Apa

[clang] [clang][doc] Add documentation for the ASTs used to represent C++ templates (PR #66436)

2023-09-14 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik review_requested https://github.com/llvm/llvm-project/pull/66436 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][doc] Add documentation for the ASTs used to represent C++ templates (PR #66436)

2023-09-14 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik review_requested https://github.com/llvm/llvm-project/pull/66436 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][doc] Add documentation for the ASTs used to represent C++ templates (PR #66436)

2023-09-14 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik review_requested https://github.com/llvm/llvm-project/pull/66436 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Fix wrong warning about missing init for flexible array members (PR #66341)

2023-09-14 Thread Shafik Yaghmour via cfe-commits
shafik wrote: Thank you for the quick fix https://github.com/llvm/llvm-project/pull/66341 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Fix CXXRewrittenBinaryOperator::getDecomposedForm to handle case when spaceship operator returns comparison category by reference (PR #66270)

2023-09-14 Thread Shafik Yaghmour via cfe-commits
shafik wrote: > Perhaps it needs a release note? You would think I would remember this by now. https://github.com/llvm/llvm-project/pull/66270 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-

[clang] [Clang] Fix CXXRewrittenBinaryOperator::getDecomposedForm to handle case when spaceship operator returns comparison category by reference (PR #66270)

2023-09-14 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik updated https://github.com/llvm/llvm-project/pull/66270: >From b934841d7fc3d3447b23a9718a38742943f76916 Mon Sep 17 00:00:00 2001 From: Shafik Yaghmour Date: Wed, 13 Sep 2023 11:09:28 -0700 Subject: [PATCH 1/2] [Clang] Fix CXXRewrittenBinaryOperator::getDecomposedForm

[clang] [Clang] Handle consteval expression in array bounds expressions (PR #66222)

2023-09-13 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik review_requested https://github.com/llvm/llvm-project/pull/66222 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Handle consteval expression in array bounds expressions (PR #66222)

2023-09-13 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: If the function is `constexpr` do we treat it as a VLA? https://github.com/llvm/llvm-project/pull/66222 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-co

[clang] [Clang] Handle consteval expression in array bounds expressions (PR #66222)

2023-09-13 Thread Shafik Yaghmour via cfe-commits
@@ -9843,30 +9833,44 @@ class Sema final { /// diagnostics that will be suppressed. std::optional isSFINAEContext() const; - /// Determines whether we are currently in a context that - /// is not evaluated as per C++ [expr] p5. - bool isUnevaluatedContext() const { + /

[clang] [Clang] Handle consteval expression in array bounds expressions (PR #66222)

2023-09-13 Thread Shafik Yaghmour via cfe-commits
@@ -13928,7 +13930,7 @@ static bool CheckTautologicalComparison(Sema &S, BinaryOperator *E, return false; IntRange OtherValueRange = GetExprRange( - S.Context, Other, S.isConstantEvaluated(), /*Approximate*/ false); + S.Context, Other, S.isConstantEvaluatedCon

[clang] [Clang] Handle consteval expression in array bounds expressions (PR #66222)

2023-09-13 Thread Shafik Yaghmour via cfe-commits
@@ -13928,7 +13930,7 @@ static bool CheckTautologicalComparison(Sema &S, BinaryOperator *E, return false; IntRange OtherValueRange = GetExprRange( - S.Context, Other, S.isConstantEvaluated(), /*Approximate*/ false); + S.Context, Other, S.isConstantEvaluatedCon

[clang] [Clang] Handle consteval expression in array bounds expressions (PR #66222)

2023-09-13 Thread Shafik Yaghmour via cfe-commits
@@ -14143,8 +14145,9 @@ static void AnalyzeComparison(Sema &S, BinaryOperator *E) { } // Otherwise, calculate the effective range of the signed operand. - IntRange signedRange = GetExprRange( - S.Context, signedOperand, S.isConstantEvaluated(), /*Approximate*/ true)

[clang] [Clang] Handle consteval expression in array bounds expressions (PR #66222)

2023-09-13 Thread Shafik Yaghmour via cfe-commits
@@ -15159,16 +15163,16 @@ static void CheckImplicitConversion(Sema &S, Expr *E, QualType T, IntRange SourceTypeRange = IntRange::forTargetOfCanonicalType(S.Context, Source); - IntRange LikelySourceRange = - GetExprRange(S.Context, E, S.isConstantEvaluated(), /*A

[clang] [Clang] Handle consteval expression in array bounds expressions (PR #66222)

2023-09-13 Thread Shafik Yaghmour via cfe-commits
@@ -15090,8 +15093,9 @@ static void CheckImplicitConversion(Sema &S, Expr *E, QualType T, if (SourceBT && TargetBT && SourceBT->isIntegerType() && TargetBT->isFloatingType() && !IsListInit) { // Determine the number of precision bits in the source integer type. -

<    1   2   3   4   5   6   7   >