28
28
#include " swift/Runtime/Mutex.h"
29
29
#include " swift/Strings.h"
30
30
#include " llvm/ADT/DenseMap.h"
31
+ #include " llvm/ADT/DenseSet.h"
31
32
#include " llvm/ADT/Optional.h"
32
33
#include " llvm/ADT/PointerIntPair.h"
33
34
#include " llvm/ADT/PointerUnion.h"
34
35
#include " llvm/ADT/StringExtras.h"
35
- #include " llvm/ADT/TinyPtrVector.h"
36
36
#include " Private.h"
37
37
#include " CompatibilityOverride.h"
38
38
#include " ImageInspection.h"
@@ -205,7 +205,7 @@ struct TypeMetadataPrivateState {
205
205
ConcurrentReadableArray<TypeMetadataSection> SectionsToScan;
206
206
207
207
llvm::DenseMap<llvm::StringRef,
208
- llvm::TinyPtrVector <const ContextDescriptor *>>
208
+ llvm::SmallDenseSet <const ContextDescriptor *, 1 >>
209
209
ContextDescriptorCache;
210
210
size_t ConformanceDescriptorLastSectionScanned = 0 ;
211
211
size_t TypeContextDescriptorLastSectionScanned = 0 ;
@@ -652,7 +652,7 @@ _scanAdditionalContextDescriptors(TypeMetadataPrivateState &T) {
652
652
if (auto type = llvm::dyn_cast<TypeContextDescriptor>(ntd)) {
653
653
auto identity = ParsedTypeIdentity::parse (type);
654
654
auto name = identity.getABIName ();
655
- T.ContextDescriptorCache [name].push_back (type);
655
+ T.ContextDescriptorCache [name].insert (type);
656
656
}
657
657
}
658
658
}
@@ -667,7 +667,7 @@ _scanAdditionalContextDescriptors(TypeMetadataPrivateState &T) {
667
667
if (auto type = llvm::dyn_cast<TypeContextDescriptor>(ntd)) {
668
668
auto identity = ParsedTypeIdentity::parse (type);
669
669
auto name = identity.getABIName ();
670
- T.ContextDescriptorCache [name].push_back (type);
670
+ T.ContextDescriptorCache [name].insert (type);
671
671
}
672
672
}
673
673
}
@@ -677,7 +677,7 @@ _scanAdditionalContextDescriptors(TypeMetadataPrivateState &T) {
677
677
// Search for a ContextDescriptor in the context descriptor cache matching the
678
678
// given demangle node. Returns the found node, or nullptr if no match was
679
679
// found.
680
- static llvm::TinyPtrVector <const ContextDescriptor *>
680
+ static llvm::SmallDenseSet <const ContextDescriptor *, 1 >
681
681
_findContextDescriptorInCache (TypeMetadataPrivateState &T,
682
682
Demangle::NodePointer node) {
683
683
if (node->getNumChildren () < 2 )
@@ -731,7 +731,7 @@ _findContextDescriptor(Demangle::NodePointer node,
731
731
732
732
// Scan any newly loaded images for context descriptors, then try the context
733
733
// descriptor cache. This must be done with the cache's lock held.
734
- llvm::TinyPtrVector <const ContextDescriptor *> cachedContexts;
734
+ llvm::SmallDenseSet <const ContextDescriptor *, 1 > cachedContexts;
735
735
{
736
736
ScopedLock guard (T.ContextDescriptorCacheLock );
737
737
_scanAdditionalContextDescriptors (T);
0 commit comments