<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><br></div>Still, not sure if that is a good idea - I'm fairly sure the compiler (e.g. Clang) will make up its own classes that need to be of a certain size and have certain content to match external functionst that are not compiled at this time (e.g. data structures used to call OS system calls, C and C++ runtime functions, etc) [certainly my Pascal compiler produces internal structures in this way, for example for FILE, STRING and SET], and adding extra fields here would be pretty much guaranteed to cause things to go wrong. So a better idea is probably to understand what data structures are part of your actual source-code [not counting system header files such as <iostream>, <stdio.h> or <string>], and add fields ONLY to those structures that "you own", not the ones that clang produced internally. This would of course mean you have to do this either at the source level or in the AST of the compiler, not at LLVM level - but I'm fairly sure that doing this at LLVM level is a bad idea.<br><br></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><br></div>I'm pretty sure you are asking what is called an XY question, you want to do X, you think Y is the method of achieving that, and therefore ask how to do Y. I'm pretty sure asking how to achieve whatever X is in your case will provide you with better ideas of how to achieve what you want to do - as knowing what the actual goal is will help a lot in providing a <br><br>--<br></div>Mats<br></div><div class="gmail_extra"><br><div class="gmail_quote">On 16 July 2015 at 22:05, Mohit Mishra <span dir="ltr"><<a href="mailto:mmishra23@gmail.com" target="_blank">mmishra23@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div>Hi,<br><br></div>I want to add an integer field to all C++ classes in LLVM. Where do I look at in the LLVM source to make the necessary changes? As of now, what I understand is that I need to make changes in Type.cpp (llvm/lib/IR/Type.cpp) where I insert an integer field in the ArrayRef passed to StructType::setBody?<br><br></div>Thanks!<span class="HOEnZb"><font color="#888888"><br><br></font></span></div><span class="HOEnZb"><font color="#888888">-Mohit.<br></font></span></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><br></div>