Ejemplo n.º 1
0
TypeIndex TypeTableBuilder::writeClass(const ClassRecord &Record) {
  assert((Record.getKind() == TypeRecordKind::Struct) ||
         (Record.getKind() == TypeRecordKind::Class) ||
         (Record.getKind() == TypeRecordKind::Interface));

  TypeRecordBuilder Builder(Record.getKind());

  Builder.writeUInt16(Record.getMemberCount());
  uint16_t Flags =
      static_cast<uint16_t>(Record.getOptions()) |
      (static_cast<uint16_t>(Record.getHfa()) << ClassRecord::HfaKindShift) |
      (static_cast<uint16_t>(Record.getWinRTKind())
       << ClassRecord::WinRTKindShift);
  Builder.writeUInt16(Flags);
  Builder.writeTypeIndex(Record.getFieldList());
  Builder.writeTypeIndex(Record.getDerivationList());
  Builder.writeTypeIndex(Record.getVTableShape());
  Builder.writeEncodedUnsignedInteger(Record.getSize());
  Builder.writeNullTerminatedString(Record.getName());
  if ((Record.getOptions() & ClassOptions::HasUniqueName) !=
      ClassOptions::None) {
    Builder.writeNullTerminatedString(Record.getUniqueName());
  }

  return writeRecord(Builder);
}
Ejemplo n.º 2
0
TypeIndex TypeTableBuilder::writeKnownType(const ClassRecord &Record) {
  assert((Record.getKind() == TypeRecordKind::Struct) ||
         (Record.getKind() == TypeRecordKind::Class) ||
         (Record.getKind() == TypeRecordKind::Interface));

  TypeRecordBuilder Builder(Record.getKind());

  Builder.writeUInt16(Record.getMemberCount());
  uint16_t Flags =
      static_cast<uint16_t>(Record.getOptions()) |
      (static_cast<uint16_t>(Record.getHfa()) << ClassRecord::HfaKindShift) |
      (static_cast<uint16_t>(Record.getWinRTKind())
       << ClassRecord::WinRTKindShift);
  Builder.writeUInt16(Flags);
  Builder.writeTypeIndex(Record.getFieldList());
  Builder.writeTypeIndex(Record.getDerivationList());
  Builder.writeTypeIndex(Record.getVTableShape());
  Builder.writeEncodedUnsignedInteger(Record.getSize());
  writeNameAndUniqueName(Builder, Record.getOptions(), Record.getName(),
                         Record.getUniqueName());

  return writeRecord(Builder);
}