[clang] [Clang] Handle consteval expression in array bounds expressions (PR #66222)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 26 12:08:37 PDT 2023
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff b26157edf08184f2620b3df95048a97a1658c021 4b62211b22950a9bdd3764093f6716d0f792469e -- clang/include/clang/Parse/Parser.h clang/include/clang/Sema/Sema.h clang/lib/Parse/ParseDecl.cpp clang/lib/Parse/ParseExpr.cpp clang/lib/Sema/Sema.cpp clang/lib/Sema/SemaCUDA.cpp clang/lib/Sema/SemaChecking.cpp clang/lib/Sema/SemaExpr.cpp clang/lib/Sema/TreeTransform.h clang/test/SemaCXX/cxx2a-consteval.cpp clang/unittests/Support/TimeProfilerTest.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index 94e2f180e227..5a7dbcd158a1 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -1348,7 +1348,8 @@ public:
bool IsCurrentlyCheckingDefaultArgumentOrInitializer = false;
// We are in a constant context, but we also allow
- // non constant expressions, for example for array bounds (which may be VLAs).
+ // non constant expressions, for example for array bounds (which may be
+ // VLAs).
bool InConditionallyConstantEvaluateContext = false;
// When evaluating immediate functions in the initializer of a default
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 277b1cc2ce43..674d79322849 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -13951,7 +13951,7 @@ static bool CheckTautologicalComparison(Sema &S, BinaryOperator *E,
return false;
IntRange OtherValueRange = GetExprRange(
- S.Context, Other, S.isConstantEvaluatedContext(), /*Approximate=*/ false);
+ S.Context, Other, S.isConstantEvaluatedContext(), /*Approximate=*/false);
QualType OtherT = Other->getType();
if (const auto *AT = OtherT->getAs<AtomicType>())
@@ -15185,7 +15185,7 @@ static void CheckImplicitConversion(Sema &S, Expr *E, QualType T,
IntRange SourceTypeRange =
IntRange::forTargetOfCanonicalType(S.Context, Source);
IntRange LikelySourceRange = GetExprRange(
- S.Context, E, S.isConstantEvaluatedContext(), /*Approximate=*/ true);
+ S.Context, E, S.isConstantEvaluatedContext(), /*Approximate=*/true);
IntRange TargetRange = IntRange::forTargetOfCanonicalType(S.Context, Target);
if (LikelySourceRange.Width > TargetRange.Width) {
``````````
</details>
https://github.com/llvm/llvm-project/pull/66222
More information about the cfe-commits
mailing list