[PATCH] D28210: system_error: inline error_category ctor on Win32

Saleem Abdulrasool via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jan 1 14:33:40 PST 2017


compnerd created this revision.
compnerd added reviewers: EricWF, mclow.lists, majnemer.
compnerd added subscribers: smeenai, cfe-commits.
compnerd set the repository for this revision to rL LLVM.

Because the class is marked as `dllexport` and instantiated in
`algorithm.cpp` and is strongly defined in `system_error.cpp`, we end up
with multiple definitions.  By keeping the definition as an inline
definition, the `dllexport` will instantiate it.  Being inlined, they
will be marked as COMDAT(SELECT_ANY) and will still be exported from the
dll.


Repository:
  rL LLVM

https://reviews.llvm.org/D28210

Files:
  src/system_error.cpp


Index: src/system_error.cpp
===================================================================
--- src/system_error.cpp
+++ src/system_error.cpp
@@ -9,7 +9,9 @@

 #include "__config"

+#if !defined(_WIN32)
 #define _LIBCPP_BUILDING_SYSTEM_ERROR
+#endif
 #include "system_error"

 #include "include/config_elast.h"
@@ -29,9 +31,11 @@

 // class error_category

+#if !defined(_WIN32)
 error_category::error_category() _NOEXCEPT
 {
 }
+#endif

 error_category::~error_category() _NOEXCEPT
 {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28210.82788.patch
Type: text/x-patch
Size: 490 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170101/0e4046c2/attachment.bin>


More information about the cfe-commits mailing list