[LLVMdev] How to add an include file

David Minor dahvid.minor at gmail.com
Tue Jul 7 01:42:22 PDT 2009


Hi Eli,
Let's say I have a file ClassA.h, that pairs with a file ClassA.cpp
to product a library libClassA.a.
ClassA.h contains the single declaration.

class A {...};

I want to transform it to:

#include "ClassB.h"

class A : public class B {...};

ClassB.h is the header file for a library libClassB.a built from ClassB.cpp
and ClassB.h.
I can clearly link libClassB with libClassA. But how can I bring in the
header file so that it's declarations will be known in ClassA.h.  Remember
this is happening during a pass.

Thanks,
David




On Mon, Jul 6, 2009 at 12:48 AM, Eli Friedman <eli.friedman at gmail.com>wrote:

> On Sun, Jul 5, 2009 at 1:16 PM, David Minor<dahvid.minor at gmail.com> wrote:
> > I'm writing a code transformation that involves adding an include to
> > existing code, adding a base class
> > to and existing class and then linking with a previously compiled
> library.
> > The main problem for me
> > seems to be how can I add the include?  Can I compile the include alone
> to
> > byte code and pre-pend it?
> > Should I compile the library, which includes the include and parse out
> the
> > include and pre-pend it?
> > Am I missing something fundamental here?
>
> If you want to add additional bitcode to an existing bitcode file, you
> can link them together with llvm-link (or the equivalent C++ API
> calls).  Beyond that, I'm not following what you're trying to do.
>
> -Eli
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090707/86892a6b/attachment.html>


More information about the llvm-dev mailing list