[Inliner] passing inline hint to optimizer if it appears explicitly on declaration

All,

I explicitly pass inline hint to the function declaration of foo::add() as in the following example:

#cat example.cpp

template class foo {

public:

T* tp;

int elem;

int maxelem;

T* add();

};

template inline T* foo ::add()

{

if (elem!=maxelem)

elem++;

return tp+elem-1;

}

typedef foo intboundart;

class bar

{

void addtobound(intboundart& boundarp);

};

void bar::addtobound(intboundart& barp)

{

barp.add();

}

Yet the IR passed into optimizer doesn’t contain inlinehint attribute:

#clang -cc1 -emit-llvm –o - example.cpp

; Function Attrs: nounwind

define linkonce_odr i32* @_ZN3fooIiE3addEv(%class.foo* %this) #0 comdat align 2 {

Clang will pass inline hint to optimizer only if I declare explicitly in the class like this:

template class foo {

public:

T* tp;

int elem;

int maxelem;

inline T* add();

};

Isn’t this a clang bug? Any pointers on how to fix this?

Thanks,

Balaram