Skip to content

Commit e81db0a

Browse files
Use the Obj-C name here
1 parent 3905403 commit e81db0a

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

lib/ClangImporter/ClangImporter.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3702,8 +3702,16 @@ EffectiveClangContext ClangImporter::Implementation::getEffectiveClangContext(
37023702
(nominal->getAttrs().hasAttribute<ObjCAttr>() ||
37033703
(!nominal->getParentSourceFile() && nominal->isObjC()))) {
37043704
// Map the name. If we can't represent the Swift name in Clang.
3705-
// FIXME: We should be using the Objective-C name here!
3706-
auto clangName = exportName(nominal->getName());
3705+
Identifier name = nominal->getName();
3706+
if (auto objcAttr = nominal->getAttrs().getAttribute<ObjCAttr>()) {
3707+
if (auto objcName = objcAttr->getName()) {
3708+
if (objcName->getNumArgs() == 0) {
3709+
// This is an error if not 0, but it should be caught later.
3710+
name = objcName->getSimpleName();
3711+
}
3712+
}
3713+
}
3714+
auto clangName = exportName(name);
37073715
if (!clangName)
37083716
return EffectiveClangContext();
37093717

0 commit comments

Comments
 (0)