I’m using ASTVisitor to walk through an AST to find constructors
belonging to a certain type. What I want to do now is find the
section/offset information for those found constructors that will be
written to the output object file, allowing me to locate the binary
for the constructors in the file. Is it possible to get that
information programatically? What would be the best way to go about
Thanks very much
I doubt this is possible.
At the time you're walking through the AST, code has not been generated yet.
What are you ACTUALLY trying to do? As Csaba says, the code is not even close to being machine code at that point, so you won’t be able to do it at that point. Sections and offsets would only be available after machine code generation. There are passes in LLVM that deals with machine instructions, that COULD be useful, but it really depends on what you are actully trying to do.
[The reason I ask “what you really want to do” is that your question sounds a like an XY question - like going to a garage asking how to loosen a wheel nut, and the (wo)man tells you how to undo the wheel nut, then five minutes later you come back asking how to get a wheel back on the car when it’s fallen to one side, because what you didn’t do was lift that corner of the car up before trying to fit the spare wheel - if you ask how to change a wheel, you’d get a better answer for how to perform that task than asking how to remove a wheel nut]