@@ -2105,30 +2105,6 @@ namespace {
2105
2105
// The name of every member.
2106
2106
llvm::DenseSet<StringRef> allMemberNames;
2107
2107
2108
- // Cxx methods may have the same name but differ in "constness".
2109
- // In such a case we must differentiate in swift (See VisitFunction).
2110
- // Before importing the different CXXMethodDecl's we track functions
2111
- // that differ this way so we can disambiguate later
2112
- for (auto m : decl->decls ()) {
2113
- if (auto method = dyn_cast<clang::CXXMethodDecl>(m)) {
2114
- if (method->getDeclName ().isIdentifier ()) {
2115
- auto contextMap = Impl.cxxMethods .find (method->getDeclContext ());
2116
- if (contextMap == Impl.cxxMethods .end () ||
2117
- contextMap->second .find (method->getName ()) ==
2118
- contextMap->second .end ()) {
2119
- Impl.cxxMethods [method->getDeclContext ()][method->getName ()] = {};
2120
- }
2121
- if (method->isConst ()) {
2122
- // Add to const set
2123
- Impl.cxxMethods [method->getDeclContext ()][method->getName ()].first .insert (method);
2124
- } else {
2125
- // Add to mutable set
2126
- Impl.cxxMethods [method->getDeclContext ()][method->getName ()].second .insert (method);
2127
- }
2128
- }
2129
- }
2130
- }
2131
-
2132
2108
// FIXME: Import anonymous union fields and support field access when
2133
2109
// it is nested in a struct.
2134
2110
for (auto m : decl->decls ()) {
@@ -2214,10 +2190,6 @@ namespace {
2214
2190
}
2215
2191
2216
2192
if (auto MD = dyn_cast<FuncDecl>(member)) {
2217
-
2218
- // When 2 CXXMethods diff by "constness" alone we differentiate them
2219
- // by changing the name of one. That changed method needs to be added
2220
- // to the lookup table since it cannot be found lazily.
2221
2193
if (auto cxxMethod = dyn_cast<clang::CXXMethodDecl>(m)) {
2222
2194
auto cxxOperatorKind = cxxMethod->getOverloadedOperator ();
2223
2195
@@ -2272,16 +2244,6 @@ namespace {
2272
2244
// Make sure the synthesized decl can be found by lookupDirect.
2273
2245
result->addMemberToLookupTable (opFuncDecl);
2274
2246
}
2275
-
2276
- if (cxxMethod->getDeclName ().isIdentifier ()) {
2277
- auto &mutableFuncPtrs =
2278
- Impl.cxxMethods [cxxMethod->getDeclContext ()]
2279
- [cxxMethod->getName ()]
2280
- .second ;
2281
- if (mutableFuncPtrs.contains (cxxMethod)) {
2282
- result->addMemberToLookupTable (member);
2283
- }
2284
- }
2285
2247
}
2286
2248
methods.push_back (MD);
2287
2249
continue ;
@@ -3031,25 +2993,6 @@ namespace {
3031
2993
return nullptr ;
3032
2994
}
3033
2995
3034
- // Handle cases where 2 CXX methods differ strictly in "constness"
3035
- // In such a case append a suffix ("Mutating") to the mutable version
3036
- // of the method when importing to swift
3037
- if (decl->getDeclName ().isIdentifier ()) {
3038
- const auto &cxxMethodPair = Impl.cxxMethods [decl->getDeclContext ()][decl->getName ()];
3039
- const auto &constFuncPtrs = cxxMethodPair.first ;
3040
- const auto &mutFuncPtrs = cxxMethodPair.second ;
3041
-
3042
- // Check to see if this function has both const & mut versions and
3043
- // that this decl refers to the mutable version.
3044
- if (!constFuncPtrs.empty () && mutFuncPtrs.contains (decl)) {
3045
- auto newName = decl->getName ().str () + " Mutating" ;
3046
- auto newId = dc->getASTContext ().getIdentifier (newName);
3047
- auto oldArgNames = importedName.getDeclName ().getArgumentNames ();
3048
- auto newDeclName = DeclName (Impl.SwiftContext , newId, oldArgNames);
3049
- importedName.setDeclName (newDeclName);
3050
- }
3051
- }
3052
-
3053
2996
DeclName name = accessorInfo ? DeclName () : importedName.getDeclName ();
3054
2997
auto selfIdx = importedName.getSelfIndex ();
3055
2998
0 commit comments