[PATCH] D154474: [clang][Interp] Fix ignoring Integral- and IntegralToBoolean casts
Timm Bäder via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 1 06:21:49 PDT 2023
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG21aa8a220c01: [clang][Interp] Fix ignoring Integral- and IntegralToBoolean casts (authored by tbaeder).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D154474/new/
https://reviews.llvm.org/D154474
Files:
clang/lib/AST/Interp/ByteCodeExprGen.cpp
clang/test/AST/Interp/literals.cpp
Index: clang/test/AST/Interp/literals.cpp
===================================================================
--- clang/test/AST/Interp/literals.cpp
+++ clang/test/AST/Interp/literals.cpp
@@ -921,6 +921,9 @@
sizeof(int);
alignof(int);
+ (short)5;
+ (bool)1;
+
return 0;
}
static_assert(ignoredExprs() == 0, "");
Index: clang/lib/AST/Interp/ByteCodeExprGen.cpp
===================================================================
--- clang/lib/AST/Interp/ByteCodeExprGen.cpp
+++ clang/lib/AST/Interp/ByteCodeExprGen.cpp
@@ -150,6 +150,8 @@
case CK_IntegralToBoolean:
case CK_IntegralCast: {
+ if (DiscardResult)
+ return this->discard(SubExpr);
std::optional<PrimType> FromT = classify(SubExpr->getType());
std::optional<PrimType> ToT = classify(CE->getType());
if (!FromT || !ToT)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154474.546020.patch
Type: text/x-patch
Size: 844 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230801/500dc4fb/attachment.bin>
More information about the cfe-commits
mailing list