[cfe-commits] r126853 - in /cfe/trunk: include/clang/Sema/Sema.h lib/Sema/SemaTemplateInstantiate.cpp lib/Sema/TreeTransform.h
Douglas Gregor
dgregor at apple.com
Wed Mar 2 10:50:38 PST 2011
Author: dgregor
Date: Wed Mar 2 12:50:38 2011
New Revision: 126853
URL: http://llvm.org/viewvc/llvm-project?rev=126853&view=rev
Log:
Kill off TreeTransform::TransformNestedNameSpecifier() in favor of the
source-location-preserving
TreeTransform::TranformNestedNameSpecifierLoc(). No functionality
change: the victim had no callers (that themselves had callers) anyway.
Modified:
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
cfe/trunk/lib/Sema/TreeTransform.h
Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=126853&r1=126852&r2=126853&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Wed Mar 2 12:50:38 2011
@@ -4325,11 +4325,6 @@
ClassTemplateSpecializationDecl *ClassTemplateSpec,
TemplateSpecializationKind TSK);
- NestedNameSpecifier *
- SubstNestedNameSpecifier(NestedNameSpecifier *NNS,
- SourceRange Range,
- const MultiLevelTemplateArgumentList &TemplateArgs);
-
NestedNameSpecifierLoc
SubstNestedNameSpecifierLoc(NestedNameSpecifierLoc NNS,
const MultiLevelTemplateArgumentList &TemplateArgs);
Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp?rev=126853&r1=126852&r2=126853&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp Wed Mar 2 12:50:38 2011
@@ -2142,16 +2142,6 @@
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) {
Modified: cfe/trunk/lib/Sema/TreeTransform.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/TreeTransform.h?rev=126853&r1=126852&r2=126853&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/TreeTransform.h (original)
+++ cfe/trunk/lib/Sema/TreeTransform.h Wed Mar 2 12:50:38 2011
@@ -67,7 +67,7 @@
///
/// 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 @@
return cast_or_null<NamedDecl>(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.
///
@@ -2456,106 +2446,6 @@
}
template<typename Derived>
-NestedNameSpecifier *
-TreeTransform<Derived>::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<NamespaceDecl>(
- 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<NamespaceAliasDecl>(
- 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<typename Derived>
NestedNameSpecifierLoc
TreeTransform<Derived>::TransformNestedNameSpecifierLoc(
NestedNameSpecifierLoc NNS,
More information about the cfe-commits
mailing list