本文整理汇总了C++中DIBuilder::createFunction方法的典型用法代码示例。如果您正苦于以下问题:C++ DIBuilder::createFunction方法的具体用法?C++ DIBuilder::createFunction怎么用?C++ DIBuilder::createFunction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DIBuilder
的用法示例。
在下文中一共展示了DIBuilder::createFunction方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
示例2: LLVMDIBuilderCreateFunction
LLVMMetadataRef LLVMDIBuilderCreateFunction(
LLVMDIBuilderRef Dref, LLVMMetadataRef Scope, const char *Name,
const char *LinkageName, LLVMMetadataRef File, unsigned Line,
LLVMMetadataRef CompositeType, int IsLocalToUnit, int IsDefinition,
unsigned ScopeLine, unsigned Flags, int IsOptimized) {
DIBuilder *D = unwrap(Dref);
return wrap(D->createFunction(
unwrap<DIScope>(Scope), Name, LinkageName,
File ? unwrap<DIFile>(File) : nullptr, Line,
unwrap<DISubroutineType>(CompositeType), IsLocalToUnit, IsDefinition,
ScopeLine, static_cast<DINode::DIFlags>(Flags), IsOptimized));
}
示例3:
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);
}
示例4: SP
virtual Value * materializeValueFor(Value * V) {
if(Function * fn = dyn_cast<Function>(V)) {
assert(fn->getParent() == src);
Function * newfn = dest->getFunction(fn->getName());
if(!newfn) {
newfn = Function::Create(fn->getFunctionType(),fn->getLinkage(), fn->getName(),dest);
newfn->copyAttributesFrom(fn);
}
if(!fn->isDeclaration() && newfn->isDeclaration() && copyGlobal(fn,data)) {
for(Function::arg_iterator II = newfn->arg_begin(), I = fn->arg_begin(), E = fn->arg_end(); I != E; ++I, ++II) {
II->setName(I->getName());
VMap[I] = II;
}
VMap[fn] = newfn;
SmallVector<ReturnInst*,8> Returns;
CloneFunctionInto(newfn, fn, VMap, true, Returns, "", NULL, NULL, this);
}
return newfn;
} else if(GlobalVariable * GV = dyn_cast<GlobalVariable>(V)) {
GlobalVariable * newGV = dest->getGlobalVariable(GV->getName(),true);
if(!newGV) {
newGV = new GlobalVariable(*dest,GV->getType()->getElementType(),GV->isConstant(),GV->getLinkage(),NULL,GV->getName(),NULL,GlobalVariable::NotThreadLocal,GV->getType()->getAddressSpace());
newGV->copyAttributesFrom(GV);
if(!GV->isDeclaration()) {
if(!copyGlobal(GV,data)) {
newGV->setExternallyInitialized(true);
} else if(GV->hasInitializer()) {
Value * C = MapValue(GV->getInitializer(),VMap,RF_None,NULL,this);
newGV->setInitializer(cast<Constant>(C));
}
}
}
return newGV;
} else if(MDNode * MD = dyn_cast<MDNode>(V)) {
DISubprogram SP(MD);
if(DI != NULL && SP.isSubprogram()) {
if(Function * OF = SP.getFunction()) {
Function * F = cast<Function>(MapValue(OF,VMap,RF_None,NULL,this));
DISubprogram NSP = DI->createFunction(SP.getContext(), SP.getName(), SP.getLinkageName(),
DI->createFile(SP.getFilename(),SP.getDirectory()),
SP.getLineNumber(), SP.getType(),
SP.isLocalToUnit(), SP.isDefinition(),
SP.getScopeLineNumber(),SP.getFlags(),SP.isOptimized(),
F);
return NSP;
}
/* fallthrough */
}
/* fallthrough */
}
return NULL;
}
示例5: LLVMDIBuilderCreateFunction
LLVMMetadataRef LLVMDIBuilderCreateFunction(
LLVMDIBuilderRef Dref, LLVMMetadataRef Scope, const char *Name,
const char *LinkageName, LLVMMetadataRef File, unsigned Line,
LLVMMetadataRef CompositeType, int IsLocalToUnit, int IsDefinition,
unsigned ScopeLine, unsigned Flags, int IsOptimized, LLVMValueRef Func) {
DIBuilder *D = unwrap(Dref);
DISubprogram SP = D->createFunction(
unwrap<MDScope>(Scope), Name, LinkageName,
File ? unwrap<MDFile>(File) : nullptr, Line,
unwrap<MDSubroutineType>(CompositeType), IsLocalToUnit, IsDefinition,
ScopeLine, Flags, IsOptimized, unwrap<Function>(Func));
return wrap(SP);
}
示例6: DIBuilderCreateFunction
LLVMValueRef DIBuilderCreateFunction(LLVMDIBuilderRef dref,
LLVMValueRef diScope, const char *name,
const char *linkageName,
LLVMValueRef diFile, unsigned line,
LLVMValueRef diCompositeType,
int isLocalToUnit, int isDefinition,
unsigned scopeLine, unsigned flags,
int isOptimized, LLVMValueRef function) {
DIBuilder *d = unwrap(dref);
DISubprogram sp = d->createFunction(
unwrapDI<DIDescriptor>(diScope), StringRef(name), StringRef(linkageName),
unwrapDI<DIFile>(diFile), line,
unwrapDI<DICompositeType>(diCompositeType), isLocalToUnit, isDefinition,
scopeLine, flags, isOptimized, unwrap<Function>(function));
return wrap(sp);
}
示例7:
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;
}
示例8: NewMetadataObj
int
DefineFunction(
ClientData clientData,
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
{
if (objc != 8) {
Tcl_WrongNumArgs(interp, 1, objv,
"DIBuilder scope name linkName file line subroutineType");
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]);
std::string linkName = Tcl_GetString(objv[4]);
DIFile *file;
if (GetMetadataFromObj(interp, objv[5], "file", file) != TCL_OK)
return TCL_ERROR;
int line;
if (Tcl_GetIntFromObj(interp, objv[6], &line) != TCL_OK)
return TCL_ERROR;
DISubroutineType *type;
if (GetMetadataFromObj(interp, objv[7], "subroutine type", type) != TCL_OK)
return TCL_ERROR;
unsigned flags = 0;
bool isOpt = true, isLocal = true, isDef = true;
auto val = builder->createFunction(scope, name, linkName, file, line,
type, isLocal, isDef, line, flags, isOpt);
Tcl_SetObjResult(interp, NewMetadataObj(val, "Function"));
return TCL_OK;
}