[llvm-dev] LLVM 3.8 change in function argument lists?

Dibyendu Majumdar via llvm-dev llvm-dev at lists.llvm.org
Mon Mar 14 16:48:13 PDT 2016


On 14 March 2016 at 23:42, Jonathan Roelofs <jonathan at codesourcery.com> wrote:
>> I am upgrading my project from 3.7 to 3.8. I find that following code
>> used to compile in 3.7 but doesn't in 3.8 and I can't understand why.
>>
>> llvm::Function *mainFunc = ...;
>> auto argiter = mainFunc->arg_begin();
>> llvm::Value *arg1 = argiter++;
>> arg1->setName("obj");
>>
>> But if I change the code to following it compiles:
>>
>> auto argiter = mainFunc->arg_begin();
>> llvm::Value *arg1 = &(*argiter);
>> arg1->setName("obj");
>>
>>
> From the release notes:
>
> "ilist_iterator<T> no longer has implicit conversions to and from T*, since
> ilist_iterator<T> may be pointing at the sentinel (which is usually not of
> type T at all). To convert from an iterator I to a pointer, use &*I; to
> convert from a pointer P to an iterator, use P->getIterator().
> Alternatively, explicit conversions via static_cast<T>(U) are still
> available."
>
> This was done to fix UB in the ilist implementation, IIRC.
>

Ok thanks.

Regards
Dibyendu


More information about the llvm-dev mailing list