[clang] Enable unique-object-duplication warning for windows (PR #143537)

Devon Loehr via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 11 09:23:53 PDT 2025


================
@@ -825,13 +827,15 @@ The warning can be resolved by removing one of the conditions above. In rough
 order of preference, this may be done by:
 1. Marking the object ``const`` (if possible)
 2. Moving the object's definition to a source file
-3. Giving the object non-hidden visibility, e.g. using ``__attribute((visibility("default")))``.
+3. Making the object visible using ``__attribute((visibility("default")))``,
+   ``__declspec(dllimport)``, or ``__declspec(dllexport)``.
+
+When annotating an object with ``__declspec(dllimport)`` or ``__declspec(dllexport)``,
+take care to ensure that the object is only imported in one dll, and is exported
+everywhere else.
----------------
DKLoehr wrote:

Oops

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


More information about the cfe-commits mailing list