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

Hans Wennborg via llvm-dev llvm-dev at lists.llvm.org
Wed Dec 8 09:31:11 PST 2021


On Wed, Dec 8, 2021 at 10:51 AM John Emmas via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
>
> On 07/12/2021 16:12, Hans Wennborg wrote:
> > Adding a note here:https://reviews.llvm.org/D115252
> >
>
> Many thanks everyone,
>
> So if I'm understanding this correctly, the difference in my original
> example below must be that (for MSVC) a static class member variable
> gets categorized as if it was a global variable - whereas (for Clang) it
> doesn't?

No, Clang also considers a static class member variable as a global,
but unlike MSVC it also considers whether the variable is dllimport,
which it will be if it's a member of a dllimport class.

>
> John
>
> On 22/09/2021 13:22, John Emmas wrote:
> >
> > #if defined (BUILDING_DLL)
> >   #define DLL_API __declspec(dllexport)
> > #else
> >   #define DLL_API __declspec(dllimport)
> > #endif
> >
> > namespace Gtkmm2ext {
> >
> >   class DLL_API Keyboard
> >   {
> >     public:
> >       Keyboard ();
> >       ~Keyboard ();
> >
> >       static Keyboard& get_keyboard() { return *_the_keyboard; } //
> > <--- inlined by clang but not by msvc
> >
> >     protected:
> >       static Keyboard* _the_keyboard;
> >   };
> >
> > } /* namespace */
> >
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev


More information about the llvm-dev mailing list