This is an archive of the discontinued LLVM Phabricator instance.

[objc] Consolidate ObjC name mangle code to AST
AbandonedPublic

Authored by ellis on Sep 25 2020, 12:08 PM.

Details

Reviewers
rjmccall
Summary

This reduces code duplication between CGObjCMac.cpp and Mangle.cpp for generating the mangled name of an Objective-C method.

This has no intended functionality change.

Diff Detail

Event Timeline

ellis created this revision.Sep 25 2020, 12:08 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 25 2020, 12:08 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
ellis requested review of this revision.Sep 25 2020, 12:08 PM
ellis updated this revision to Diff 294395.Sep 25 2020, 12:11 PM

Fix variable name

rjmccall added inline comments.
clang/include/clang/AST/Mangle.h
126–130

Could you switch the polarity on the method names here, so that mangleObjCMethodName just mangles the method name like ObjC would and there's a mangleObjCMethodNameAsSourceName that appends something that obeys the Itanium source-name production? You'll need to switch the existing call sites, of course.

clang/lib/AST/Mangle.cpp
325

Prefer llvm_unreachable.

ellis updated this revision to Diff 294461.Sep 25 2020, 5:14 PM

Rename mangleObjCMethodName

ellis marked 2 inline comments as done.Sep 25 2020, 5:16 PM
rjmccall accepted this revision.Sep 25 2020, 6:47 PM

Thanks, LGTM.

This revision is now accepted and ready to land.Sep 25 2020, 6:47 PM
ellis updated this revision to Diff 294503.Sep 26 2020, 7:56 AM

Update call sites

ellis added a comment.Sep 26 2020, 8:23 AM

Thanks for accepting @rjmccall. Could you land this? I don't have commit access yet.

ellis updated this revision to Diff 295000.Sep 29 2020, 8:15 AM

[objc] Fix memory leak in CGObjCMac.cpp

CGObjCMac.cpp was leaking a MangleContext everytime it mangled an ObjC method. We now have an instance variable that allocates and deallocates the context.

ellis added a comment.Sep 29 2020, 8:17 AM

Oops, I meant to create a new commit rather than amend to this one

vsapsai added inline comments.
clang/lib/CodeGen/CGObjCMac.cpp
929
ellis abandoned this revision.Jun 10 2021, 2:08 PM