Beispiel #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);
}
Beispiel #2
0
void CVTypeDumperImpl::visitClass(TypeLeafKind Leaf, ClassRecord &Class) {
    uint16_t Props = static_cast<uint16_t>(Class.getOptions());
    W.printNumber("MemberCount", Class.getMemberCount());
    W.printFlags("Properties", Props, makeArrayRef(ClassOptionNames));
    printTypeIndex("FieldList", Class.getFieldList());
    printTypeIndex("DerivedFrom", Class.getDerivationList());
    printTypeIndex("VShape", Class.getVTableShape());
    W.printNumber("SizeOf", Class.getSize());
    W.printString("Name", Class.getName());
    if (Props & uint16_t(ClassOptions::HasUniqueName))
        W.printString("LinkageName", Class.getUniqueName());
    Name = Class.getName();
}
Beispiel #3
0
Error TypeDumpVisitor::visitKnownRecord(CVType &CVR, ClassRecord &Class) {
  uint16_t Props = static_cast<uint16_t>(Class.getOptions());
  W->printNumber("MemberCount", Class.getMemberCount());
  W->printFlags("Properties", Props, makeArrayRef(ClassOptionNames));
  printTypeIndex("FieldList", Class.getFieldList());
  printTypeIndex("DerivedFrom", Class.getDerivationList());
  printTypeIndex("VShape", Class.getVTableShape());
  W->printNumber("SizeOf", Class.getSize());
  W->printString("Name", Class.getName());
  if (Props & uint16_t(ClassOptions::HasUniqueName))
    W->printString("LinkageName", Class.getUniqueName());
  return Error::success();
}
Beispiel #4
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);
}