本文整理汇总了C++中DISubprogram::getLinkageName方法的典型用法代码示例。如果您正苦于以下问题:C++ DISubprogram::getLinkageName方法的具体用法?C++ DISubprogram::getLinkageName怎么用?C++ DISubprogram::getLinkageName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DISubprogram
的用法示例。
在下文中一共展示了DISubprogram::getLinkageName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
/// \brief Get the FunctionSamples for an instruction.
///
/// The FunctionSamples of an instruction \p Inst is the inlined instance
/// in which that instruction is coming from. We traverse the inline stack
/// of that instruction, and match it with the tree nodes in the profile.
///
/// \param Inst Instruction to query.
///
/// \returns the FunctionSamples pointer to the inlined instance.
const FunctionSamples *
SampleProfileLoader::findFunctionSamples(const Instruction &Inst) const {
SmallVector<CallsiteLocation, 10> S;
const DILocation *DIL = Inst.getDebugLoc();
if (!DIL) {
return Samples;
}
StringRef CalleeName;
for (const DILocation *DIL = Inst.getDebugLoc(); DIL;
DIL = DIL->getInlinedAt()) {
DISubprogram *SP = DIL->getScope()->getSubprogram();
if (!SP)
return nullptr;
if (!CalleeName.empty()) {
S.push_back(CallsiteLocation(getOffset(DIL->getLine(), SP->getLine()),
DIL->getDiscriminator(), CalleeName));
}
CalleeName = SP->getLinkageName();
}
if (S.size() == 0)
return Samples;
const FunctionSamples *FS = Samples;
for (int i = S.size() - 1; i >= 0 && FS != nullptr; i--) {
FS = FS->findFunctionSamplesAt(S[i]);
}
return FS;
}
示例2: getFunctionName
static StringRef getFunctionName(DISubprogram SP) {
if (!SP.getLinkageName().empty())
return SP.getLinkageName();
return SP.getName();
}