@@ -226,8 +226,8 @@ fn bool Checker.checkTypes(Checker* c, const Type* lcanon, const Type* rcanon) {
226
226
227
227
fn bool Checker.checkBuiltins(Checker* c, const Type* lcanon, const Type* rcanon) {
228
228
// Note: lhs and rhs are not the same, otherwise ptr-check would have succeeded
229
- const BuiltinType* lbuiltin = cast< BuiltinType*>(lcanon) ;
230
- const BuiltinType* rbuiltin = cast< BuiltinType*>(rcanon) ;
229
+ const BuiltinType* lbuiltin = ( BuiltinType*)lcanon ;
230
+ const BuiltinType* rbuiltin = ( BuiltinType*)rcanon ;
231
231
232
232
if ((*c.expr_ptr).isCtv()) {
233
233
// TODO check value instead of type
@@ -280,8 +280,8 @@ fn bool Checker.checkBuiltins(Checker* c, const Type* lcanon, const Type* rcanon
280
280
281
281
fn bool Checker.checkBuiltin2Pointer(Checker* c, const Type* lcanon, const Type* rcanon) {
282
282
// Note: only allow usize/(u32/u64) -> void*
283
- const PointerType* ptr = cast< PointerType*>(lcanon) ;
284
- const BuiltinType* bi = cast< BuiltinType*>(rcanon) ;
283
+ const PointerType* ptr = ( PointerType*)lcanon ;
284
+ const BuiltinType* bi = ( BuiltinType*)rcanon ;
285
285
286
286
QualType inner = ptr.getInner();
287
287
bool ok = inner.isVoid();
@@ -300,15 +300,15 @@ fn bool Checker.checkBuiltin2Pointer(Checker* c, const Type* lcanon, const Type*
300
300
301
301
fn bool Checker.checkPointer2Builtin(Checker* c, const Type* lcanon, const Type* rcanon) {
302
302
// Note: only allow void* -> usize/(u32/u64) / bool
303
- const BuiltinType* bi = cast< BuiltinType*>(lcanon) ;
303
+ const BuiltinType* bi = ( BuiltinType*)lcanon ;
304
304
305
305
BuiltinKind kind = bi.getKind();
306
306
if (kind == BuiltinKind.Bool) {
307
307
c.builder.insertImplicitCast(ImplicitCastKind.PointerToBoolean, c.expr_ptr, builtins[BuiltinKind.Bool]);
308
308
return true;
309
309
}
310
310
311
- const PointerType* ptr = cast< PointerType*>(rcanon) ;
311
+ const PointerType* ptr = ( PointerType*)rcanon ;
312
312
QualType inner = ptr.getInner();
313
313
314
314
// TODO or u32 (arch)
@@ -331,7 +331,7 @@ fn bool Checker.checkPointer2Builtin(Checker* c, const Type* lcanon, const Type*
331
331
332
332
fn bool Checker.checkPointer2Func(Checker* c, const Type* lcanon, const Type* rcanon) {
333
333
// only allow if pointer is void*
334
- const PointerType* ptr = cast< PointerType*>(rcanon) ;
334
+ const PointerType* ptr = ( PointerType*)rcanon ;
335
335
QualType inner = ptr.getInner();
336
336
if (!inner.isVoid()) {
337
337
c.diags.error(c.loc, "incompatible pointer to function conversion '%s' to '%s'",
@@ -344,7 +344,7 @@ fn bool Checker.checkPointer2Func(Checker* c, const Type* lcanon, const Type* rc
344
344
345
345
fn bool Checker.checkIntConversion(Checker* c, const BuiltinType* bi) {
346
346
Expr* e = *c.expr_ptr;
347
- const u8 wl = cast<u8>( bi.getWidth() );
347
+ const u8 wl = (u8) bi.getWidth();
348
348
ExprWidth w = getExprWidth(e);
349
349
//stdio.printf("INT CONVERSION signed|width: %d %d -> %d %d\n", w.is_signed, w.width, bi.isSigned(), w.width);
350
350
@@ -365,7 +365,7 @@ fn bool Checker.try_to_fix_type(Checker* c) {
365
365
Expr* e = *c.expr_ptr;
366
366
367
367
if (e.isImplicitCast()) {
368
- const ImplicitCastExpr* ic = cast< ImplicitCastExpr*>(e) ;
368
+ const ImplicitCastExpr* ic = ( ImplicitCastExpr*)e ;
369
369
if (ic.isArrayToPointerDecay()) {
370
370
e = ic.getInner();
371
371
c.rhs = e.getType();
@@ -396,8 +396,8 @@ fn bool pointer_conversion_allowed(QualType linner, QualType rinner) {
396
396
397
397
fn bool Checker.checkPointers(Checker* c, const Type* lcanon, const Type* rcanon) {
398
398
399
- const PointerType* ltype = cast< PointerType*>(lcanon) ;
400
- const PointerType* rtype = cast< PointerType*>(rcanon) ;
399
+ const PointerType* ltype = ( PointerType*)lcanon ;
400
+ const PointerType* rtype = ( PointerType*)rcanon ;
401
401
/*
402
402
if (ltype == rtype) { // this will only happen with AliasTypes
403
403
printf(" SAME, diff quals\n");
@@ -431,7 +431,7 @@ fn bool Checker.checkPointers(Checker* c, const Type* lcanon, const Type* rcanon
431
431
}
432
432
433
433
fn bool Checker.checkFunc2Pointer(Checker* c, const Type* lcanon, const Type* rcanon) {
434
- PointerType* pt = cast< PointerType*>(lcanon) ;
434
+ PointerType* pt = ( PointerType*)lcanon ;
435
435
QualType inner = pt.getInner();
436
436
if (inner.isVoid()) return true; // always allow conversion to 'void*'
437
437
@@ -441,7 +441,7 @@ fn bool Checker.checkFunc2Pointer(Checker* c, const Type* lcanon, const Type* rc
441
441
442
442
fn bool Checker.checkEnum2Int(Checker* c, const Type* lcanon, const Type* rcanon) {
443
443
// Note: enum constant values can never be negative
444
- const BuiltinType* bi = cast< BuiltinType*>(lcanon) ;
444
+ const BuiltinType* bi = ( BuiltinType*)lcanon ;
445
445
u32 width = bi.getWidth();
446
446
if (width == 64) return true; // 64-bit
447
447
@@ -450,7 +450,7 @@ fn bool Checker.checkEnum2Int(Checker* c, const Type* lcanon, const Type* rcanon
450
450
return ctv_analyser.check(c.diags, c.lhs, *c.expr_ptr);
451
451
} else {
452
452
// compare impl type
453
- const EnumType* et = cast< EnumType*>(rcanon) ;
453
+ const EnumType* et = ( EnumType*)rcanon ;
454
454
const EnumTypeDecl* etd = et.getDecl();
455
455
QualType impl = etd.getImplType();
456
456
@@ -461,9 +461,9 @@ fn bool Checker.checkEnum2Int(Checker* c, const Type* lcanon, const Type* rcanon
461
461
}
462
462
463
463
fn bool Checker.checkFunc2Func(Checker* c, const Type* lcanon, const Type* rcanon) {
464
- FunctionType* ftl = cast< FunctionType*>(lcanon) ;
464
+ FunctionType* ftl = ( FunctionType*)lcanon ;
465
465
FunctionDecl* fdl = ftl.getDecl();
466
- FunctionType* ftr = cast< FunctionType*>(rcanon) ;
466
+ FunctionType* ftr = ( FunctionType*)rcanon ;
467
467
FunctionDecl* fdr = ftr.getDecl();
468
468
469
469
if (fdr.getNumAutoArgs()) {
@@ -489,8 +489,8 @@ fn bool checkFunc2Func(const FunctionDecl* fdl, const FunctionDecl* fdr) {
489
489
u32 num2 = fdr.getNumParams();
490
490
if (num1 != num2) return false;
491
491
492
- Decl** args1 = cast< Decl**>( fdl.getParams() );
493
- Decl** args2 = cast< Decl**>( fdr.getParams() );
492
+ Decl** args1 = ( Decl**) fdl.getParams();
493
+ Decl** args2 = ( Decl**) fdr.getParams();
494
494
for (u32 i=0; i<num1; i++) {
495
495
Decl* a1 = args1[i];
496
496
Decl* a2 = args2[i];
@@ -506,13 +506,13 @@ fn bool checkFunc2Func(const FunctionDecl* fdl, const FunctionDecl* fdr) {
506
506
507
507
fn bool Checker.checkFunc2Builtin(Checker* c, const Type* lcanon, const Type* rcanon, bool* other_error) {
508
508
u32 wordsize = ast.getWordSize();
509
- const BuiltinType* bi = cast< BuiltinType*>(lcanon) ;
509
+ const BuiltinType* bi = ( BuiltinType*)lcanon ;
510
510
511
511
BuiltinKind kind = bi.getKind();
512
512
if (kind == BuiltinKind.USize) return true;
513
513
if (kind == BuiltinKind.Bool) {
514
514
// only allow Callback types or weak-functions
515
- FunctionType* ft = cast< FunctionType*>(rcanon) ;
515
+ FunctionType* ft = ( FunctionType*)rcanon ;
516
516
FunctionDecl* fd = ft.getDecl();
517
517
if (fd.isType() || fd.hasAttrWeak()) return true; // Variable with Function type (eg callback)
518
518
@@ -607,7 +607,7 @@ public fn bool Checker.checkCast(Checker* c, QualType lhs, QualType rhs, SrcLoc
607
607
fn bool Checker.checkBuiltin2PointerCast(Checker* c, const Type* lcanon, const Type* rcanon) {
608
608
// only allow cast from pointer-size int (u32/u64 depending on arch) to pointer
609
609
u32 wordsize = ast.getWordSize();
610
- const BuiltinType* bi = cast< BuiltinType*>(rcanon) ;
610
+ const BuiltinType* bi = ( BuiltinType*)rcanon ;
611
611
612
612
BuiltinKind kind = bi.getKind();
613
613
if (kind == BuiltinKind.USize) return true;
@@ -624,7 +624,7 @@ fn bool Checker.checkBuiltin2PointerCast(Checker* c, const Type* lcanon, const T
624
624
fn bool Checker.checkPointer2BuiltinCast(Checker* c, const Type* lcanon, const Type* rcanon) {
625
625
// only allow cast from pointer to pointer-size int (u32/u64 depending on arch)
626
626
u32 wordsize = ast.getWordSize();
627
- const BuiltinType* bi = cast< BuiltinType*>(lcanon) ;
627
+ const BuiltinType* bi = ( BuiltinType*)lcanon ;
628
628
629
629
BuiltinKind kind = bi.getKind();
630
630
if (kind == BuiltinKind.USize) return true;
@@ -679,7 +679,7 @@ public fn QualType get_common_arithmetic_type(QualType t1, QualType t2) {
679
679
680
680
BuiltinType* bi1 = t1.getBuiltin();
681
681
BuiltinType* bi2 = t2.getBuiltin();
682
- BuiltinKind kind = cast<BuiltinKind>( ConditionalOperatorResult[bi2.getKind()][bi1.getKind()]) ;
682
+ BuiltinKind kind = (BuiltinKind) ConditionalOperatorResult[bi2.getKind()][bi1.getKind()];
683
683
return ast.builtins[kind];
684
684
}
685
685
0 commit comments