当前位置: 首页>>代码示例>>C++>>正文


C++ DIBuilder类代码示例

本文整理汇总了C++中DIBuilder的典型用法代码示例。如果您正苦于以下问题:C++ DIBuilder类的具体用法?C++ DIBuilder怎么用?C++ DIBuilder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了DIBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: mono_llvm_di_create_file

void*
mono_llvm_di_create_file (void *di_builder, const char *dir, const char *file)
{
	DIBuilder *builder = (DIBuilder*)di_builder;

	return builder->createFile (file, dir);
}
开发者ID:TheMetalMage,项目名称:mono,代码行数:7,代码来源:mini-llvm-cpp.cpp

示例2: DefineNamespace

int
DefineNamespace(
    ClientData clientData,
    Tcl_Interp *interp,
    int objc,
    Tcl_Obj *const objv[])
{
    if (objc != 6) {
	Tcl_WrongNumArgs(interp, 1, objv, "DIBuilder scope name file line");
	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;

    auto val = builder->createNameSpace(scope, name, file, line);

    Tcl_SetObjResult(interp, NewMetadataObj(val, "Namespace"));
    return TCL_OK;
}
开发者ID:jdc8,项目名称:llvmtcl,代码行数:31,代码来源:debuginfo.cpp

示例3: mono_llvm_di_create_compile_unit

void*
mono_llvm_di_create_compile_unit (void *di_builder, const char *cu_name, const char *dir, const char *producer)
{
	DIBuilder *builder = (DIBuilder*)di_builder;

	return builder->createCompileUnit (dwarf::DW_LANG_C99, cu_name, dir, producer, true, "", 0);
}
开发者ID:TheMetalMage,项目名称:mono,代码行数:7,代码来源:mini-llvm-cpp.cpp

示例4: DefineCompileUnit

int
DefineCompileUnit(
    ClientData clientData,
    Tcl_Interp *interp,
    int objc,
    Tcl_Obj *const objv[])
{
    if (objc != 5) {
	Tcl_WrongNumArgs(interp, 1, objv,
		"DIBuilder file directory producer");
	return TCL_ERROR;
    }

    DIBuilder *builder;
    if (GetDIBuilderFromObj(interp, objv[1], builder) != TCL_OK)
	return TCL_ERROR;
    unsigned lang = dwarf::DW_LANG_lo_user;//No standard value for Tcl!
    std::string file = Tcl_GetString(objv[2]);
    std::string dir = Tcl_GetString(objv[3]);
    std::string producer = Tcl_GetString(objv[4]);
    std::string flags = "";
    unsigned runtimeVersion = 0;

    auto val = builder->createCompileUnit(lang, file, dir, producer, true,
	    flags, runtimeVersion);

    Tcl_SetObjResult(interp, NewMetadataObj(val, "CompileUnit"));
    return TCL_OK;
}
开发者ID:jdc8,项目名称:llvmtcl,代码行数:29,代码来源:debuginfo.cpp

示例5: LLVMDIBuilderCreateEnumerationType

LLVMValueRef LLVMDIBuilderCreateEnumerationType(
  LLVMDIBuilderRef D,
  LLVMValueRef Scope,
  const char *Name,
  LLVMValueRef File,
  unsigned LineNumber,
  uint64_t SizeInBits,
  uint64_t AlignInBits,
  LLVMValueRef Elements,
  LLVMValueRef UnderlyingType,
  const char *UniqueIdentifier)
{
  DIBuilder *db = unwrap(D);
  DICompositeType CT = db->createEnumerationType(
    unwrapDI<DIDescriptor>(Scope),
    Name,
    unwrapDI<DIFile>(File),
    LineNumber,
    SizeInBits,
    AlignInBits,
    unwrapDI<DIArray>(Elements),
    unwrapDI<DIType>(UnderlyingType),
    UniqueIdentifier);
  return wrap(CT);
}
开发者ID:RodneyBates,项目名称:M3Devel,代码行数:25,代码来源:DIBuilderBindings.cpp

示例6: LLVMDIBuilderCreateCompileUnit

LLVMValueRef LLVMDIBuilderCreateCompileUnit(
  LLVMDIBuilderRef D,
  unsigned Lang,
  const char *File,
  const char *Dir,
  const char *Producer,
  bool Optimized,
  const char *Flags,
  unsigned RuntimeVersion)
{
  DIBuilder *db = unwrap(D);
  DICompileUnit CU = db->createCompileUnit(
    Lang,
    File,
    Dir,
    Producer,
    Optimized,
    Flags,
    RuntimeVersion);
    return wrap(CU);

  //LLVMValueRef val;
  // return reinterpret_cast<LLVMValueRef>(&CU);
//    return reinterpret_cast<LLVMValueRef>(const_cast<DICompileUnit*>(CU));

}
开发者ID:RodneyBates,项目名称:M3Devel,代码行数:26,代码来源:DIBuilderBindings.cpp

示例7: LLVMDIBuilderCreateClassType

LLVMValueRef LLVMDIBuilderCreateClassType(
  LLVMDIBuilderRef D,
  LLVMValueRef Scope,
  const char *Name,
  LLVMValueRef File,
  unsigned LineNumber,
  uint64_t SizeInBits,
  uint64_t AlignInBits,
  uint64_t OffsetInBits,
  unsigned Flags,
  LLVMValueRef DerivedFrom,
  LLVMValueRef Elements)
{
  DIBuilder *db = unwrap(D);
  DICompositeType CT = db->createClassType(
    unwrapDI<DIDescriptor>(Scope),
    Name,
    unwrapDI<DIFile>(File),
    LineNumber,
    SizeInBits,
    AlignInBits,
    OffsetInBits,
    Flags,
    unwrapDI<DIType>(DerivedFrom),
    unwrapDI<DIArray>(Elements));
  return wrap(CT);
}
开发者ID:RodneyBates,项目名称:M3Devel,代码行数:27,代码来源:DIBuilderBindings.cpp

示例8: LLVMDIBuilderCreateMemberType

LLVMValueRef LLVMDIBuilderCreateMemberType(
  LLVMDIBuilderRef D,
  LLVMValueRef Scope,
  const char *Name,
  LLVMValueRef File,
  unsigned Line,
  uint64_t SizeInBits,
  uint64_t AlignInBits,
  uint64_t OffsetInBits,
  unsigned Flags,
  LLVMValueRef Ty)
{
  DIBuilder *db = unwrap(D);
  DIDerivedType DT = db->createMemberType(
    unwrapDI<DIDescriptor>(Scope),
    Name,
    unwrapDI<DIFile>(File),
    Line,
    SizeInBits,
    AlignInBits,
    OffsetInBits,
    Flags,
    unwrapDI<DIType>(Ty));
  return wrap(DT);
}
开发者ID:RodneyBates,项目名称:M3Devel,代码行数:25,代码来源:DIBuilderBindings.cpp

示例9: LLVMDIBuilderCreateReplaceableForwardDecl

LLVMValueRef LLVMDIBuilderCreateReplaceableForwardDecl(
  LLVMDIBuilderRef D,
  unsigned Tag,
  const char *Name,
  LLVMValueRef Scope,
  LLVMValueRef File,
  unsigned Line,
  unsigned RuntimeLang,
  uint64_t SizeInBits,
  uint64_t AlignInBits,
  const char *UniqueIdentifier)
{
  DIBuilder *db = unwrap(D);
  DICompositeType CT = db->createReplaceableForwardDecl(
    Tag,
    Name,
    unwrapDI<DIScope>(Scope),
    unwrapDI<DIFile>(File),
    Line,
    RuntimeLang,
    SizeInBits,
    AlignInBits,
    UniqueIdentifier);
  return wrap(CT);
}
开发者ID:RodneyBates,项目名称:M3Devel,代码行数:25,代码来源:DIBuilderBindings.cpp

示例10: LLVMDIBuilderCreateLocalVariable

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);
}
开发者ID:RodneyBates,项目名称:M3Devel,代码行数:25,代码来源:DIBuilderBindings.cpp

