[clang] Warn when unique objects might be duplicated in shared libraries (PR #117622)

Hans Wennborg via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 29 10:22:45 PST 2025


================
@@ -6153,6 +6153,15 @@ def warn_static_local_in_extern_inline : Warning<
 def note_convert_inline_to_static : Note<
   "use 'static' to give inline function %0 internal linkage">;
 
+def warn_possible_object_duplication_mutable : Warning<
+  "%0 is mutable, has hidden visibility, and external linkage; it may be "
+  "duplicated when built into a shared library">,
+  InGroup<UniqueObjectDuplication>, DefaultIgnore;
+def warn_possible_object_duplication_init : Warning<
+  "%0 has hidden visibility, and external linkage; its initialization may run "
----------------
zmodem wrote:

ultra nit: the comma feels redundant to me

https://github.com/llvm/llvm-project/pull/117622


More information about the cfe-commits mailing list