Extend the use of QualifiedNameType to the creation of class template
specialization names. This way, we keep track of sugared types like
std::vector<Real>
I believe we are now using QualifiedNameTypes everywhere we can. Next
step: QualifiedDeclRefExprs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67268 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp
index a8be924..24b32e8 100644
--- a/lib/Sema/SemaType.cpp
+++ b/lib/Sema/SemaType.cpp
@@ -1077,3 +1077,16 @@
return true;
}
+
+/// \brief Retrieve a version of the type 'T' that is qualified by the
+/// nested-name-specifier contained in SS.
+QualType Sema::getQualifiedNameType(const CXXScopeSpec &SS, QualType T) {
+ 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);
+}