[cfe-commits] r110677 - in /cfe/trunk/lib/Sema: SemaTemplate.cpp SemaType.cpp TreeTransform.h
Abramo Bagnara
abramo.bagnara at gmail.com
Tue Aug 10 06:46:45 PDT 2010
Author: abramo
Date: Tue Aug 10 08:46:45 2010
New Revision: 110677
URL: http://llvm.org/viewvc/llvm-project?rev=110677&view=rev
Log:
Fixed redundant NNS loading.
Modified:
cfe/trunk/lib/Sema/SemaTemplate.cpp
cfe/trunk/lib/Sema/SemaType.cpp
cfe/trunk/lib/Sema/TreeTransform.h
Modified: cfe/trunk/lib/Sema/SemaTemplate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplate.cpp?rev=110677&r1=110676&r2=110677&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplate.cpp Tue Aug 10 08:46:45 2010
@@ -5256,8 +5256,6 @@
TypeSourceInfo *InnerTSI = 0;
QualType T = GetTypeFromParser(Ty, &InnerTSI);
- NestedNameSpecifier *NNS
- = static_cast<NestedNameSpecifier *>(SS.getScopeRep());
assert(isa<TemplateSpecializationType>(T) &&
"Expected a template specialization type");
@@ -5274,7 +5272,8 @@
else
Builder.push<TemplateSpecializationTypeLoc>(T).initialize(TemplateLoc);
- T = Context.getElaboratedType(ETK_Typename, NNS, T);
+ /* Note: NNS already embedded in template specialization type T. */
+ T = Context.getElaboratedType(ETK_Typename, /*NNS=*/0, T);
ElaboratedTypeLoc TL = Builder.push<ElaboratedTypeLoc>(T);
TL.setKeywordLoc(TypenameLoc);
TL.setQualifierRange(SS.getRange());
@@ -5289,7 +5288,10 @@
DependentTemplateName *DTN =
TST->getTemplateName().getAsDependentTemplateName();
assert(DTN && "dependent template has non-dependent name?");
- T = Context.getDependentTemplateSpecializationType(ETK_Typename, NNS,
+ assert(DTN->getQualifier()
+ == static_cast<NestedNameSpecifier*>(SS.getScopeRep()));
+ T = Context.getDependentTemplateSpecializationType(ETK_Typename,
+ DTN->getQualifier(),
DTN->getIdentifier(),
TST->getNumArgs(),
TST->getArgs());
Modified: cfe/trunk/lib/Sema/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=110677&r1=110676&r2=110677&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaType.cpp (original)
+++ cfe/trunk/lib/Sema/SemaType.cpp Tue Aug 10 08:46:45 2010
@@ -1317,9 +1317,9 @@
case NestedNameSpecifier::TypeSpec:
case NestedNameSpecifier::TypeSpecWithTemplate:
+ // Note: NNSPrefix (if any) is included in ClsType
+ // (hence, no need to wrap ClsType in an elaborated type).
ClsType = QualType(NNS->getAsType(), 0);
- if (NNSPrefix)
- ClsType = Context.getElaboratedType(ETK_None, NNSPrefix, ClsType);
break;
}
} else {
Modified: cfe/trunk/lib/Sema/TreeTransform.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/TreeTransform.h?rev=110677&r1=110676&r2=110677&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/TreeTransform.h (original)
+++ cfe/trunk/lib/Sema/TreeTransform.h Tue Aug 10 08:46:45 2010
@@ -559,7 +559,8 @@
getDerived().RebuildTemplateSpecializationType(InstName, NameLoc, Args);
if (T.isNull()) return QualType();
- return SemaRef.Context.getElaboratedType(Keyword, NNS, T);
+ // NOTE: NNS is already recorded in template specialization type T.
+ return SemaRef.Context.getElaboratedType(Keyword, /*NNS=*/0, T);
}
/// \brief Build a new typename type that refers to an identifier.
More information about the cfe-commits
mailing list