本文整理汇总了C++中NominalTypeDecl::getGenericParams方法的典型用法代码示例。如果您正苦于以下问题:C++ NominalTypeDecl::getGenericParams方法的具体用法?C++ NominalTypeDecl::getGenericParams怎么用?C++ NominalTypeDecl::getGenericParams使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NominalTypeDecl
的用法示例。
在下文中一共展示了NominalTypeDecl::getGenericParams方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: lookupTypeMembers
/// \brief Enumerate immediate members of the type \c LookupType and its
/// extensions, as seen from the context \c CurrDC.
///
/// Don't do lookup into superclasses or implemented protocols. Uses
/// \p BaseType as the underlying type when checking any constraints on the
/// extensions.
static void lookupTypeMembers(Type BaseType, Type LookupType,
VisibleDeclConsumer &Consumer,
const DeclContext *CurrDC, LookupState LS,
DeclVisibilityKind Reason,
LazyResolver *TypeResolver) {
NominalTypeDecl *D = LookupType->getAnyNominal();
assert(D && "should have a nominal type");
bool LookupFromChildDeclContext = false;
const DeclContext *TempDC = CurrDC;
while (!TempDC->isModuleContext()) {
if (TempDC == D) {
LookupFromChildDeclContext = true;
break;
}
TempDC = TempDC->getParent();
}
SmallVector<ValueDecl*, 2> FoundDecls;
if (LookupFromChildDeclContext) {
// Current decl context is contained inside 'D', so generic parameters
// are visible.
if (D->getGenericParams())
for (auto Param : *D->getGenericParams())
if (isDeclVisibleInLookupMode(Param, LS, CurrDC, TypeResolver))
FoundDecls.push_back(Param);
}
for (Decl *Member : D->getMembers()) {
if (auto *VD = dyn_cast<ValueDecl>(Member))
if (isDeclVisibleInLookupMode(VD, LS, CurrDC, TypeResolver))
FoundDecls.push_back(VD);
}
doGlobalExtensionLookup(BaseType, LookupType, FoundDecls, CurrDC, LS, Reason,
TypeResolver);
// Report the declarations we found to the consumer.
for (auto *VD : FoundDecls)
Consumer.foundDecl(VD, Reason);
}