Skip to content

Commit 58505c6

Browse files
committed
[ClangImporter] Use components of Objective-C selector, not Swift name, for UInt heuristic.
1 parent fbba773 commit 58505c6

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

lib/ClangImporter/ImportType.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2097,9 +2097,10 @@ Type ClangImporter::Implementation::importMethodType(
20972097

20982098
bool allowNSUIntegerAsIntInResult = isFromSystemModule;
20992099
if (allowNSUIntegerAsIntInResult) {
2100-
Identifier name = methodName.getBaseName();
2100+
clang::Selector sel = clangDecl->getSelector();
2101+
StringRef name = sel.getNameForSlot(0);
21012102
if (!name.empty()) {
2102-
allowNSUIntegerAsIntInResult = !nameContainsUnsigned(name.str());
2103+
allowNSUIntegerAsIntInResult = !nameContainsUnsigned(name);
21032104
}
21042105
}
21052106

@@ -2179,13 +2180,14 @@ Type ClangImporter::Implementation::importMethodType(
21792180

21802181
bool allowNSUIntegerAsIntInParam = isFromSystemModule;
21812182
if (allowNSUIntegerAsIntInParam) {
2182-
Identifier name;
2183-
if (nameIndex < argNames.size())
2184-
name = argNames[nameIndex];
2183+
StringRef name;
2184+
clang::Selector sel = clangDecl->getSelector();
2185+
if (nameIndex < sel.getNumArgs())
2186+
name = sel.getNameForSlot(nameIndex);
21852187
if (name.empty() && nameIndex == 0)
2186-
name = methodName.getBaseName();
2188+
name = sel.getNameForSlot(0);
21872189
if (!name.empty())
2188-
allowNSUIntegerAsIntInParam = !nameContainsUnsigned(name.str());
2190+
allowNSUIntegerAsIntInParam = !nameContainsUnsigned(name);
21892191
}
21902192

21912193
Type swiftParamTy;

0 commit comments

Comments
 (0)