Class: AdLint::Cc1::IntegerType
Instance Attribute Summary
#bit_alignment, #bit_size
Attributes inherited from Type
#declarations, #name, #type_table
Instance Method Summary
collapse
#_arithmetic_type_with_array, #_arithmetic_type_with_bitfield, #_arithmetic_type_with_char, #_arithmetic_type_with_double, #_arithmetic_type_with_enum, #_arithmetic_type_with_extended_big_int, #_arithmetic_type_with_float, #_arithmetic_type_with_function, #_arithmetic_type_with_int, #_arithmetic_type_with_long, #_arithmetic_type_with_long_double, #_arithmetic_type_with_long_int, #_arithmetic_type_with_long_long, #_arithmetic_type_with_long_long_int, #_arithmetic_type_with_pointer, #_arithmetic_type_with_short, #_arithmetic_type_with_short_int, #_arithmetic_type_with_signed, #_arithmetic_type_with_signed_char, #_arithmetic_type_with_signed_int, #_arithmetic_type_with_signed_long, #_arithmetic_type_with_signed_long_int, #_arithmetic_type_with_signed_long_long, #_arithmetic_type_with_signed_long_long_int, #_arithmetic_type_with_signed_short, #_arithmetic_type_with_signed_short_int, #_arithmetic_type_with_struct, #_arithmetic_type_with_undeclared, #_arithmetic_type_with_union, #_arithmetic_type_with_unresolved, #_arithmetic_type_with_unsigned, #_arithmetic_type_with_unsigned_char, #_arithmetic_type_with_unsigned_int, #_arithmetic_type_with_unsigned_long, #_arithmetic_type_with_unsigned_long_int, #_arithmetic_type_with_unsigned_long_long, #_arithmetic_type_with_unsigned_long_long_int, #_arithmetic_type_with_unsigned_short, #_arithmetic_type_with_unsigned_short_int, #_arithmetic_type_with_void, #arbitrary_value, #array?, #base_type, #coerce_array_value, #coerce_composite_value, #coerce_scalar_value, #coercible?, #const?, #function?, #have_va_list?, #impl_length, #length, #member_named, #members, #named?, #nil_value, #parameter_types, #parameter_value, #qualified?, #real_type, #restrict?, #return_type, #return_value, #scalar?, #struct?, #undeclared?, #undefined_value, #union?, #unqualify, #unresolved?, #user?, #void?, #volatile?, #zero_value
#do_usual_arithmetic_type_conversion
Methods inherited from Type
#==, #_arithmetic_type_with_array, #_arithmetic_type_with_bitfield, #_arithmetic_type_with_char, #_arithmetic_type_with_double, #_arithmetic_type_with_enum, #_arithmetic_type_with_extended_big_int, #_arithmetic_type_with_float, #_arithmetic_type_with_function, #_arithmetic_type_with_int, #_arithmetic_type_with_long, #_arithmetic_type_with_long_double, #_arithmetic_type_with_long_int, #_arithmetic_type_with_long_long, #_arithmetic_type_with_long_long_int, #_arithmetic_type_with_pointer, #_arithmetic_type_with_short, #_arithmetic_type_with_short_int, #_arithmetic_type_with_signed, #_arithmetic_type_with_signed_char, #_arithmetic_type_with_signed_int, #_arithmetic_type_with_signed_long, #_arithmetic_type_with_signed_long_int, #_arithmetic_type_with_signed_long_long, #_arithmetic_type_with_signed_long_long_int, #_arithmetic_type_with_signed_short, #_arithmetic_type_with_signed_short_int, #_arithmetic_type_with_struct, #_arithmetic_type_with_undeclared, #_arithmetic_type_with_union, #_arithmetic_type_with_unresolved, #_arithmetic_type_with_unsigned, #_arithmetic_type_with_unsigned_char, #_arithmetic_type_with_unsigned_int, #_arithmetic_type_with_unsigned_long, #_arithmetic_type_with_unsigned_long_int, #_arithmetic_type_with_unsigned_long_long, #_arithmetic_type_with_unsigned_long_long_int, #_arithmetic_type_with_unsigned_short, #_arithmetic_type_with_unsigned_short_int, #_arithmetic_type_with_void, #aligned_bit_size, #aligned_byte_size, #arbitrary_value, #array?, #base_type, #bit_alignment, #bit_size, #byte_alignment, #byte_size, #coerce_array_value, #coerce_composite_value, #coerce_scalar_value, #coercible?, #composite?, #const?, #convertible?, #function?, #have_va_list?, #impl_length, #incomplete?, #inspect, #length, #length=, #member_named, #members, #more_cv_qualified?, #named?, #nil_value, #parameter?, #parameter_types, #parameter_value, #qualified?, #real_type, #restrict?, #return_type, #return_value, #same_as?, #scalar?, #struct?, #undeclared?, #undefined_value, #union?, #unqualify, #unresolved?, #unsigned?, #user?, #void?, #volatile?, #zero_value
#char_alignment, #char_as_unsigned_char?, #char_size, #code_ptr_alignment, #code_ptr_size, #data_ptr_alignment, #data_ptr_size, #double_alignment, #double_size, #float_alignment, #float_size, #int_alignment, #int_size, #long_alignment, #long_double_alignment, #long_double_size, #long_long_alignment, #long_long_size, #long_size, #short_alignment, #short_size, #standard_types
#arithmetic, #logical_right_shift?
Methods included from Visitable
#accept
Constructor Details
#initialize(type_tbl, name, bit_size, bit_align, signed, explicitly_signed, type_dcls = []) ⇒ IntegerType
Returns a new instance of IntegerType.
3410
3411
3412
3413
3414
3415
|
# File 'lib/adlint/cc1/type.rb', line 3410
def initialize(type_tbl, name, bit_size, bit_align, signed,
explicitly_signed, type_dcls = [])
super(type_tbl, name, bit_size, bit_align, type_dcls)
@signed = signed
@explicitly_signed = explicitly_signed
end
|
Instance Method Details
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
|
# File 'lib/adlint/cc1/type.rb', line 3518
def argument_promoted_type
self.integer_promoted_type
end
|
#arithmetic_type_with(type) ⇒ Object
3545
3546
3547
|
# File 'lib/adlint/cc1/type.rb', line 3545
def arithmetic_type_with(type)
subclass_responsibility
end
|
#bitfield? ⇒ Boolean
3457
3458
3459
|
# File 'lib/adlint/cc1/type.rb', line 3457
def bitfield?
subclass_responsibility
end
|
#brief_image ⇒ Object
3425
3426
3427
|
# File 'lib/adlint/cc1/type.rb', line 3425
def brief_image
name
end
|
#compatible?(to_type) ⇒ Boolean
3433
3434
3435
|
# File 'lib/adlint/cc1/type.rb', line 3433
def compatible?(to_type)
to_type.integer? && to_type.min <= min && max <= to_type.max
end
|
#corresponding_signed_type ⇒ Object
3549
3550
3551
|
# File 'lib/adlint/cc1/type.rb', line 3549
def corresponding_signed_type
subclass_responsibility
end
|
#corresponding_unsigned_type ⇒ Object
3553
3554
3555
|
# File 'lib/adlint/cc1/type.rb', line 3553
def corresponding_unsigned_type
subclass_responsibility
end
|
3557
3558
3559
|
# File 'lib/adlint/cc1/type.rb', line 3557
def dup
subclass_responsibility
end
|
#enum? ⇒ Boolean
3449
3450
3451
|
# File 'lib/adlint/cc1/type.rb', line 3449
def enum?
subclass_responsibility
end
|
#enumerators ⇒ Object
3469
3470
3471
|
# File 'lib/adlint/cc1/type.rb', line 3469
def enumerators
subclass_responsibility
end
|
#explicitly_signed? ⇒ Boolean
3465
3466
3467
|
# File 'lib/adlint/cc1/type.rb', line 3465
def explicitly_signed?
@explicitly_signed
end
|
#floating? ⇒ Boolean
3441
3442
3443
|
# File 'lib/adlint/cc1/type.rb', line 3441
def floating?
false
end
|
3417
3418
3419
|
# File 'lib/adlint/cc1/type.rb', line 3417
def id
subclass_responsibility
end
|
3421
3422
3423
|
# File 'lib/adlint/cc1/type.rb', line 3421
def image
name
end
|
#integer? ⇒ Boolean
3437
3438
3439
|
# File 'lib/adlint/cc1/type.rb', line 3437
def integer?
true
end
|
#integer_conversion_rank ⇒ Object
3489
3490
3491
|
# File 'lib/adlint/cc1/type.rb', line 3489
def integer_conversion_rank
subclass_responsibility
end
|
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
|
# File 'lib/adlint/cc1/type.rb', line 3493
def integer_promoted_type
if self.integer_conversion_rank <= int_t.integer_conversion_rank
self.compatible?(int_t) ? int_t : unsigned_int_t
else
self
end
end
|
3429
3430
3431
|
# File 'lib/adlint/cc1/type.rb', line 3429
def location
nil
end
|
3481
3482
3483
3484
3485
3486
3487
|
# File 'lib/adlint/cc1/type.rb', line 3481
def max
if @signed
2**(@bit_size - 1) - 1
else
2**@bit_size - 1
end
end
|
3473
3474
3475
3476
3477
3478
3479
|
# File 'lib/adlint/cc1/type.rb', line 3473
def min
if @signed
-2**(@bit_size - 1)
else
0
end
end
|
#pointer? ⇒ Boolean
3445
3446
3447
|
# File 'lib/adlint/cc1/type.rb', line 3445
def pointer?
subclass_responsibility
end
|
#signed? ⇒ Boolean
3461
3462
3463
|
# File 'lib/adlint/cc1/type.rb', line 3461
def signed?
@signed
end
|
#standard? ⇒ Boolean
3453
3454
3455
|
# File 'lib/adlint/cc1/type.rb', line 3453
def standard?
subclass_responsibility
end
|