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

John Emmas via llvm-dev llvm-dev at lists.llvm.org
Fri Sep 24 03:46:30 PDT 2021


On 23/09/2021 16:03, John Emmas wrote:
>
> perhaps a DLL function CAN be inlined but only if it's specifically 
> declared as such?  That makes a lot of sense and it would also explain 
> why I've never seen it here with ordinary DLL declarations (i.e. those 
> not declared using inline)
>

I found this Microsoft document about inlining:-

https://docs.microsoft.com/en-us/cpp/cpp/inline-functions-cpp?view=msvc-160

About half way down there are two examples and the 2nd one states that 
class member functions which get implemented in a header file are now 
regarded as being implicitly inlined.  This supports Paul's statement 
yesterday about the One Definition Rule - but what MS doesn't clarify is 
whether or not that'd also apply to DLL functions.  Paul wrote:-

On 23/09/2021 14:14, paul.robinson at sony.com wrote:
> If MSVC promises not to inline a dllimport method, that seems like
> something Clang should take into consideration in MS-compatibility
> mode.
>
Two decades of experience with MSVC suggests that where a dllimport 
method isn't also declared as 'inline' the compiler won't attempt to 
inline it. To me that makes perfect sense but frustratingly, I just 
can't find it in writing anywhere :-(

John


More information about the llvm-dev mailing list