[LLVMdev] Replacing an initializer

John Criswell jtcriswel at gmail.com
Fri Feb 27 14:37:20 PST 2015


On 2/27/15 1:24 PM, Alexander Poddey wrote:
> Hi all,
>
> suppose I would like to change the initial value of a global.
> Is the supposed way to change the initializer via
> const_global_iterator I
> I->setInitializer(newOne) ?

Just as a warning, I'm pulling all of this from memory, so I might get 
something wrong.

If GV points to a global variable (and const_global_iterator probably 
magically casts to a GlobalVariable *), then yes, that is how you change 
the initializer.

>
> afaik, newOne is a constant - right?

I believe so, yes.

> Is the original Initializer automatically purged or do I need to delete it?

You should need to delete it.

Regards,

John Criswell

>
>
> thanks
> Alex
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev


-- 
John Criswell
Assistant Professor
Department of Computer Science, University of Rochester
http://www.cs.rochester.edu/u/criswell




More information about the llvm-dev mailing list