本文整理汇总了C++中GenericParamList::getParams方法的典型用法代码示例。如果您正苦于以下问题:C++ GenericParamList::getParams方法的具体用法?C++ GenericParamList::getParams怎么用?C++ GenericParamList::getParams使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GenericParamList
的用法示例。
在下文中一共展示了GenericParamList::getParams方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initDocGenericParams
static void initDocGenericParams(const Decl *D, DocEntityInfo &Info) {
GenericParamList *GenParams = nullptr;
if (auto *NTD = dyn_cast<NominalTypeDecl>(D)) {
GenParams = NTD->getGenericParams();
} else if (auto *AFD = dyn_cast<AbstractFunctionDecl>(D)) {
GenParams = AFD->getGenericParams();
} else if (auto *ExtD = dyn_cast<ExtensionDecl>(D)) {
GenParams = ExtD->getGenericParams();
}
if (!GenParams)
return;
for (auto *GP : GenParams->getParams()) {
if (GP->isImplicit())
continue;
DocGenericParam Param;
Param.Name = GP->getNameStr();
if (!GP->getInherited().empty()) {
llvm::raw_string_ostream OS(Param.Inherits);
GP->getInherited()[0].getType().print(OS);
}
Info.GenericParams.push_back(Param);
}
for (auto &Req : GenParams->getRequirements()) {
std::string ReqStr;
llvm::raw_string_ostream OS(ReqStr);
Req.printAsWritten(OS);
OS.flush();
Info.GenericRequirements.push_back(std::move(ReqStr));
}
}
示例2: assert
GenericTypeParamType *DeclContext::getProtocolSelfType() const {
assert(getSelfProtocolDecl() && "not a protocol");
GenericParamList *genericParams;
if (auto proto = dyn_cast<ProtocolDecl>(this)) {
genericParams = proto->getGenericParams();
} else {
genericParams = cast<ExtensionDecl>(this)->getGenericParams();
}
if (genericParams == nullptr)
return nullptr;
return genericParams->getParams().front()
->getDeclaredInterfaceType()
->castTo<GenericTypeParamType>();
}
示例3: getSimpleSubstitution
static Substitution getSimpleSubstitution(GenericParamList &generics,
CanType typeArg) {
assert(generics.getParams().size() == 1);
auto typeParamDecl = generics.getParams().front();
return Substitution{typeParamDecl->getArchetype(), typeArg, {}};
}
示例4: getSimpleSubstitution
static Substitution getSimpleSubstitution(GenericParamList &generics,
CanType typeArg) {
assert(generics.getParams().size() == 1);
return Substitution{typeArg, {}};
}