示例11: LLVMDIBuilderCreateFunction

LLVMValueRef LLVMDIBuilderCreateFunction(
  LLVMDIBuilderRef D,
  LLVMValueRef Scope,
  const char *Name,
  const char *LinkageName,
  LLVMValueRef File,
  unsigned Line,
  LLVMValueRef CompositeType,
  bool IsLocalToUnit,
  bool IsDefinition,
  unsigned ScopeLine,
  unsigned Flags,
  bool IsOptimized,
  LLVMValueRef Func)
{
  DIBuilder *db = unwrap(D);
  DISubprogram SP = db->createFunction(
    unwrapDI<DIDescriptor>(Scope),
    Name,
    LinkageName,
    unwrapDI<DIFile>(File),
    Line,
    unwrapDI<DICompositeType>(CompositeType),
    IsLocalToUnit,
    IsDefinition,
    ScopeLine,
    Flags,
    IsOptimized,
    unwrap<Function>(Func));
  return wrap(SP);
}
开发者ID:RodneyBates,项目名称:M3Devel,代码行数:31,代码来源:DIBuilderBindings.cpp

示例12: errs

void Variables::updateMetadata(Module& module, Value* oldTarget, Value* newTarget, Type* newType) {

  vector<Instruction*> to_remove;
  if (newTarget) {
    errs() << "\tChanging metadata for: " << newTarget->getName() << "\n";
    bool changed = false;

    for(Module::iterator f = module.begin(), fe = module.end(); f != fe; f++) {
      for(Function::iterator b = f->begin(), be = f->end(); b != be; b++) {
	for(BasicBlock::iterator i = b->begin(), ie = b->end(); i != ie; i++) {
	  
	  if (DbgDeclareInst *oldDeclare = dyn_cast<DbgDeclareInst>(i)) {
	    if (Value *address = oldDeclare->getAddress()) {
	      if (AllocaInst *allocaInst = dyn_cast<AllocaInst>(address)) {
		if (allocaInst == oldTarget) { // the alloca we are looking for

		  DIVariable oldDIVar(oldDeclare->getVariable());
		  MDNode* newDIType = getTypeMetadata(module, oldDIVar, newType);
		  
		  // construct new DIVariable with new type descriptor
		  vector<Value*> doperands;
		  for(unsigned i = 0; i < oldDIVar->getNumOperands(); i++) {
		    if (i == 5) { // the argument that corresponds to the type descriptor
		      doperands.push_back(newDIType);
		    }
		    else {
		      doperands.push_back(oldDIVar->getOperand(i)); // preserve other descriptors
		    }
		  }
		  ArrayRef<Value*> *arrayRefDOperands = new ArrayRef<Value*>(doperands);
		  MDNode* newMDNode = MDNode::get(module.getContext(), *arrayRefDOperands);
		  DIVariable newDIVar(newMDNode);
		  
		  // insert new declare instruction
		  DIBuilder* builder = new DIBuilder(module);
		  Instruction *newDeclare = builder->insertDeclare(newTarget, newDIVar, oldDeclare);
		  
		  // make sure the declare instruction preserves its own metadata
		  unsigned id = 0;
		  if (oldDeclare->getMetadata(id)) {
		    newDeclare->setMetadata(id, oldDeclare->getMetadata(id));
		  }
		  to_remove.push_back(oldDeclare); // can't erase while iterating through instructions
		  changed = true;
		}
	      }
	    }
	  }
	}
      }
    }
    for(unsigned i = 0; i < to_remove.size(); i++) {
      to_remove[i]->eraseFromParent();
    }
    if (!changed) {
      errs() << "\tNo metadata to change\n";
    }
  }
  return;
}
开发者ID:Sumith1896,项目名称:precimonious,代码行数:60,代码来源:Variables.cpp

