diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h index 9e3d19e30988..abfb7bd38ff3 100644 --- a/clang/include/clang/Sema/Sema.h +++ b/clang/include/clang/Sema/Sema.h @@ -4325,11 +4325,6 @@ public: ClassTemplateSpecializationDecl *ClassTemplateSpec, TemplateSpecializationKind TSK); - NestedNameSpecifier * - SubstNestedNameSpecifier(NestedNameSpecifier *NNS, - SourceRange Range, - const MultiLevelTemplateArgumentList &TemplateArgs); - NestedNameSpecifierLoc SubstNestedNameSpecifierLoc(NestedNameSpecifierLoc NNS, const MultiLevelTemplateArgumentList &TemplateArgs); diff --git a/clang/lib/Sema/SemaTemplateInstantiate.cpp b/clang/lib/Sema/SemaTemplateInstantiate.cpp index 24acb7a6e03d..4e1976e322da 100644 --- a/clang/lib/Sema/SemaTemplateInstantiate.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiate.cpp @@ -2142,16 +2142,6 @@ bool Sema::SubstExprs(Expr **Exprs, unsigned NumExprs, bool IsCall, return Instantiator.TransformExprs(Exprs, NumExprs, IsCall, Outputs); } -/// \brief Do template substitution on a nested-name-specifier. -NestedNameSpecifier * -Sema::SubstNestedNameSpecifier(NestedNameSpecifier *NNS, - SourceRange Range, - const MultiLevelTemplateArgumentList &TemplateArgs) { - TemplateInstantiator Instantiator(*this, TemplateArgs, Range.getBegin(), - DeclarationName()); - return Instantiator.TransformNestedNameSpecifier(NNS, Range); -} - NestedNameSpecifierLoc Sema::SubstNestedNameSpecifierLoc(NestedNameSpecifierLoc NNS, const MultiLevelTemplateArgumentList &TemplateArgs) { diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h index 6b25d33bbca8..21b7c001df68 100644 --- a/clang/lib/Sema/TreeTransform.h +++ b/clang/lib/Sema/TreeTransform.h @@ -67,7 +67,7 @@ using namespace sema; /// /// Subclasses can customize the transformation at various levels. The /// most coarse-grained transformations involve replacing TransformType(), -/// TransformExpr(), TransformDecl(), TransformNestedNameSpecifier(), +/// TransformExpr(), TransformDecl(), TransformNestedNameSpecifierLoc(), /// TransformTemplateName(), or TransformTemplateArgument() with entirely /// new implementations. /// @@ -375,16 +375,6 @@ public: return cast_or_null(getDerived().TransformDecl(Loc, D)); } - /// \brief Transform the given nested-name-specifier. - /// - /// By default, transforms all of the types and declarations within the - /// nested-name-specifier. Subclasses may override this function to provide - /// alternate behavior. - NestedNameSpecifier *TransformNestedNameSpecifier(NestedNameSpecifier *NNS, - SourceRange Range, - QualType ObjectType = QualType(), - NamedDecl *FirstQualifierInScope = 0); - /// \brief Transform the given nested-name-specifier with source-location /// information. /// @@ -2455,106 +2445,6 @@ bool TreeTransform::TransformExprs(Expr **Inputs, return false; } -template -NestedNameSpecifier * -TreeTransform::TransformNestedNameSpecifier(NestedNameSpecifier *NNS, - SourceRange Range, - QualType ObjectType, - NamedDecl *FirstQualifierInScope) { - NestedNameSpecifier *Prefix = NNS->getPrefix(); - - // Transform the prefix of this nested name specifier. - if (Prefix) { - Prefix = getDerived().TransformNestedNameSpecifier(Prefix, Range, - ObjectType, - FirstQualifierInScope); - if (!Prefix) - return 0; - } - - switch (NNS->getKind()) { - case NestedNameSpecifier::Identifier: - if (Prefix) { - // The object type and qualifier-in-scope really apply to the - // leftmost entity. - ObjectType = QualType(); - FirstQualifierInScope = 0; - } - - assert((Prefix || !ObjectType.isNull()) && - "Identifier nested-name-specifier with no prefix or object type"); - if (!getDerived().AlwaysRebuild() && Prefix == NNS->getPrefix() && - ObjectType.isNull()) - return NNS; - - return getDerived().RebuildNestedNameSpecifier(Prefix, Range, - *NNS->getAsIdentifier(), - ObjectType, - FirstQualifierInScope); - - case NestedNameSpecifier::Namespace: { - NamespaceDecl *NS - = cast_or_null( - getDerived().TransformDecl(Range.getBegin(), - NNS->getAsNamespace())); - if (!getDerived().AlwaysRebuild() && - Prefix == NNS->getPrefix() && - NS == NNS->getAsNamespace()) - return NNS; - - return getDerived().RebuildNestedNameSpecifier(Prefix, Range, NS); - } - - case NestedNameSpecifier::NamespaceAlias: { - NamespaceAliasDecl *Alias - = cast_or_null( - getDerived().TransformDecl(Range.getBegin(), - NNS->getAsNamespaceAlias())); - if (!getDerived().AlwaysRebuild() && - Prefix == NNS->getPrefix() && - Alias == NNS->getAsNamespaceAlias()) - return NNS; - - return getDerived().RebuildNestedNameSpecifier(Prefix, Range, Alias); - } - - case NestedNameSpecifier::Global: - // There is no meaningful transformation that one could perform on the - // global scope. - return NNS; - - case NestedNameSpecifier::TypeSpecWithTemplate: - case NestedNameSpecifier::TypeSpec: { - TemporaryBase Rebase(*this, Range.getBegin(), DeclarationName()); - CXXScopeSpec SS; - SS.MakeTrivial(SemaRef.Context, Prefix, Range); - - TypeSourceInfo *TSInfo - = SemaRef.Context.getTrivialTypeSourceInfo(QualType(NNS->getAsType(), 0), - Range.getEnd()); - TSInfo = TransformTypeInObjectScope(TSInfo, - ObjectType, - FirstQualifierInScope, - SS); - if (!TSInfo) - return 0; - - QualType T = TSInfo->getType(); - if (!getDerived().AlwaysRebuild() && - Prefix == NNS->getPrefix() && - T == QualType(NNS->getAsType(), 0)) - return NNS; - - return getDerived().RebuildNestedNameSpecifier(Prefix, Range, - NNS->getKind() == NestedNameSpecifier::TypeSpecWithTemplate, - T); - } - } - - // Required to silence a GCC warning - return 0; -} - template NestedNameSpecifierLoc TreeTransform::TransformNestedNameSpecifierLoc(