https://github.com/cor3ntin closed
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
https://github.com/cor3ntin updated
https://github.com/llvm/llvm-project/pull/66222
>From dc95c839c104a0af50da1466e7249bde306bd662 Mon Sep 17 00:00:00 2001
From: Corentin Jabot
Date: Wed, 13 Sep 2023 17:36:39 +0200
Subject: [PATCH 1/8] [Clang] Handle consteval expression in array bounds
expres
@@ -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.
-
@@ -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)
https://github.com/shafik approved this pull request.
LGTM after fixing nits.
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
https://github.com/shafik edited 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
cor3ntin wrote:
@shafik ping!
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
https://github.com/erichkeane commented:
Still OK with this, but Shafik should do the final approval.
https://github.com/llvm/llvm-project/pull/66222
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinf
https://github.com/cor3ntin updated
https://github.com/llvm/llvm-project/pull/66222
>From b2475193769051ae4d0c340237fd5df76dfe8c49 Mon Sep 17 00:00:00 2001
From: Corentin Jabot
Date: Wed, 13 Sep 2023 17:36:39 +0200
Subject: [PATCH 1/6] [Clang] Handle consteval expression in array bounds
expres
@@ -221,6 +221,15 @@ ExprResult Parser::ParseConstantExpression() {
return ParseConstantExpressionInExprEvalContext(NotTypeCast);
}
+ExprResult Parser::ParseArrayBoundExpression() {
+ EnterExpressionEvaluationContext ConstantEvaluated(
+ Actions, Sema::ExpressionEvalua
https://github.com/cor3ntin updated
https://github.com/llvm/llvm-project/pull/66222
>From 57d48220f38507657b6b25c887cd4adf1f5008b3 Mon Sep 17 00:00:00 2001
From: Corentin Jabot
Date: Wed, 13 Sep 2023 17:36:39 +0200
Subject: [PATCH 1/6] [Clang] Handle consteval expression in array bounds
expres
@@ -221,6 +221,15 @@ ExprResult Parser::ParseConstantExpression() {
return ParseConstantExpressionInExprEvalContext(NotTypeCast);
}
+ExprResult Parser::ParseArrayBoundExpression() {
+ EnterExpressionEvaluationContext ConstantEvaluated(
+ Actions, Sema::ExpressionEvalua
https://github.com/erichkeane edited
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
@@ -221,6 +221,15 @@ ExprResult Parser::ParseConstantExpression() {
return ParseConstantExpressionInExprEvalContext(NotTypeCast);
}
+ExprResult Parser::ParseArrayBoundExpression() {
+ EnterExpressionEvaluationContext ConstantEvaluated(
+ Actions, Sema::ExpressionEvalua
https://github.com/erichkeane commented:
I think this generally makes a lot of sense, I have 1 nit (plus a bunch of the
'bool' comments without the = sign that @shafik suggested, but were closed
without comment), otherwise LGTM.
https://github.com/llvm/llvm-project/pull/66222
_
@@ -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.
-
@@ -5490,6 +5490,9 @@
TreeTransform::TransformDependentSizedArrayType(TypeLocBuilder &TLB,
EnterExpressionEvaluationContext Unevaluated(
SemaRef, Sema::ExpressionEvaluationContext::ConstantEvaluated);
+ // VLA bounds are not truly constant.
shafik wr
https://github.com/cor3ntin updated
https://github.com/llvm/llvm-project/pull/66222
>From 57d48220f38507657b6b25c887cd4adf1f5008b3 Mon Sep 17 00:00:00 2001
From: Corentin Jabot
Date: Wed, 13 Sep 2023 17:36:39 +0200
Subject: [PATCH 1/5] [Clang] Handle consteval expression in array bounds
expres
https://github.com/cor3ntin updated
https://github.com/llvm/llvm-project/pull/66222
>From 57d48220f38507657b6b25c887cd4adf1f5008b3 Mon Sep 17 00:00:00 2001
From: Corentin Jabot
Date: Wed, 13 Sep 2023 17:36:39 +0200
Subject: [PATCH 1/4] [Clang] Handle consteval expression in array bounds
expres
https://github.com/cor3ntin updated
https://github.com/llvm/llvm-project/pull/66222
>From 57d48220f38507657b6b25c887cd4adf1f5008b3 Mon Sep 17 00:00:00 2001
From: Corentin Jabot
Date: Wed, 13 Sep 2023 17:36:39 +0200
Subject: [PATCH 1/3] [Clang] Handle consteval expression in array bounds
expres
github-actions[bot] wrote:
:warning: C/C++ code formatter, clang-format found issues in your code.
:warning:
You can test this locally with the following command:
``bash
git-clang-format --diff b26157edf08184f2620b3df95048a97a1658c021
4b62211b22950a9bdd3764093f6716d0f792469e --
https://github.com/cor3ntin updated
https://github.com/llvm/llvm-project/pull/66222
>From 44867abb2e1c0c34963229ec93b0d1d71aa33db5 Mon Sep 17 00:00:00 2001
From: Corentin Jabot
Date: Wed, 13 Sep 2023 17:36:39 +0200
Subject: [PATCH 1/3] [Clang] Handle consteval expression in array bounds
expres
hazohelet wrote:
> I'll add a test. immediate contexts are recursive, constant evaluated
> contexts are not, i don't think there is a case where you would get an
> additional evaluation context that is not for a full expression, and if you
> have a full expression you do expect the immediate i
cor3ntin wrote:
> My patch needs modification so that use of `is_constant_evaluated` and
> consteval-if NOT considered tautologically-true when they happen
> `InConditionallyConstantEvaluateContext`, which is a few lines of change.
Hum, maybe to do that we need to set ahead of time whether we
hazohelet wrote:
> Where do you think it matters? I can't this of cases where ConstantEvaluated
> context are nested in one another without some intertwined potentially
> evaluated context
I was mostly thinking about cases where the array-bound expression appears
inside immediate function con
cor3ntin wrote:
> Is it alright to set `InConditionallyConstantEvaluateContext` true only when
> the outer evaluation context `isAlwaysConstantEvaluatedContext()` so that we
> can say the array bound expr is always constant-evaluated if it happens in
> always-constant-evaluated context?
Where
hazohelet wrote:
> @hazohelet Does this collide or intersect with the work wrt. (un)evaluated
> contexts in https://reviews.llvm.org/D155064 ?
I wasn't aware of VLA cases in that patch.
My patch needs modification so that use of `is_constant_evaluated` and
consteval-if NOT considered tautologi
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
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
@@ -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 {
+ /
@@ -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
@@ -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
@@ -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)
@@ -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
@@ -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.
-
tbaederr wrote:
@hazohelet Does this collide or intersect with the work wrt. (un)evaluated
contexts in https://reviews.llvm.org/D155064 ?
https://github.com/llvm/llvm-project/pull/66222
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://l
https://github.com/cor3ntin updated
https://github.com/llvm/llvm-project/pull/66222:
>From d7f281ed8809d991393de0c922fd08a0d657d863 Mon Sep 17 00:00:00 2001
From: Corentin Jabot
Date: Wed, 13 Sep 2023 17:36:39 +0200
Subject: [PATCH] [Clang] Handle consteval expression in array bounds
expressio
llvmbot wrote:
@llvm/pr-subscribers-clang
Changes
The bounds of a c++ array is a _constant-expression_. And in C++ it is also a
constant expression.
But we also support VLAs, ie arrays with non-constant bounds.
We need to take care to handle the case of a consteval function (w
https://github.com/llvmbot labeled
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
https://github.com/cor3ntin 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
https://github.com/cor3ntin labeled
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
https://github.com/cor3ntin labeled
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
https://github.com/cor3ntin created
https://github.com/llvm/llvm-project/pull/66222:
The bounds of a c++ array is a _constant-expression_. And in C++ it is also a
constant expression.
But we also support VLAs, ie arrays with non-constant bounds.
We need to take care to handle the case of a co
43 matches
Mail list logo