Class: AdLint::Cc1::EnumType
Instance Attribute Summary collapse
Attributes included from Scopeable
#scope
#bit_alignment, #bit_size
Attributes inherited from Type
#declarations, #name, #type_table
Instance Method Summary
collapse
Methods inherited from IntegerType
#argument_promoted_type, #compatible?, #explicitly_signed?, #floating?, #integer?, #max, #min, #signed?
#_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, #argument_promoted_type, #array?, #base_type, #coerce_array_value, #coerce_composite_value, #coerce_scalar_value, #coercible?, #compatible?, #const?, #explicitly_signed?, #floating?, #function?, #have_va_list?, #impl_length, #integer?, #length, #max, #member_named, #members, #min, #nil_value, #parameter_types, #parameter_value, #qualified?, #real_type, #restrict?, #return_type, #return_value, #scalar?, #signed?, #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, #argument_promoted_type, #array?, #base_type, #bit_alignment, #bit_size, #byte_alignment, #byte_size, #coerce_array_value, #coerce_composite_value, #coerce_scalar_value, #coercible?, #compatible?, #composite?, #const?, #convertible?, #explicitly_signed?, #floating?, #function?, #have_va_list?, #impl_length, #inspect, #integer?, #length, #length=, #max, #member_named, #members, #min, #more_cv_qualified?, #nil_value, #parameter?, #parameter_types, #parameter_value, #qualified?, #real_type, #restrict?, #return_type, #return_value, #same_as?, #scalar?, #signed?, #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, type_dcl) ⇒ EnumType
Returns a new instance of EnumType.
4958
4959
4960
4961
4962
4963
4964
4965
4966
|
# File 'lib/adlint/cc1/type.rb', line 4958
def initialize(type_tbl, type_dcl)
@type_table = type_tbl
super(type_tbl, type_dcl.identifier.value,
int_size, int_alignment, true, true, [type_dcl])
@image = type_dcl.enum_specifier.to_s
@location = type_dcl.location
end
|
Instance Attribute Details
Returns the value of attribute image.
4968
4969
4970
|
# File 'lib/adlint/cc1/type.rb', line 4968
def image
@image
end
|
Returns the value of attribute location.
4969
4970
4971
|
# File 'lib/adlint/cc1/type.rb', line 4969
def location
@location
end
|
Instance Method Details
#arithmetic_type_with(type) ⇒ Object
5062
5063
5064
|
# File 'lib/adlint/cc1/type.rb', line 5062
def arithmetic_type_with(type)
type._arithmetic_type_with_enum(self)
end
|
#bitfield? ⇒ Boolean
4995
4996
4997
|
# File 'lib/adlint/cc1/type.rb', line 4995
def bitfield?
false
end
|
#brief_image ⇒ Object
4999
5000
5001
|
# File 'lib/adlint/cc1/type.rb', line 4999
def brief_image
"enum #{name}"
end
|
#corresponding_signed_type ⇒ Object
5066
5067
5068
|
# File 'lib/adlint/cc1/type.rb', line 5066
def corresponding_signed_type
signed_int_t
end
|
#corresponding_unsigned_type ⇒ Object
5070
5071
5072
|
# File 'lib/adlint/cc1/type.rb', line 5070
def corresponding_unsigned_type
unsigned_int_t
end
|
5074
5075
5076
|
# File 'lib/adlint/cc1/type.rb', line 5074
def dup
EnumType.new(type_table, declarations.first)
end
|
#enum? ⇒ Boolean
4987
4988
4989
|
# File 'lib/adlint/cc1/type.rb', line 4987
def enum?
true
end
|
#enumerators ⇒ Object
5003
5004
5005
|
# File 'lib/adlint/cc1/type.rb', line 5003
def enumerators
declarations.map { |dcl| dcl.enumerators }.compact.flatten.uniq
end
|
4971
4972
4973
|
# File 'lib/adlint/cc1/type.rb', line 4971
def id
@id ||= EnumTypeId.new(name)
end
|
#incomplete? ⇒ Boolean
4979
4980
4981
|
# File 'lib/adlint/cc1/type.rb', line 4979
def incomplete?
declarations.all? { |dcl| dcl.enumerators.nil? }
end
|
#integer_conversion_rank ⇒ Object
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
|
# File 'lib/adlint/cc1/type.rb', line 5007
def integer_conversion_rank
int_t.integer_conversion_rank
end
|
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
|
# File 'lib/adlint/cc1/type.rb', line 5046
def integer_promoted_type
self
end
|
#named? ⇒ Boolean
4975
4976
4977
|
# File 'lib/adlint/cc1/type.rb', line 4975
def named?
declarations.all? { |dcl| !dcl.enum_specifier.anonymous? }
end
|
#pointer? ⇒ Boolean
4983
4984
4985
|
# File 'lib/adlint/cc1/type.rb', line 4983
def pointer?
false
end
|
#standard? ⇒ Boolean
4991
4992
4993
|
# File 'lib/adlint/cc1/type.rb', line 4991
def standard?
false
end
|