@@ -808,45 +808,17 @@ NodeUniquePtr SDKNode::constructSDKNode(llvm::yaml::MappingNode *Node) {
808
808
return Result;
809
809
}
810
810
811
- // / This is for caching the comparison results between two SDKNodes.
812
- class SDKNodeEqualContext {
813
- using NodePtrAndEqual = llvm::DenseMap<const SDKNode*, bool >;
814
- llvm::DenseMap<const SDKNode*, llvm::DenseMap<const SDKNode*, bool >> Data;
815
-
816
- public:
817
- Optional<bool > getEquality (const SDKNode* Left, const SDKNode* Right) {
818
- auto &Map = Data.insert ({Left, NodePtrAndEqual ()}).first ->getSecond ();
819
- if (Map.count (Right))
820
- return Map[Right];
821
- return None;
822
- }
823
-
824
- void addEquality (const SDKNode* Left, const SDKNode* Right, const bool Value) {
825
- Data.insert (std::make_pair (Left, NodePtrAndEqual ())).first ->getSecond ().
826
- insert ({Right, Value});
827
- }
828
- };
829
-
830
811
bool SDKNode::operator ==(const SDKNode &Other) const {
831
- static SDKNodeEqualContext EqualCache;
832
- if (auto Cached = EqualCache.getEquality (this , &Other)) {
833
- return Cached.getValue ();
834
- }
835
- auto Exit = [&](const bool Result) {
836
- EqualCache.addEquality (this , &Other, Result);
837
- return Result;
838
- };
839
-
840
812
if (getKind () != Other.getKind ())
841
- return Exit ( false ) ;
813
+ return false ;
842
814
843
815
switch (getKind ()) {
844
816
case SDKNodeKind::TypeNominal:
845
817
case SDKNodeKind::TypeFunc: {
846
818
auto Left = this ->getAs <SDKNodeType>();
847
819
auto Right = (&Other)->getAs <SDKNodeType>();
848
- return Exit ( Left->getTypeAttributes ().equals (Right->getTypeAttributes ())
849
- && Left->getPrintedName () == Right->getPrintedName ()) ;
820
+ return Left->getTypeAttributes ().equals (Right->getTypeAttributes ())
821
+ && Left->getPrintedName () == Right->getPrintedName ();
850
822
}
851
823
852
824
case SDKNodeKind::Function:
@@ -856,9 +828,9 @@ bool SDKNode::operator==(const SDKNode &Other) const {
856
828
auto Left = this ->getAs <SDKNodeAbstractFunc>();
857
829
auto Right = (&Other)->getAs <SDKNodeAbstractFunc>();
858
830
if (Left->isMutating () ^ Right->isMutating ())
859
- return Exit ( false ) ;
831
+ return false ;
860
832
if (Left->isThrowing () ^ Right->isThrowing ())
861
- return Exit ( false ) ;
833
+ return false ;
862
834
SWIFT_FALLTHROUGH;
863
835
}
864
836
case SDKNodeKind::TypeDecl:
@@ -870,11 +842,11 @@ bool SDKNode::operator==(const SDKNode &Other) const {
870
842
Children.size () == Other.Children .size ()) {
871
843
for (unsigned I = 0 ; I < Children.size (); ++ I) {
872
844
if (*Children[I] != *Other.Children [I])
873
- return Exit ( false ) ;
845
+ return false ;
874
846
}
875
- return Exit ( true ) ;
847
+ return true ;
876
848
}
877
- return Exit ( false ) ;
849
+ return false ;
878
850
}
879
851
}
880
852
}
0 commit comments