Skip to content

Commit ca34a24

Browse files
committed
Try to handle Cast in all the places it needs to be handled
1 parent b8e7f19 commit ca34a24

File tree

8 files changed

+10
-0
lines changed

8 files changed

+10
-0
lines changed

clang/lib/AST/Expr.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1943,6 +1943,7 @@ bool CastExpr::CastConsistency() const {
19431943
case CK_HLSLArrayRValue:
19441944
case CK_HLSLVectorTruncation:
19451945
case CK_HLSLAggregateCast:
1946+
case CK_HLSLSplatCast:
19461947
CheckNoBasePath:
19471948
assert(path_empty() && "Cast kind should not have a base path!");
19481949
break;

clang/lib/AST/ExprConstant.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14858,6 +14858,7 @@ bool IntExprEvaluator::VisitCastExpr(const CastExpr *E) {
1485814858
case CK_IntegralToFixedPoint:
1485914859
case CK_MatrixCast:
1486014860
// TODO does CK_HLSLAggregateCast belong here?
14861+
case CK_HLSLSplatCast:
1486114862
llvm_unreachable("invalid cast kind for integral value");
1486214863

1486314864
case CK_BitCast:
@@ -15735,6 +15736,7 @@ bool ComplexExprEvaluator::VisitCastExpr(const CastExpr *E) {
1573515736
case CK_MatrixCast:
1573615737
case CK_HLSLVectorTruncation:
1573715738
case CK_HLSLAggregateCast:
15739+
case CK_HLSLSplatCast:
1573815740
llvm_unreachable("invalid cast kind for complex value");
1573915741

1574015742
case CK_LValueToRValue:

clang/lib/CodeGen/CGExpr.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5321,6 +5321,7 @@ LValue CodeGenFunction::EmitCastLValue(const CastExpr *E) {
53215321
case CK_HLSLVectorTruncation:
53225322
case CK_HLSLArrayRValue:
53235323
case CK_HLSLAggregateCast:
5324+
// TODO is CK_HLSLSplatCast an lvalue?
53245325
return EmitUnsupportedLValue(E, "unexpected cast lvalue");
53255326

53265327
case CK_Dependent:

clang/lib/CodeGen/CGExprAgg.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1594,6 +1594,8 @@ static bool castPreservesZero(const CastExpr *CE) {
15941594
case CK_AtomicToNonAtomic:
15951595
case CK_HLSLVectorTruncation:
15961596
// TODO does CK_HLSLAggregateCast preserve zero?
1597+
// TODO is this true for CK_HLSLSplatCast
1598+
>>>>>>> a74daceacc38 (Try to handle Cast in all the places it needs to be handled)
15971599
return true;
15981600

15991601
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_HLSLAggregateCast:
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_HLSLAggregateCast:
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_HLSLAggregateCast:
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_HLSLAggregateCast:
526+
case CK_HLSLSplatCast:
526527
case CK_HLSLVectorTruncation: {
527528
QualType resultType = CastE->getType();
528529
if (CastE->isGLValue())

0 commit comments

Comments
 (0)