本文整理汇总了C++中DIScope::isSubprogram方法的典型用法代码示例。如果您正苦于以下问题:C++ DIScope::isSubprogram方法的具体用法?C++ DIScope::isSubprogram怎么用?C++ DIScope::isSubprogram使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DIScope
的用法示例。
在下文中一共展示了DIScope::isSubprogram方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: processScope
void DebugInfoFinder::processScope(DIScope Scope) {
if (Scope.isType()) {
DIType Ty(Scope);
processType(Ty);
return;
}
if (Scope.isCompileUnit()) {
addCompileUnit(DICompileUnit(Scope));
return;
}
if (Scope.isSubprogram()) {
processSubprogram(DISubprogram(Scope));
return;
}
if (!addScope(Scope))
return;
if (Scope.isLexicalBlock()) {
DILexicalBlock LB(Scope);
processScope(LB.getContext());
} else if (Scope.isLexicalBlockFile()) {
DILexicalBlockFile LBF = DILexicalBlockFile(Scope);
processScope(LBF.getScope());
} else if (Scope.isNameSpace()) {
DINameSpace NS(Scope);
processScope(NS.getContext());
}
}
示例2: ShowContext
void DIEItem::ShowContext(DetailsView* detailsView, DIScope scope) {
// TODO: Fill out these cases.
if (scope.isCompileUnit()) {
DICompileUnit diCompileUnit(scope);
detailsView->Add(_("ContextType"), _("DICompileUnit"));
detailsView->Add(_("Context"),
toWxStr(diCompileUnit.getDirectory()) + _("/") +
toWxStr(diCompileUnit.getFilename()));
} else if (scope.isFile()) {
DIFile diFile(scope);
detailsView->Add(_("ContextType"), _("DIFile"));
detailsView->Add(_("Context"),
toWxStr(diFile.getDirectory()) + _("/") +
toWxStr(diFile.getFilename()));
} else if (scope.isNameSpace()) {
DINameSpace diNameSpace(scope);
detailsView->Add(_("ContextType"), _("DINameSpace"));
detailsView->Add(_("Context"), diNameSpace.getName());
} else if (scope.isSubprogram()) {
DISubprogram diSubprogram(scope);
detailsView->Add(_("ContextType"), _("DISubprogram"));
detailsView->Add(_("Context"), diSubprogram.getName());
} else if (scope.isLexicalBlock()) {
detailsView->Add(_("ContextType"), _("DILexicalBlock"));
// TODO: Implement context name.
detailsView->Add(_("Context"), _("?{}"));
} else if (scope.isType()) {
detailsView->Add(_("ContextType"), _("DIType"));
detailsView->Add(_("Context"), DITypeToString(DIType(scope)));
} else {
detailsView->Add(_("Context"), _("??? [Unknown]"));
}
}
示例3: printLocation
// Print source location of function, and display name,
// falls back to printing the module's location and the function's LLVM name.
static void printLocation(const llvm::Function *F) {
unsigned MDDebugKind = F->getParent()->getMDKindID("dbg");
if (MDDebugKind) {
// Try to find the function's name and location
for (Function::const_iterator I=F->begin(),E=F->end();
I != E; ++I) {
if (const TerminatorInst *T = I->getTerminator()) {
if (MDNode *N = T->getMetadata(MDDebugKind)) {
DILocation Loc(N);
DIScope Scope = Loc.getScope();
while (Scope.isLexicalBlock()) {
DILexicalBlock LB(Scope.getNode());
Scope = LB.getContext();
}
if (Scope.isSubprogram()) {
DISubprogram SP(Scope.getNode());
errs() << /*Loc.getDirectory() << "/" << */Loc.getFilename()
<< ": in function '"
<< SP.getDisplayName()
<< "': ";
return;
}
}
}
}
}
// Fallback to printing module location and function name
printLocation(F->getParent());
errs() << "in function '" << F->getName() << "': ";
}