[llvm-dev] Disabling inline compilation (Clang with VS2019)

Hans Wennborg via llvm-dev llvm-dev at lists.llvm.org
Thu Sep 23 07:07:12 PDT 2021


> > If MSVC promises not to inline a dllimport method, that seems like
> > something Clang should take into consideration in MS-compatibility
> > mode.  Probably implicitly marking dllimport methods as noinline would
> > be sufficient, but I think we'd be willing to do that only if MSVC
> > actually makes that promise explicitly.
> > --paulr
>
> I don't believe MSVC makes such a promise

Actually, MSDN (https://docs.microsoft.com/en-us/cpp/cpp/defining-inline-cpp-functions-with-dllexport-and-dllimport)
documents the opposite:

"You can also define as inline a function declared with the dllimport
attribute. In this case, the function can be expanded (subject to /Ob
specifications)"

Of course the reality is more complicated, but it's clear MSVC never
excluded dllimport functions from inlining in general.


More information about the llvm-dev mailing list