[llvm-dev] Passing Twine by value

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[llvm-dev] Passing Twine by value

Callum Laird via llvm-dev

Twine.h says twines should only be accepted as const references in arguments, but there are a bunch of functions that take Twine by value (e.g. you'll find lots of them in CGObjCMac.cpp in clang). Is this just a potential performance issue, or are there potential correctness issues from passing a twine by value as well?


_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] Passing Twine by value

Callum Laird via llvm-dev
I don't believe there's any correctness issue with passing Twine by value.

Not sure it'd even be a performance problem - the sizeof(Twine) looks like it'd be small enough (like StringRef - though a bit bigger, StringRef should be two words, Twine would be three) not to worry too much either way.


On Thu, May 30, 2019 at 12:14 AM Shoaib Meenai via llvm-dev <[hidden email]> wrote:

Twine.h says twines should only be accepted as const references in arguments, but there are a bunch of functions that take Twine by value (e.g. you'll find lots of them in CGObjCMac.cpp in clang). Is this just a potential performance issue, or are there potential correctness issues from passing a twine by value as well?

_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev