Skip to content

Commit 288b8da

Browse files
committed
Try to handle Cast in all the places it needs to be handled
1 parent 3575617 commit 288b8da

File tree

7 files changed

+8
-0
lines changed

7 files changed

+8
-0
lines changed

clang/lib/AST/Expr.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1957,6 +1957,7 @@ bool CastExpr::CastConsistency() const {
19571957
case CK_HLSLArrayRValue:
19581958
case CK_HLSLVectorTruncation:
19591959
case CK_HLSLElementwiseCast:
1960+
case CK_HLSLSplatCast:
19601961
CheckNoBasePath:
19611962
assert(path_empty() && "Cast kind should not have a base path!");
19621963
break;

clang/lib/AST/ExprConstant.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15029,6 +15029,7 @@ bool IntExprEvaluator::VisitCastExpr(const CastExpr *E) {
1502915029
case CK_FixedPointCast:
1503015030
case CK_IntegralToFixedPoint:
1503115031
case CK_MatrixCast:
15032+
case CK_HLSLSplatCast:
1503215033
llvm_unreachable("invalid cast kind for integral value");
1503315034

1503415035
case CK_BitCast:
@@ -15907,6 +15908,7 @@ bool ComplexExprEvaluator::VisitCastExpr(const CastExpr *E) {
1590715908
case CK_MatrixCast:
1590815909
case CK_HLSLVectorTruncation:
1590915910
case CK_HLSLElementwiseCast:
15911+
case CK_HLSLSplatCast:
1591015912
llvm_unreachable("invalid cast kind for complex value");
1591115913

1591215914
case CK_LValueToRValue:

clang/lib/CodeGen/CGExprAgg.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1592,6 +1592,7 @@ static bool castPreservesZero(const CastExpr *CE) {
15921592
case CK_AtomicToNonAtomic:
15931593
case CK_HLSLVectorTruncation:
15941594
case CK_HLSLElementwiseCast:
1595+
// TODO is this true for CK_HLSLSplatCast
15951596
return true;
15961597

15971598
case CK_BaseToDerivedMemberPointer:

clang/lib/CodeGen/CGExprComplex.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,7 @@ ComplexPairTy ComplexExprEmitter::EmitCast(CastKind CK, Expr *Op,
611611
case CK_HLSLVectorTruncation:
612612
case CK_HLSLArrayRValue:
613613
case CK_HLSLElementwiseCast:
614+
case CK_HLSLSplatCast:
614615
llvm_unreachable("invalid cast kind for complex value");
615616

616617
case CK_FloatingRealToComplex:

clang/lib/CodeGen/CGExprConstant.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1336,6 +1336,7 @@ class ConstExprEmitter
13361336
case CK_HLSLVectorTruncation:
13371337
case CK_HLSLArrayRValue:
13381338
case CK_HLSLElementwiseCast:
1339+
case CK_HLSLSplatCast:
13391340
return nullptr;
13401341
}
13411342
llvm_unreachable("Invalid CastKind");

clang/lib/Edit/RewriteObjCFoundationAPI.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,6 +1086,7 @@ static bool rewriteToNumericBoxedExpression(const ObjCMessageExpr *Msg,
10861086

10871087
case CK_HLSLVectorTruncation:
10881088
case CK_HLSLElementwiseCast:
1089+
case CK_HLSLSplatCast:
10891090
llvm_unreachable("HLSL-specific cast in Objective-C?");
10901091
break;
10911092

clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,7 @@ void ExprEngine::VisitCast(const CastExpr *CastE, const Expr *Ex,
523523
case CK_MatrixCast:
524524
case CK_VectorSplat:
525525
case CK_HLSLElementwiseCast:
526+
case CK_HLSLSplatCast:
526527
case CK_HLSLVectorTruncation: {
527528
QualType resultType = CastE->getType();
528529
if (CastE->isGLValue())

0 commit comments

Comments
 (0)