Skip to content

Commit 5063c21

Browse files
committed
[Omit needless words] Stop using Objective-C type parameter names as type names.
Objective-C type parameter names aren't strong enough indicators to use for removing redundant type information. Fixes rdar://problem/24635887.
1 parent 78cb038 commit 5063c21

File tree

2 files changed

+2
-12
lines changed

2 files changed

+2
-12
lines changed

lib/ClangImporter/ImportType.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1495,16 +1495,6 @@ OmissionTypeName ClangImporter::Implementation::getClangTypeNameForOmission(
14951495
if (auto typedefType = dyn_cast<clang::TypedefType>(typePtr)) {
14961496
auto name = typedefType->getDecl()->getName();
14971497

1498-
// For Objective-C type parameters, drop the "Type" suffix if
1499-
// present.
1500-
if (isa<clang::ObjCTypeParamDecl>(typedefType->getDecl())) {
1501-
if (camel_case::getLastWord(name) == "Type") {
1502-
name = name.drop_back(4);
1503-
}
1504-
1505-
return name;
1506-
}
1507-
15081498
// Objective-C selector type.
15091499
if (ctx.hasSameUnqualifiedType(type, ctx.getObjCSelType()) &&
15101500
name == "SEL")

test/IDE/print_omit_needless_words.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@
4747
// CHECK-FOUNDATION: func copy(with _: Zone = nil) -> AnyObject!
4848

4949
// Note: Objective-C type parameter names.
50-
// CHECK-FOUNDATION: func object(for _: Copying) -> AnyObject?
51-
// CHECK-FOUNDATION: func removeObject(for _: Copying)
50+
// CHECK-FOUNDATION: func object(forKey _: Copying) -> AnyObject?
51+
// CHECK-FOUNDATION: func removeObject(forKey _: Copying)
5252

5353
// Note: Don't drop the name of the first parameter in an initializer entirely.
5454
// CHECK-FOUNDATION: init(array: [AnyObject])

0 commit comments

Comments
 (0)