Revert r126737, the most recent nested-name-specifier location change, for buildbot breakage.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126746 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp
index fbb7246..cdb35a2 100644
--- a/lib/Sema/SemaTemplate.cpp
+++ b/lib/Sema/SemaTemplate.cpp
@@ -1821,12 +1821,12 @@
 
   ElaboratedTypeKeyword Keyword
     = TypeWithKeyword::getKeywordForTagTypeKind(TagKind);
-  QualType ElabType = Context.getElaboratedType(Keyword, SS.getScopeRep(), Type);
+  QualType ElabType = Context.getElaboratedType(Keyword, /*NNS=*/0, Type);
 
   TypeSourceInfo *ElabDI = Context.CreateTypeSourceInfo(ElabType);
   ElaboratedTypeLoc TL = cast<ElaboratedTypeLoc>(ElabDI->getTypeLoc());
   TL.setKeywordLoc(TagLoc);
-  TL.setQualifierLoc(SS.getWithLocInContext(Context));
+  TL.setQualifierRange(SS.getRange());
   TL.getNamedTypeLoc().initializeFullCopy(DI->getTypeLoc());
   return CreateParsedType(ElabType, ElabDI);
 }
@@ -5910,8 +5910,8 @@
       << FixItHint::CreateRemoval(TypenameLoc);
 
   NestedNameSpecifierLoc QualifierLoc = SS.getWithLocInContext(Context);
-  QualType T = CheckTypenameType(TypenameLoc.isValid()? ETK_Typename : ETK_None,
-                                 TypenameLoc, QualifierLoc, II, IdLoc);
+  QualType T = CheckTypenameType(ETK_Typename, TypenameLoc, QualifierLoc,
+                                 II, IdLoc);
   if (T.isNull())
     return true;
 
@@ -5924,7 +5924,7 @@
   } else {
     ElaboratedTypeLoc TL = cast<ElaboratedTypeLoc>(TSI->getTypeLoc());
     TL.setKeywordLoc(TypenameLoc);
-    TL.setQualifierLoc(QualifierLoc);
+    TL.setQualifierRange(SS.getRange());
     cast<TypeSpecTypeLoc>(TL.getNamedTypeLoc()).setNameLoc(IdLoc);
   }
 
@@ -5964,7 +5964,7 @@
     // type.
     TypeLocBuilder Builder;
     TemplateSpecializationTypeLoc SpecTL 
-      = Builder.push<TemplateSpecializationTypeLoc>(T);
+    = Builder.push<TemplateSpecializationTypeLoc>(T);
     
     // FIXME: No place to set the location of the 'template' keyword!
     SpecTL.setLAngleLoc(LAngleLoc);
@@ -5973,10 +5973,14 @@
     for (unsigned I = 0, N = TemplateArgs.size(); I != N; ++I)
       SpecTL.setArgLocInfo(I, TemplateArgs[I].getLocInfo());
     
-    T = Context.getElaboratedType(ETK_Typename, SS.getScopeRep(), T);
+    // FIXME: This is a hack. We really want to push the nested-name-specifier
+    // into TemplateSpecializationType.
+    
+    /* 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.setQualifierLoc(SS.getWithLocInContext(Context));
+    TL.setQualifierRange(SS.getRange());
     
     TypeSourceInfo *TSI = Builder.getTypeSourceInfo(Context, T);
     return CreateParsedType(T, TSI);