rnk added a comment. In http://reviews.llvm.org/D20647#460520, @Ilod wrote:
> I don't think weak linkage defines this. Right, sorry, normal external linkage is the obvious case. I was hung up thinking about cases like this: volatile int x; template <typename T> struct A { void f(); void g() { ++x; } // implicitly inline }; template <typename T> void A<T>::f() { ++x; } // not inline int main() { A<int> a; a.f(); // not inlined with /Ob1 a.g(); // inlined with /Ob1 } In this code, A::g has weak linkage but is not inline. MSVC will not inline it with /Ob1. Can you get the behavior you want by doing `if (!FD->isInlined()) Fn->addFnAttr(llvm::Attribute::NoInline);` instead? It seems nicer because we don't need to thread any options to the inliner, like you did in http://reviews.llvm.org/D20603. http://reviews.llvm.org/D20647 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits