Пример #1
0
LLVMValueRef LLVMDIBuilderCreateStructType(
  LLVMDIBuilderRef D,
  LLVMValueRef Scope,
  const char *Name,
  LLVMValueRef File,
  unsigned Line,
  uint64_t SizeInBits,
  uint64_t AlignInBits,
  unsigned Flags,
  LLVMValueRef DerivedFrom,
  LLVMValueRef ElementTypes)
{
  DIBuilder *db = unwrap(D);
  DICompositeType CT = db->createStructType(
    unwrapDI<DIDescriptor>(Scope),
    Name,
    unwrapDI<DIFile>(File),
    Line,
    SizeInBits,
    AlignInBits,
    Flags,
    unwrapDI<DIType>(DerivedFrom),
    unwrapDI<DIArray>(ElementTypes));
  return wrap(CT);
}
Пример #2
0
LLVMMetadataRef LLVMDIBuilderCreateStructType(
    LLVMDIBuilderRef Dref, LLVMMetadataRef Scope, const char *Name,
    LLVMMetadataRef File, unsigned Line, uint64_t SizeInBits,
    uint32_t AlignInBits, unsigned Flags, LLVMMetadataRef DerivedFrom,
    LLVMMetadataRef ElementTypes) {
  DIBuilder *D = unwrap(Dref);
  return wrap(D->createStructType(
      unwrap<DIScope>(Scope), Name, File ? unwrap<DIFile>(File) : nullptr, Line,
      SizeInBits, AlignInBits, static_cast<DINode::DIFlags>(Flags),
      DerivedFrom ? unwrap<DIType>(DerivedFrom) : nullptr,
      ElementTypes ? DINodeArray(unwrap<MDTuple>(ElementTypes)) : nullptr));
}
Пример #3
0
LLVMMetadataRef LLVMDIBuilderCreateStructType(
    LLVMDIBuilderRef Dref, LLVMMetadataRef Scope, const char *Name,
    LLVMMetadataRef File, unsigned Line, uint64_t SizeInBits,
    uint64_t AlignInBits, unsigned Flags, LLVMMetadataRef DerivedFrom,
    LLVMMetadataRef ElementTypes) {
  DIBuilder *D = unwrap(Dref);
  DICompositeType CT = D->createStructType(
      unwrap<MDScope>(Scope), Name, File ? unwrap<MDFile>(File) : nullptr, Line,
      SizeInBits, AlignInBits, Flags,
      DerivedFrom ? unwrap<MDType>(DerivedFrom) : nullptr,
      ElementTypes ? DIArray(unwrap<MDTuple>(ElementTypes)) : nullptr);
  return wrap(CT);
}
Пример #4
0
LLVMValueRef DIBuilderCreateStructType(LLVMDIBuilderRef dref,
                                       LLVMValueRef diScope, const char *name,
                                       LLVMValueRef diFile, unsigned line,
                                       uint64_t sizeInBits,
                                       uint64_t alignInBits, unsigned flags,
                                       LLVMValueRef diDerivedFrom,
                                       LLVMValueRef diElementTypes) {
  DIBuilder *d = unwrap(dref);
  DICompositeType ct = d->createStructType(
      unwrapDI<DIDescriptor>(diScope), StringRef(name),
      unwrapDI<DIFile>(diFile), line, sizeInBits, alignInBits, flags,
      unwrapDI<DIType>(diDerivedFrom), unwrapDI<DIArray>(diElementTypes));
  return wrap(ct);
}
Пример #5
0
int
DefineStructType(
    ClientData clientData,
    Tcl_Interp *interp,
    int objc,
    Tcl_Obj *const objv[])
{
    if (objc < 7) {
	Tcl_WrongNumArgs(interp, 1, objv,
		"DIBuilder scope name file line size element...");
	return TCL_ERROR;
    }

    DIBuilder *builder;
    if (GetDIBuilderFromObj(interp, objv[1], builder) != TCL_OK)
	return TCL_ERROR;
    DIScope *scope;
    if (GetMetadataFromObj(interp, objv[2], "scope", scope) != TCL_OK)
	return TCL_ERROR;
    std::string name = Tcl_GetString(objv[3]);
    DIFile *file;
    if (GetMetadataFromObj(interp, objv[4], "file", file) != TCL_OK)
	return TCL_ERROR;
    unsigned flags = 0, align = 0;
    int size, line;
    if (Tcl_GetIntFromObj(interp, objv[5], &line) != TCL_OK)
	return TCL_ERROR;
    if (Tcl_GetIntFromObj(interp, objv[6], &size) != TCL_OK)
	return TCL_ERROR;
    std::vector<Metadata *> elements;
    for (int i=7 ; i<objc ; i++) {
	DIType *type;
	if (GetMetadataFromObj(interp, objv[i], "type", type) != TCL_OK)
	    return TCL_ERROR;
	elements.push_back(type);
    }

    auto val = builder->createStructType(scope, name, file, (unsigned) line,
	    (uint64_t) size, align, flags, nullptr,
	    builder->getOrCreateArray(elements));

    Tcl_SetObjResult(interp, NewMetadataObj(val, "StructType"));
    return TCL_OK;
}