implement a new CanType subclass of Type, for use when we known that we have a canonical type.

Unlike Type, it implements equality operators.  It is returned by Type->getCanonicalType().

This adopts it in the minimal places required to get the build to work, it would also be nice
to switch IRGen to canonical types and use it there.


Swift SVN r1298
This commit is contained in:
Chris Lattner
2012-03-29 20:33:20 +00:00
parent c76edd6643
commit cb1d2cacbe
6 changed files with 63 additions and 13 deletions

View File

@@ -167,13 +167,12 @@ void TUModuleCache::lookupValue(AccessPathTy AccessPath, Identifier Name,
namespace {
class TUExtensionCache {
llvm::DenseMap<TypeBase*, TinyPtrVector<ExtensionDecl*>> Extensions;
llvm::DenseMap<CanType, TinyPtrVector<ExtensionDecl*>> Extensions;
public:
TUExtensionCache(TranslationUnit &TU);
ArrayRef<ExtensionDecl*> getExtensions(TypeBase *T) const{
assert(T->isCanonical());
ArrayRef<ExtensionDecl*> getExtensions(CanType T) const{
auto I = Extensions.find(T);
if (I == Extensions.end())
return ArrayRef<ExtensionDecl*>();