[LLVMdev] Conditions that cause Clang refuse inlining a function
David Sela
sela.david at gmail.com
Thu Sep 4 05:42:50 PDT 2014
Hi Anton,
Thanks for the answer.
The link you provided doesn't answer the question. It lists the ways to
overcome the linking error if the inline was not successful.
The only condition that is found there to make the compiler not inline is "when
compiling without optimization".
I asked the question in the forum because I think that this info is not
documented and most chances that the people that know the code inside-out
will know the answer.
Thanks,
David
On Thu, Sep 4, 2014 at 3:30 PM, Anton Korobeynikov <anton at korobeynikov.info>
wrote:
> Hello
>
> First of all, such a question definitely belongs to cfe-dev, not llvmdev.
>
> Next, 'inline' is certainly a hint, and the full the answer is a first
> entry here: http://clang.llvm.org/compatibility.html#inline
>
> On Thu, Sep 4, 2014 at 3:42 PM, David Sela <sela.david at gmail.com> wrote:
> > Hi,
> >
> > I want to have some functions in my code inline so I use the inline
> keyword:
> >
> > inline void foo() {}
> >
> > On some functions the compiler inlines the function but it fails to do
> so on
> > other functions and thus I get a linkage error:
> >
> > error: undefined reference to 'foo'
> >
> > What are the conditions that make the compiler refuse inline?
> >
> > Thanks,
> > David
> >
> > p.s. I know that there are ways to pass compilation and let the compiler
> > decide if to inline like using __attribute__((always_inline)) but I must
> > have the function inline.
> >
> > _______________________________________________
> > LLVM Developers mailing list
> > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
> >
>
>
>
> --
> With best regards, Anton Korobeynikov
> Faculty of Mathematics and Mechanics, Saint Petersburg State University
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140904/b83c06c5/attachment.html>
More information about the llvm-dev
mailing list