This is an archive of the discontinued LLVM Phabricator instance.

[MCContext] Use `const Twine &` in symbol creation methods. NFC
ClosedPublic

Authored by paperchalice on Mar 13 2023, 4:32 AM.

Details

Summary

All of these methods will invoke getOrCreateSymbol(const Twine &Name), using Twine here makes these methods more flexible.

Diff Detail

Event Timeline

paperchalice created this revision.Mar 13 2023, 4:32 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 13 2023, 4:32 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
paperchalice requested review of this revision.Mar 13 2023, 4:32 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 13 2023, 4:32 AM
MaskRay accepted this revision.Mar 13 2023, 10:19 PM
This revision is now accepted and ready to land.Mar 13 2023, 10:19 PM
paperchalice added a comment.EditedMar 13 2023, 10:32 PM

Could you submit this patch for me? I don't have the commit access. Thanks. @MaskRay

Do you have a use case for the more flexible function signature?

MaskRay requested changes to this revision.Mar 20 2023, 8:14 PM
This revision now requires changes to proceed.Mar 20 2023, 8:14 PM

I recently worked on an assembler which allow user add prefix or set values to symbols, getOrCreateSymbol can create symbols with prefix in Twine, but if I want to set the value for the symbol with prefix, setSymbolValue no longer works because it expect StringRef rather than Twine like getOrCreateSymbol.

This revision was not accepted when it landed; it landed in state Needs Revision.Mar 21 2023, 11:14 PM
This revision was automatically updated to reflect the committed changes.