Exemple #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;
}
Exemple #2
0
LLVMValueRef DIBuilderGetOrCreateTypeArray(LLVMDIBuilderRef dref,
                                           LLVMValueRef *data, size_t length) {
  DIBuilder *d = unwrap(dref);
  Value **dataValue = unwrap(data);
  ArrayRef<Value *> elements(dataValue, length);
  DITypeArray a = d->getOrCreateTypeArray(elements);
  return wrap(a);
}
LLVMMetadataRef LLVMDIBuilderGetOrCreateTypeArray(LLVMDIBuilderRef Dref,
                                                  LLVMMetadataRef *Data,
                                                  size_t Length) {
  DIBuilder *D = unwrap(Dref);
  Metadata **DataValue = unwrap(Data);
  ArrayRef<Metadata *> Elements(DataValue, Length);
  DITypeRefArray A = D->getOrCreateTypeArray(Elements);
  return wrap(A.get());
}
Exemple #4
0
LLVMValueRef LLVMDIBuilderGetOrCreateTypeArray(LLVMDIBuilderRef Dref,
                                               LLVMValueRef *Data,
                                               size_t Length) {
  DIBuilder *D = unwrap(Dref);
  Value **DataValue = unwrap(Data);
  ArrayRef<Value *> Elements(DataValue, Length);
  DITypeArray A = D->getOrCreateTypeArray(Elements);
  return wrap(A);
}
Exemple #5
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);
}
Exemple #6
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);
}
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;
}