本文整理汇总了C++中TemplateSpecializationTypeLoc::setTemplateNameLoc方法的典型用法代码示例。如果您正苦于以下问题:C++ TemplateSpecializationTypeLoc::setTemplateNameLoc方法的具体用法?C++ TemplateSpecializationTypeLoc::setTemplateNameLoc怎么用?C++ TemplateSpecializationTypeLoc::setTemplateNameLoc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TemplateSpecializationTypeLoc
的用法示例。
在下文中一共展示了TemplateSpecializationTypeLoc::setTemplateNameLoc方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ActOnCXXNestedNameSpecifier
bool Sema::ActOnCXXNestedNameSpecifier(Scope *S,
SourceLocation TemplateLoc,
CXXScopeSpec &SS,
TemplateTy Template,
SourceLocation TemplateNameLoc,
SourceLocation LAngleLoc,
ASTTemplateArgsPtr TemplateArgsIn,
SourceLocation RAngleLoc,
SourceLocation CCLoc,
bool EnteringContext) {
if (SS.isInvalid())
return true;
// Translate the parser's template argument list in our AST format.
TemplateArgumentListInfo TemplateArgs(LAngleLoc, RAngleLoc);
translateTemplateArguments(TemplateArgsIn, TemplateArgs);
if (DependentTemplateName *DTN = Template.get().getAsDependentTemplateName()){
// Handle a dependent template specialization for which we cannot resolve
// the template name.
assert(DTN->getQualifier()
== static_cast<NestedNameSpecifier*>(SS.getScopeRep()));
QualType T = Context.getDependentTemplateSpecializationType(ETK_None,
DTN->getQualifier(),
DTN->getIdentifier(),
TemplateArgs);
// Create source-location information for this type.
TypeLocBuilder Builder;
DependentTemplateSpecializationTypeLoc SpecTL
= Builder.push<DependentTemplateSpecializationTypeLoc>(T);
SpecTL.setLAngleLoc(LAngleLoc);
SpecTL.setRAngleLoc(RAngleLoc);
SpecTL.setKeywordLoc(SourceLocation());
SpecTL.setNameLoc(TemplateNameLoc);
SpecTL.setQualifierLoc(SS.getWithLocInContext(Context));
for (unsigned I = 0, N = TemplateArgs.size(); I != N; ++I)
SpecTL.setArgLocInfo(I, TemplateArgs[I].getLocInfo());
SS.Extend(Context, TemplateLoc, Builder.getTypeLocInContext(Context, T),
CCLoc);
return false;
}
if (Template.get().getAsOverloadedTemplate() ||
isa<FunctionTemplateDecl>(Template.get().getAsTemplateDecl())) {
SourceRange R(TemplateNameLoc, RAngleLoc);
if (SS.getRange().isValid())
R.setBegin(SS.getRange().getBegin());
Diag(CCLoc, diag::err_non_type_template_in_nested_name_specifier)
<< Template.get() << R;
NoteAllFoundTemplates(Template.get());
return true;
}
// We were able to resolve the template name to an actual template.
// Build an appropriate nested-name-specifier.
QualType T = CheckTemplateIdType(Template.get(), TemplateNameLoc,
TemplateArgs);
if (T.isNull())
return true;
// Alias template specializations can produce types which are not valid
// nested name specifiers.
if (!T->isDependentType() && !T->getAs<TagType>()) {
Diag(TemplateNameLoc, diag::err_nested_name_spec_non_tag) << T;
NoteAllFoundTemplates(Template.get());
return true;
}
// Provide source-location information for the template specialization
// type.
TypeLocBuilder Builder;
TemplateSpecializationTypeLoc SpecTL
= Builder.push<TemplateSpecializationTypeLoc>(T);
SpecTL.setLAngleLoc(LAngleLoc);
SpecTL.setRAngleLoc(RAngleLoc);
SpecTL.setTemplateNameLoc(TemplateNameLoc);
for (unsigned I = 0, N = TemplateArgs.size(); I != N; ++I)
SpecTL.setArgLocInfo(I, TemplateArgs[I].getLocInfo());
SS.Extend(Context, TemplateLoc, Builder.getTypeLocInContext(Context, T),
CCLoc);
return false;
}