"""Test C++11 enumeration class types as int8_t types."""
self.build(
dictionary={
- 'CFLAGS_EXTRAS': '"-DTEST_BLOCK_CAPTURED_VARS=int8_t"'})
- self.image_lookup_for_enum_type()
+ 'CFLAGS_EXTRAS': '"-DSIGNED_ENUM_CLASS_TYPE=int8_t"'})
+ self.image_lookup_for_enum_type(True)
@expectedFailureAll(oslist=['freebsd'], bugnumber='llvm.org/pr36527')
@skipIf(dwarf_version=['<', '4'])
"""Test C++11 enumeration class types as int16_t types."""
self.build(
dictionary={
- 'CFLAGS_EXTRAS': '"-DTEST_BLOCK_CAPTURED_VARS=int16_t"'})
- self.image_lookup_for_enum_type()
+ 'CFLAGS_EXTRAS': '"-DSIGNED_ENUM_CLASS_TYPE=int16_t"'})
+ self.image_lookup_for_enum_type(True)
@expectedFailureAll(oslist=['freebsd'], bugnumber='llvm.org/pr36527')
@skipIf(dwarf_version=['<', '4'])
"""Test C++11 enumeration class types as int32_t types."""
self.build(
dictionary={
- 'CFLAGS_EXTRAS': '"-DTEST_BLOCK_CAPTURED_VARS=int32_t"'})
- self.image_lookup_for_enum_type()
+ 'CFLAGS_EXTRAS': '"-DSIGNED_ENUM_CLASS_TYPE=int32_t"'})
+ self.image_lookup_for_enum_type(True)
@expectedFailureAll(oslist=['freebsd'], bugnumber='llvm.org/pr36527')
@skipIf(dwarf_version=['<', '4'])
"""Test C++11 enumeration class types as int64_t types."""
self.build(
dictionary={
- 'CFLAGS_EXTRAS': '"-DTEST_BLOCK_CAPTURED_VARS=int64_t"'})
- self.image_lookup_for_enum_type()
+ 'CFLAGS_EXTRAS': '"-DSIGNED_ENUM_CLASS_TYPE=int64_t"'})
+ self.image_lookup_for_enum_type(True)
@expectedFailureAll(oslist=['freebsd'], bugnumber='llvm.org/pr36527')
@skipIf(dwarf_version=['<', '4'])
"""Test C++11 enumeration class types as uint8_t types."""
self.build(
dictionary={
- 'CFLAGS_EXTRAS': '"-DTEST_BLOCK_CAPTURED_VARS=uint8_t"'})
- self.image_lookup_for_enum_type()
+ 'CFLAGS_EXTRAS': '"-DUNSIGNED_ENUM_CLASS_TYPE=uint8_t"'})
+ self.image_lookup_for_enum_type(False)
@expectedFailureAll(oslist=['freebsd'], bugnumber='llvm.org/pr36527')
@skipIf(dwarf_version=['<', '4'])
"""Test C++11 enumeration class types as uint16_t types."""
self.build(
dictionary={
- 'CFLAGS_EXTRAS': '"-DTEST_BLOCK_CAPTURED_VARS=uint16_t"'})
- self.image_lookup_for_enum_type()
+ 'CFLAGS_EXTRAS': '"-DUNSIGNED_ENUM_CLASS_TYPE=uint16_t"'})
+ self.image_lookup_for_enum_type(False)
@expectedFailureAll(oslist=['freebsd'], bugnumber='llvm.org/pr36527')
@skipIf(dwarf_version=['<', '4'])
"""Test C++11 enumeration class types as uint32_t types."""
self.build(
dictionary={
- 'CFLAGS_EXTRAS': '"-DTEST_BLOCK_CAPTURED_VARS=uint32_t"'})
- self.image_lookup_for_enum_type()
+ 'CFLAGS_EXTRAS': '"-DUNSIGNED_ENUM_CLASS_TYPE=uint32_t"'})
+ self.image_lookup_for_enum_type(False)
@expectedFailureAll(oslist=['freebsd'], bugnumber='llvm.org/pr36527')
@skipIf(dwarf_version=['<', '4'])
"""Test C++11 enumeration class types as uint64_t types."""
self.build(
dictionary={
- 'CFLAGS_EXTRAS': '"-DTEST_BLOCK_CAPTURED_VARS=uint64_t"'})
- self.image_lookup_for_enum_type()
+ 'CFLAGS_EXTRAS': '"-DUNSIGNED_ENUM_CLASS_TYPE=uint64_t"'})
+ self.image_lookup_for_enum_type(False)
def setUp(self):
# Call super's setUp().
# Find the line number to break inside main().
self.line = line_number('main.cpp', '// Set break point at this line.')
- def image_lookup_for_enum_type(self):
+ def image_lookup_for_enum_type(self, is_signed):
"""Test C++11 enumeration class types."""
exe = self.getBuildArtifact("a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
'kNumDays',
'}'])
- enum_values = ['-4',
- 'Monday',
- 'Tuesday',
- 'Wednesday',
- 'Thursday',
- 'Friday',
- 'Saturday',
- 'Sunday',
- 'kNumDays',
- '5']
+ if is_signed:
+ enum_values = ['-4',
+ 'Monday',
+ 'Tuesday',
+ 'Wednesday',
+ 'Thursday',
+ 'Friday',
+ 'Saturday',
+ 'Sunday',
+ 'kNumDays',
+ '5']
+ else:
+ enum_values = ['199',
+ 'Monday',
+ 'Tuesday',
+ 'Wednesday',
+ 'Thursday',
+ 'Friday',
+ 'Saturday',
+ 'Sunday',
+ 'kNumDays',
+ '208']
bkpt = self.target().FindBreakpointByID(bkpt_id)
for enum_value in enum_values:
}
}
+ // Unsigned values make more sense for flags.
+ offset = byte_offset;
+ const uint64_t enum_uvalue = data.GetMaxU64Bitfield(
+ &offset, byte_size, bitfield_bit_size, bitfield_bit_offset);
+
// No exact match, but we don't think this is a bitfield. Print the value as
// decimal.
if (!can_be_bitfield) {
- s->Printf("%" PRIi64, enum_svalue);
+ if (qual_type->isSignedIntegerOrEnumerationType())
+ s->Printf("%" PRIi64, enum_svalue);
+ else
+ s->Printf("%" PRIu64, enum_uvalue);
return true;
}
- // Unsigned values make more sense for flags.
- offset = byte_offset;
- const uint64_t enum_uvalue = data.GetMaxU64Bitfield(
- &offset, byte_size, bitfield_bit_size, bitfield_bit_offset);
-
uint64_t remaining_value = enum_uvalue;
std::vector<std::pair<uint64_t, llvm::StringRef>> values;
values.reserve(num_enumerators);