<p dir="ltr">Clang is the code responsible for layout decisions, so LLVM is too late for this. Clang lowers sizeof, for example. If you want to change layout, see record layout builder in clang.</p>
<p dir="ltr">Sent from phone</p>
<div class="gmail_quote">On Jul 16, 2015 2:39 PM, "Mohit Mishra" <<a href="mailto:mmishra23@gmail.com">mmishra23@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>HI Mats,<br><br></div>Thanks for getting back to me.<br><div class="gmail_extra"><br><div class="gmail_quote"><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div><div>I take it you mean that you want to add a field to all classes COMPILED  by LLVM, and not all classes that LLVM consists of?<br></div></div></div></div></blockquote><div>YES! <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div><div><br></div></div><div>Also, unless I'm terribly misinformed, adding something to an ArrayRef is not going to work. ArrayRef, StringRef and such are "references to the original data in the calling code", which means you have no right to modify it.<br></div></div></div></blockquote><div><br></div><div> What I want is to be able to randomize object layout; and hence adding of integer fields to the classes might be a good option. While I did think so about ArrayRef, I thought about to substitute that with vector something like this:<br><div dir="ltr">vector<Type*> vecType = Elements.vec ();</div><div dir="ltr">vecType.insert (Type::getInt32Ty (Context))</div>ST->setBody(vecType, isPacked);<br></div><div><br></div><div>and modify the setBody function parameters replacing ArrayRef with the vector. However, I'm still skeptical about this.<br></div><div> </div>What do you propose to have a  fairly good object layout randomization?<br><br></div><div class="gmail_quote">Best,<br></div><div class="gmail_quote">Mohit.<br></div></div></div>
<br>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" rel="noreferrer" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" rel="noreferrer" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br></blockquote></div>