Ejemplo n.º 1
0
int
DefineFunctionType(
    ClientData clientData,
    Tcl_Interp *interp,
    int objc,
    Tcl_Obj *const objv[])
{
    if (objc < 4) {
	Tcl_WrongNumArgs(interp, 1, objv,
		"DIBuilder file returnType argumentType...");
	return TCL_ERROR;
    }

    DIBuilder *builder;
    if (GetDIBuilderFromObj(interp, objv[1], builder) != TCL_OK)
	return TCL_ERROR;
    DIFile *file;
    if (GetMetadataFromObj(interp, objv[2], "file", file) != TCL_OK)
	return TCL_ERROR;
    std::vector<Metadata *> elements;
    for (int i=3 ; i<objc ; i++) {
	DIType *type;
	if (GetMetadataFromObj(interp, objv[i], "type", type) != TCL_OK)
	    return TCL_ERROR;
	elements.push_back(type);
    }

    auto val = builder->createSubroutineType(file,
	    builder->getOrCreateTypeArray(elements));

    Tcl_SetObjResult(interp, NewMetadataObj(val, "FunctionType"));
    return TCL_OK;
}
Ejemplo n.º 2
0
LLVMMetadataRef
LLVMDIBuilderCreateSubroutineType(LLVMDIBuilderRef Dref, LLVMMetadataRef File,
                                  LLVMMetadataRef ParameterTypes) {
  DIBuilder *D = unwrap(Dref);
  return wrap(
      D->createSubroutineType(DITypeRefArray(unwrap<MDTuple>(ParameterTypes))));
}
Ejemplo n.º 3
0
LLVMValueRef LLVMDIBuilderCreateSubroutineType(LLVMDIBuilderRef Dref,
                                               LLVMValueRef File,
                                               LLVMValueRef ParameterTypes) {
  DIBuilder *D = unwrap(Dref);
  DICompositeType CT = D->createSubroutineType(
      unwrapDI<DIFile>(File), unwrapDI<DITypeArray>(ParameterTypes));
  return wrap(CT);
}
Ejemplo n.º 4
0
LLVMValueRef DIBuilderCreateSubroutineType(LLVMDIBuilderRef dref,
                                           LLVMValueRef diFile,
                                           LLVMValueRef diParameterTypes) {
  DIBuilder *d = unwrap(dref);
  DICompositeType ct = d->createSubroutineType(
      unwrapDI<DIFile>(diFile), unwrapDI<DITypeArray>(diParameterTypes));
  return wrap(ct);
}
Ejemplo n.º 5
0
LLVMMetadataRef
LLVMDIBuilderCreateSubroutineType(LLVMDIBuilderRef Dref, LLVMMetadataRef File,
                                  LLVMMetadataRef ParameterTypes) {
  DIBuilder *D = unwrap(Dref);
  DICompositeType CT =
      D->createSubroutineType(File ? unwrap<MDFile>(File) : nullptr,
                              DITypeArray(unwrap<MDTuple>(ParameterTypes)));
  return wrap(CT);
}
Ejemplo n.º 6
0
void*
mono_llvm_di_create_function (void *di_builder, void *cu, const char *name, const char *mangled_name, const char *dir, const char *file, int line)
{
	DIBuilder *builder = (DIBuilder*)di_builder;
	DIFile *di_file;
	DISubroutineType *type;

	// FIXME: Share DIFile
	di_file = builder->createFile (file, dir);
	type = builder->createSubroutineType (builder->getOrCreateTypeArray (ArrayRef<Metadata*> ()));
	return builder->createFunction (di_file, name, mangled_name, di_file, line, type, true, true, 0);
}
Ejemplo n.º 7
0
LLVMZigDIType *LLVMZigCreateSubroutineType(LLVMZigDIBuilder *dibuilder_wrapped,
        LLVMZigDIFile *file, LLVMZigDIType **types_array, int types_array_len, unsigned flags)
{
    SmallVector<Metadata *, 8> types;
    for (int i = 0; i < types_array_len; i += 1) {
        DIType *ditype = reinterpret_cast<DIType*>(types_array[i]);
        types.push_back(ditype);
    }
    DIBuilder *dibuilder = reinterpret_cast<DIBuilder*>(dibuilder_wrapped);
    DISubroutineType *subroutine_type = dibuilder->createSubroutineType(
            reinterpret_cast<DIFile*>(file),
            dibuilder->getOrCreateTypeArray(types),
            flags);
    DIType *ditype = subroutine_type;
    return reinterpret_cast<LLVMZigDIType*>(ditype);
}
Ejemplo n.º 8
0
void*
mono_llvm_di_create_function (void *di_builder, void *cu, LLVMValueRef func, const char *name, const char *mangled_name, const char *dir, const char *file, int line)
{
    DIBuilder *builder = (DIBuilder*)di_builder;
    DIFile *di_file;
    DISubroutineType *type;
    DISubprogram *di_func;

    // FIXME: Share DIFile
    di_file = builder->createFile (file, dir);
    type = builder->createSubroutineType (builder->getOrCreateTypeArray (ArrayRef<Metadata*> ()));
    di_func = builder->createFunction (di_file, name, mangled_name, di_file, line, type, true, true, 0);

    unwrap<Function>(func)->setMetadata ("dbg", di_func);

    return di_func;
}