本文整理汇总了C++中NamedDecl::hasExternalLinkage方法的典型用法代码示例。如果您正苦于以下问题:C++ NamedDecl::hasExternalLinkage方法的具体用法?C++ NamedDecl::hasExternalLinkage怎么用?C++ NamedDecl::hasExternalLinkage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NamedDecl
的用法示例。
在下文中一共展示了NamedDecl::hasExternalLinkage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getUndefinedButUsed
/// Obtains a sorted list of functions that are undefined but ODR-used.
void Sema::getUndefinedButUsed(
SmallVectorImpl<std::pair<NamedDecl *, SourceLocation> > &Undefined) {
for (llvm::DenseMap<NamedDecl *, SourceLocation>::iterator
I = UndefinedButUsed.begin(), E = UndefinedButUsed.end();
I != E; ++I) {
NamedDecl *ND = I->first;
// Ignore attributes that have become invalid.
if (ND->isInvalidDecl()) continue;
// __attribute__((weakref)) is basically a definition.
if (ND->hasAttr<WeakRefAttr>()) continue;
if (FunctionDecl *FD = dyn_cast<FunctionDecl>(ND)) {
if (FD->isDefined())
continue;
if (FD->hasExternalLinkage() &&
!FD->getMostRecentDecl()->isInlined())
continue;
} else {
if (cast<VarDecl>(ND)->hasDefinition() != VarDecl::DeclarationOnly)
continue;
if (ND->hasExternalLinkage())
continue;
}
Undefined.push_back(std::make_pair(ND, I->second));
}
// Sort (in order of use site) so that we're not dependent on the iteration
// order through an llvm::DenseMap.
std::sort(Undefined.begin(), Undefined.end(),
SortUndefinedButUsed(Context.getSourceManager()));
}