示例13: mono_llvm_di_builder_finalize

void
mono_llvm_di_builder_finalize (void *di_builder)
{
	DIBuilder *builder = (DIBuilder*)di_builder;

	builder->finalize ();
}
开发者ID:TheMetalMage,项目名称:mono,代码行数:7,代码来源:mini-llvm-cpp.cpp

示例14: DefineAliasType

int
DefineAliasType(
    ClientData clientData,
    Tcl_Interp *interp,
    int objc,
    Tcl_Obj *const objv[])
{
    if (objc != 7) {
	Tcl_WrongNumArgs(interp, 1, objv,
		"DIBuilder type name file line contextScope");
	return TCL_ERROR;
    }

    DIBuilder *builder;
    if (GetDIBuilderFromObj(interp, objv[1], builder) != TCL_OK)
	return TCL_ERROR;
    DIType *type;
    if (GetMetadataFromObj(interp, objv[2], "type", type) != 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;
    DIScope *context;
    if (GetMetadataFromObj(interp, objv[6], "context", context) != TCL_OK)
	return TCL_ERROR;

    auto val = builder->createTypedef(type, name, file, line, context);

    Tcl_SetObjResult(interp, NewMetadataObj(val, "AliasType"));
    return TCL_OK;
}
开发者ID:jdc8,项目名称:llvmtcl,代码行数:35,代码来源:debuginfo.cpp

示例15: DefineBasicType

int
DefineBasicType(
    ClientData clientData,
    Tcl_Interp *interp,
    int objc,
    Tcl_Obj *const objv[])
{
    if (objc != 5) {
	Tcl_WrongNumArgs(interp, 1, objv,
		"DIBuilder name sizeInBits dwarfTypeCode");
	return TCL_ERROR;
    }

    DIBuilder *builder;
    if (GetDIBuilderFromObj(interp, objv[1], builder) != TCL_OK)
	return TCL_ERROR;
    std::string name = Tcl_GetString(objv[2]);
    int size, align = 0, dwarfTypeCode;
    if (Tcl_GetIntFromObj(interp, objv[3], &size) != TCL_OK)
	return TCL_ERROR;
    if (Tcl_GetIntFromObj(interp, objv[4], &dwarfTypeCode) != TCL_OK)
	return TCL_ERROR;

    auto val = builder->createBasicType(name,
	    (uint64_t) size, (uint64_t) align, (unsigned) dwarfTypeCode);

    Tcl_SetObjResult(interp, NewMetadataObj(val, "BasicType"));
    return TCL_OK;
}
开发者ID:jdc8,项目名称:llvmtcl,代码行数:29,代码来源:debuginfo.cpp


注:本文中的DIBuilder类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。