Exemplo n.º 1
0
LLVMValueRef LLVMDIBuilderCreateLocalVariable(
  LLVMDIBuilderRef D,
  unsigned Tag,
  LLVMValueRef Scope,
  const char *Name,
  LLVMValueRef File,
  unsigned Line,
  LLVMValueRef Ty,
  bool AlwaysPreserve,
  unsigned Flags,
  unsigned ArgNo)
{
  DIBuilder *db = unwrap(D);
  DIVariable V = db->createLocalVariable(
    Tag,
    unwrapDI<DIDescriptor>(Scope),
    Name,
    unwrapDI<DIFile>(File),
    Line,
    unwrapDI<DIType>(Ty),
    AlwaysPreserve,
    Flags,
    ArgNo);
  return wrap(V);
}
Exemplo n.º 2
0
LLVMMetadataRef LLVMDIBuilderCreateLocalVariable(
    LLVMDIBuilderRef Dref, unsigned Tag, LLVMMetadataRef Scope,
    const char *Name, LLVMMetadataRef File, unsigned Line, LLVMMetadataRef Ty,
    int AlwaysPreserve, unsigned Flags, unsigned ArgNo) {
  DIBuilder *D = unwrap(Dref);
  DIVariable V = D->createLocalVariable(
      Tag, unwrap<MDScope>(Scope), Name, unwrap<MDFile>(File), Line,
      unwrap<MDType>(Ty), AlwaysPreserve, Flags, ArgNo);
  return wrap(V);
}
Exemplo n.º 3
0
LLVMValueRef DIBuilderCreateLocalVariable(LLVMDIBuilderRef dref, unsigned tag,
                                          LLVMValueRef diScope,
                                          const char *name, LLVMValueRef diFile,
                                          unsigned line, LLVMValueRef diType,
                                          int alwaysPreserve, unsigned flags,
                                          unsigned argNo) {
  DIBuilder *d = unwrap(dref);
  DIVariable v = d->createLocalVariable(
      tag, unwrapDI<DIDescriptor>(diScope), StringRef(name),
      unwrapDI<DIFile>(diFile), line, unwrapDI<DIType>(diType), alwaysPreserve,
      flags, argNo);
  return wrap(v);
}
Exemplo n.º 4
0
int
DefineParameter(
    ClientData clientData,
    Tcl_Interp *interp,
    int objc,
    Tcl_Obj *const objv[])
{
    if (objc != 8) {
	Tcl_WrongNumArgs(interp, 1, objv,
		"DIBuilder scope name argIndex file line type");
	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]);
    int argIndex, line;
    if (Tcl_GetIntFromObj(interp, objv[4], &argIndex) != TCL_OK)
	return TCL_ERROR;
    if (argIndex < 1) {
	Tcl_SetObjResult(interp, Tcl_NewStringObj(
		"argument indices must be at least 1", -1));
	return TCL_ERROR;
    }
    DIFile *file;
    if (GetMetadataFromObj(interp, objv[5], "file", file) != TCL_OK)
	return TCL_ERROR;
    if (Tcl_GetIntFromObj(interp, objv[6], &line) != TCL_OK)
	return TCL_ERROR;
    DIType *type;
    if (GetMetadataFromObj(interp, objv[7], "type", type) != TCL_OK)
	return TCL_ERROR;

#if (LLVM_VERSION_MAJOR >=3 && LLVM_VERSION_MINOR > 7)
    auto val = builder->createParameterVariable(scope, name,
	    (unsigned) argIndex, file, (unsigned) line, type);
#else
    // This API was deprecated (and made private) after 3.7
    auto val = builder->createLocalVariable(
	    llvm::dwarf::DW_TAG_arg_variable, scope, name, file,
	    (unsigned) line, type, false, 0, (unsigned) argIndex);
#endif

    Tcl_SetObjResult(interp, NewMetadataObj(val, "Variable"));
    return TCL_OK;
}
Exemplo n.º 5
0
int
DefineLocal(
    ClientData clientData,
    Tcl_Interp *interp,
    int objc,
    Tcl_Obj *const objv[])
{
    if (objc != 7) {
	Tcl_WrongNumArgs(interp, 1, objv,
		"DIBuilder scope name file line type");
	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;
    int line;
    if (Tcl_GetIntFromObj(interp, objv[5], &line) != TCL_OK)
	return TCL_ERROR;
    DIType *type;
    if (GetMetadataFromObj(interp, objv[6], "type", type) != TCL_OK)
	return TCL_ERROR;

#if (LLVM_VERSION_MAJOR >=3 && LLVM_VERSION_MINOR > 7)
    auto val = builder->createAutoVariable(scope, name,
	    file, (unsigned) line, type);
#else
    // This API was deprecated (and made private) after 3.7
    auto val = builder->createLocalVariable(
	    dwarf::DW_TAG_auto_variable, scope, name, file,
	    (unsigned) line, type);
#endif

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