[LLVMdev] Conditions that cause Clang refuse inlining a function

Anton Korobeynikov anton at korobeynikov.info
Thu Sep 4 05:30:09 PDT 2014


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



More information about the llvm-dev mailing list