[PATCH] D60912: MS ABI: handle inline static data member as template static data member

Jennifer Yu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 19 12:00:23 PDT 2019


jyu2 created this revision.
jyu2 added reviewers: rnk, majnemer, erichkeane, cfe-commits.
Herald added a project: clang.

MS only run time problem with inline static data member.
A inline static data member’s init function gets called multiple time.

To fix this, using template static data members initialization method instead.  So that inline static data member initialize function can be put into COMDAT group with global being initialized.  And also put static data member in the linker directive.  So that the function can be called before main, even the that variable is not been referenced.

The bug is report in:
https://bugs.llvm.org/show_bug.cgi?id=37903


Repository:
  rC Clang

https://reviews.llvm.org/D60912

Files:
  lib/CodeGen/CGDeclCXX.cpp
  test/CodeGenCXX/microsoft-abi-template-static-init.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60912.195892.patch
Type: text/x-patch
Size: 4412 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190419/4a252d79/attachment.bin>


More information about the cfe-commits mailing list