[cfe-dev] Allocate a class member variable and store in it

Mustakimur Khandaker via cfe-dev cfe-dev at lists.llvm.org
Tue May 29 10:06:06 PDT 2018


I am working on Clang CodeGen to modify the class constructor LLVM IR. I want to create a class member variable for every class and store a randomly generated constant int onto it. My first question is how is it possible to allocate the space for a class member variable when constructor IR is building (I know where to do it)? Second, How can I use Builder.CreateStore to store some constantI nt (I know how to create it) to that member variable? I have tried to follow the initializeVtablePointer() code to understand how class vptr is being allocated and stored, but it is too complicated. Moreover, I don't need to a pointer like vptr, but just a simple member variable to hold a constant int. Can you suggest me how to resolve these two issues?

Best Regards
Mustakimur Rahman Khandaker
Graduate Student and Teaching Assistant
Department of Computer Science
Florida State University
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20180529/73644814/attachment.html>

More information about the cfe-dev mailing list