[cfe-dev] Inlining dllimport functions

Hamza Sood via cfe-dev cfe-dev at lists.llvm.org
Thu Sep 13 08:43:02 PDT 2018


Currently, Clang won’t inline a dllimport function that references a non-dllimport function. This has a big performance impact on using libc++ on Windows because even something as simple as vector::data() won’t be inlined at the max optimisation level.

Would anything break if Clang were to allow inlining of a dllimport function that references a non-dllimport function that’s also declared inline?

E.g:

inline bool f() { return false; }

__declspec(dllimport) inline bool g() { return f(); }

bool h() {
  // can we inline this without issue?
  return g();
}


More information about the cfe-dev mailing list