本文整理汇总了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);
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
示例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));
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例13: mono_llvm_di_builder_finalize
void
mono_llvm_di_builder_finalize (void *di_builder)
{
DIBuilder *builder = (DIBuilder*)di_builder;
builder->finalize ();
}
示例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;
}
示例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;
}