<div dir="ltr">It would cause problems if 'f' in turn referenced functions that were neither inline nor exported:<div><br></div><div>bool not_exported();</div><div>inline bool f() { return not_exported(); }<br>__declspec(dllimport) inline bool g() { return f(); }<br></div><div><br></div><div>I'm pretty sure MSVC will not inline g in this or your example, so I would suggest adjusting dllimport usage patterns to something that satisfies both compilers rather than changing clang.</div></div><br><div class="gmail_quote"><div dir="ltr">On Thu, Sep 13, 2018 at 8:43 AM Hamza Sood via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">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.<br>
<br>
Would anything break if Clang were to allow inlining of a dllimport function that references a non-dllimport function that’s also declared inline?<br>
<br>
E.g:<br>
<br>
inline bool f() { return false; }<br>
<br>
__declspec(dllimport) inline bool g() { return f(); }<br>
<br>
bool h() {<br>
  // can we inline this without issue?<br>
  return g();<br>
}<br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</blockquote></div>