[clang] [clang-tools-extra] [libcxx] [clang] Enable sized deallocation by default in C++14 onwards (PR #83774)
Wang Pengcheng via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 26 02:18:20 PDT 2024
================
@@ -49,3 +49,62 @@ if ((MINGW OR CYGWIN) AND BUILD_SHARED_LIBS)
# despite potential dllexports.
target_link_options(clangInterpreter PRIVATE LINKER:--export-all-symbols)
endif()
+
+if(MSVC)
+ set_target_properties(clangInterpreter PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS 1)
+
+ # RTTI/C++ symbols
+ set(clangInterpreter_exports ${clangInterpreter_exports} ??_7type_info@@6B@
+ ?__type_info_root_node@@3U__type_info_node@@A
+ ?nothrow at std@@3Unothrow_t at 1@B
+ )
+
+ # Compiler added symbols for static variables. NOT for VStudio < 2015
+ set(clangInterpreter_exports ${clangInterpreter_exports} _Init_thread_abort _Init_thread_epoch
+ _Init_thread_footer _Init_thread_header _tls_index
+ )
+
+ if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ # new/delete variants needed when linking to static msvc runtime (esp. Debug)
+ set(clangInterpreter_exports ${clangInterpreter_exports}
+ ??2 at YAPEAX_K@Z
+ ??3 at YAXPEAX@Z
+ ??_U at YAPEAX_K@Z
+ ??_V at YAXPEAX@Z
+ ??3 at YAXPEAX_K@Z
+ ??6?$basic_ostream at DU?$char_traits at D@std@@@std@@QEAAAEAV01 at H@Z
+ ??6?$basic_ostream at DU?$char_traits at D@std@@@std@@QEAAAEAV01 at M@Z
+ ??6?$basic_ostream at DU?$char_traits at D@std@@@std@@QEAAAEAV01 at N@Z
+ ??6?$basic_ostream at DU?$char_traits at D@std@@@std@@QEAAAEAV01 at PEBX@Z
+ ??6?$basic_ostream at DU?$char_traits at D@std@@@std@@QEAAAEAV01 at P6AAEAV01@AEAV01@@Z at Z
+ ??$?6U?$char_traits at D@std@@@std@@YAAEAV?$basic_ostream at DU?$char_traits at D@std@@@0 at AEAV10@D at Z
+ ??$?6U?$char_traits at D@std@@@std@@YAAEAV?$basic_ostream at DU?$char_traits at D@std@@@0 at AEAV10@PEBD at Z
+ ?_Facet_Register at std@@YAXPEAV_Facet_base at 1@@Z
+ )
+ else()
+ set(clangInterpreter_exports ${clangInterpreter_exports}
+ ??2 at YAPAXI@Z
+ ??3 at YAXPAX@Z
+ ??3 at YAXPAXI@Z
+ ??_U at YAPAXI@Z
+ ??_V at YAXPAX@Z
+ ??_V at YAXPAXI@Z
+ ??6?$basic_ostream at DU?$char_traits at D@std@@@std@@QAEAAV01 at H@Z
+ ??6?$basic_ostream at DU?$char_traits at D@std@@@std@@QAEAAV01 at M@Z
+ ??6?$basic_ostream at DU?$char_traits at D@std@@@std@@QAEAAV01 at N@Z
+ ??6?$basic_ostream at DU?$char_traits at D@std@@@std@@QAEAAV01 at PBX@Z
+ ??6?$basic_ostream at DU?$char_traits at D@std@@@std@@QAEAAV01 at P6AAAV01@AAV01@@Z at Z
+ ??$?6U?$char_traits at D@std@@@std@@YAAAV?$basic_ostream at DU?$char_traits at D@std@@@0 at AAV10@D at Z
+ ??$?6U?$char_traits at D@std@@@std@@YAAAV?$basic_ostream at DU?$char_traits at D@std@@@0 at AAV10@PBD at Z
+ ?_Facet_Register at std@@YAXPAV_Facet_base at 1@@Z
+ )
+ endif()
+
+ # List to '/EXPORT:sym0 /EXPORT:sym1 /EXPORT:sym2 ...'
+ foreach(sym ${clangInterpreter_exports})
+ set(clangInterpreter_link_str "${clangInterpreter_link_str} /EXPORT:${sym}")
+ endforeach(sym ${clangInterpreter_exports})
+
+ set_property(TARGET clangInterpreter APPEND_STRING PROPERTY LINK_FLAGS ${clangInterpreter_link_str})
+
+endif(MSVC)
----------------
wangpc-pp wrote:
See commit aae9c11511c6bd8b41cfc879cfe3197578d52068.
I tried to add these exports to `clangInterpreter` component and hoped these link options can be transitive to its users like `clang-repl` and `ClangReplInterpreterTests`. But it didn't work after aae9c11511c6bd8b41cfc879cfe3197578d52068 because the unit tests were still failed.
I am not a cmake expert, so I have to add exports to `clang-repl` and `ClangReplInterpreterTests` to make sure unit tests are passed, but the cmake code may be too duplicated in this way.
https://github.com/llvm/llvm-project/pull/83774
More information about the cfe-commits
mailing list