[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:46 PST 2025


================
@@ -3661,6 +3661,12 @@ class Sema final : public SemaBase {
                              NonTrivialCUnionContext UseContext,
                              unsigned NonTrivialKind);
 
+  /// Certain globally-unique variables might be accidentally duplicated if
+  /// built into multiple shared libraries with hidden visibility. This can
+  /// cause problems if the variable is mutable, its initialization is
+  /// effectful, or its address is taken.
+  bool GloballyUniqueObjectMightBeAccidentallyDuplicated(const VarDecl *dcl);
----------------
zmodem wrote:

ultra nit: the parameter is `Dcl` in the definition

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


More information about the cfe-commits mailing list