[cfe-dev] TargetInfo::CreateTargetInfo() takes owneship by reference

Douglas Gregor dgregor at apple.com
Thu Nov 15 20:25:31 PST 2012

On Nov 15, 2012, at 8:14 PM, Mehdi AMINI <mehdi.amini at silkan.com> wrote:

> Hi,
> Le 09/11/2012 17:04, Mehdi AMINI a écrit :
>> Hi,
>> r165943 changed *TargetInfo::CreateTargetInfo() so that it takes
>> ownership of TargetOptions &Opts which is passed by reference.
>> While it seems to me that it is not a good idea to take ownership from a
>> reference in general (any guidelines about that in LLVM/Clang?), I feel
>> it should be at least clearly stated in the comment before the function.
> Does anyone care ? Client code like the one presented here: http://eli.thegreenplace.net/2012/06/08/basic-source-to-source-transformation-with-clang/ result in double-free corruption.

Sorry for the delayed response. You're right that a pointer is better here; fixed in r168136.

	- Doug

More information about the cfe-dev mailing list