[clang] 18000fe - [clang][Interp][NFC] Reject non-floating CK_FloatingCast casts
Timm Bäder via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 17 23:39:04 PDT 2024
Author: Timm Bäder
Date: 2024-06-18T08:30:43+02:00
New Revision: 18000feec0e174194fec3476b8b73db1d767e0d2
URL: https://github.com/llvm/llvm-project/commit/18000feec0e174194fec3476b8b73db1d767e0d2
DIFF: https://github.com/llvm/llvm-project/commit/18000feec0e174194fec3476b8b73db1d767e0d2.diff
LOG: [clang][Interp][NFC] Reject non-floating CK_FloatingCast casts
We need the types to be floating types. Rejecting the HLSL vector
casts here is also what the current interpreter does.
Added:
Modified:
clang/lib/AST/Interp/ByteCodeExprGen.cpp
Removed:
################################################################################
diff --git a/clang/lib/AST/Interp/ByteCodeExprGen.cpp b/clang/lib/AST/Interp/ByteCodeExprGen.cpp
index e65b2fc7ac233..b5e27bfb1a6db 100644
--- a/clang/lib/AST/Interp/ByteCodeExprGen.cpp
+++ b/clang/lib/AST/Interp/ByteCodeExprGen.cpp
@@ -176,6 +176,10 @@ bool ByteCodeExprGen<Emitter>::VisitCastExpr(const CastExpr *CE) {
}
case CK_FloatingCast: {
+ // HLSL uses CK_FloatingCast to cast between vectors.
+ if (!SubExpr->getType()->isFloatingType() ||
+ !CE->getType()->isFloatingType())
+ return false;
if (DiscardResult)
return this->discard(SubExpr);
if (!this->visit(SubExpr))
More information about the cfe-commits
mailing list