diff options
Diffstat (limited to 'clang/lib/AST/QualTypeNames.cpp')
-rw-r--r-- | clang/lib/AST/QualTypeNames.cpp | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/clang/lib/AST/QualTypeNames.cpp b/clang/lib/AST/QualTypeNames.cpp index 26aaa96a1dc6..7557336f0aaf 100644 --- a/clang/lib/AST/QualTypeNames.cpp +++ b/clang/lib/AST/QualTypeNames.cpp @@ -129,11 +129,9 @@ static const Type *getFullyQualifiedTemplateType(const ASTContext &Ctx, if (const auto *TST = dyn_cast<const TemplateSpecializationType>(TypePtr)) { bool MightHaveChanged = false; SmallVector<TemplateArgument, 4> FQArgs; - for (TemplateSpecializationType::iterator I = TST->begin(), E = TST->end(); - I != E; ++I) { - // Cheap to copy and potentially modified by - // getFullyQualifedTemplateArgument. - TemplateArgument Arg(*I); + // Cheap to copy and potentially modified by + // getFullyQualifedTemplateArgument. + for (TemplateArgument Arg : TST->template_arguments()) { MightHaveChanged |= getFullyQualifiedTemplateArgument( Ctx, Arg, WithGlobalNsPrefix); FQArgs.push_back(Arg); @@ -422,13 +420,6 @@ QualType getFullyQualifiedType(QualType QT, const ASTContext &Ctx, return QT; } - // We don't consider the alias introduced by `using a::X` as a new type. - // The qualified name is still a::X. - if (isa<UsingType>(QT.getTypePtr())) { - return getFullyQualifiedType(QT.getSingleStepDesugaredType(Ctx), Ctx, - WithGlobalNsPrefix); - } - // Remove the part of the type related to the type being a template // parameter (we won't report it as part of the 'type name' and it // is actually make the code below to be more complex (to handle @@ -455,6 +446,14 @@ QualType getFullyQualifiedType(QualType QT, const ASTContext &Ctx, assert(!QT.hasLocalQualifiers()); Keyword = ETypeInput->getKeyword(); } + + // We don't consider the alias introduced by `using a::X` as a new type. + // The qualified name is still a::X. + if (const auto *UT = QT->getAs<UsingType>()) { + QT = Ctx.getQualifiedType(UT->getUnderlyingType(), PrefixQualifiers); + return getFullyQualifiedType(QT, Ctx, WithGlobalNsPrefix); + } + // Create a nested name specifier if needed. Prefix = createNestedNameSpecifierForScopeOf(Ctx, QT.getTypePtr(), true /*FullyQualified*/, |