Revamp our representation of C++ nested-name-specifiers. We now have a
uniqued representation that should both save some memory and make it
far easier to properly build canonical types for types involving
dependent nested-name-specifiers, e.g., "typename T::Nested::type".

This approach will greatly simplify the representation of
CXXScopeSpec. That'll be next.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67799 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp
index 4b25657..0780ad8 100644
--- a/lib/Sema/SemaType.cpp
+++ b/lib/Sema/SemaType.cpp
@@ -1101,9 +1101,7 @@
   if (!SS.isSet() || SS.isInvalid() || T.isNull())
     return T;
   
-  llvm::SmallVector<NestedNameSpecifier, 4> Specs;
-  for (CXXScopeSpec::iterator Spec = SS.begin(), SpecEnd = SS.end();
-       Spec != SpecEnd; ++Spec)
-    Specs.push_back(NestedNameSpecifier::getFromOpaquePtr(*Spec));
-  return Context.getQualifiedNameType(&Specs[0], Specs.size(), T);
+  NestedNameSpecifier *NNS
+    = static_cast<NestedNameSpecifier *>(SS.getCurrentScopeRep());
+  return Context.getQualifiedNameType(NNS, T);
 }