[Lldb-commits] [lldb] 0d5fc82 - [lldb] Eliminate unneeded value parameters in Utility (NFC)

Adrian Prantl via lldb-commits lldb-commits at lists.llvm.org
Fri Jul 24 09:29:16 PDT 2020


Honestly, a sentence in the class Doxygen comment that this is supposed to be passed by value works just as well :-)

-- adrian

> On Jul 24, 2020, at 12:31 AM, Raphael “Teemperor” Isemann <teemperor at gmail.com> wrote:
> 
> We could make a custom attribute for types that should be always passed by value and then maybe have Clang handle that. The problem seems generic enough that maybe other people could find this useful.
> 
> - Raphael
> 
>> On 24 Jul 2020, at 09:27, Pavel Labath via lldb-commits <lldb-commits at lists.llvm.org> wrote:
>> 
>> On 23/07/2020 18:24, Adrian Prantl wrote:
>>> Is there some clever C++ way to prohibit taking an object's address (similar to how you can delete a copy constructor)?
>>> 
>>> -- adrian
>> 
>> You could =delete the address-of operator, but redefining unary & is
>> generally frowned upon and I am not sure it will achieve what you want
>> -- it would not prevent anyone from binding a reference to an existing
>> object.
>> 
>> I don't think there's any way to prevent that, and even if it were, it
>> would likely break too much generic code which expects to accept objects
>> by const&.
>> 
>> pl
>> _______________________________________________
>> lldb-commits mailing list
>> lldb-commits at lists.llvm.org
>> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
> 



More information about the lldb-commits mailing list