[cfe-dev] Programatically obtaining section/offset information for function/constructor declarations found during AST traversal

mats petersson via cfe-dev cfe-dev at lists.llvm.org
Mon Sep 28 03:41:31 PDT 2015


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]

--
Mats

On 28 September 2015 at 08:52, Csaba Raduly via cfe-dev <
cfe-dev at lists.llvm.org> wrote:

> Hi Sanee,
>
> I doubt this is possible.
> At the time you're walking through the AST, code has not been generated
> yet.
>
> On Mon, Sep 28, 2015 at 12:29 AM, Sanee Berlow via cfe-dev  wrote:
> > Hey everyone.
> >
> > 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
> > this?
>
>
> Csaba
> --
> GCS a+ e++ d- C++ ULS$ L+$ !E- W++ P+++$ w++$ tv+ b++ DI D++ 5++
> The Tao of math: The numbers you can count are not the real numbers.
> Life is complex, with real and imaginary parts.
> "Ok, it boots. Which means it must be bug-free and perfect. " -- Linus
> Torvalds
> "People disagree with me. I just ignore them." -- Linus Torvalds
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150928/44d069e1/attachment.html>


More information about the cfe-dev mailing list