[clang] Warn when unique objects might be duplicated in shared libraries (PR #117622)
Hans Wennborg via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 16 05:15:15 PST 2025
================
@@ -13386,6 +13386,62 @@ void Sema::checkNonTrivialCUnion(QualType QT, SourceLocation Loc,
.visit(QT, nullptr, false);
}
+bool Sema::GloballyUniqueObjectMightBeAccidentallyDuplicated(
+ const VarDecl *dcl) {
+ if (!dcl || !getLangOpts().CPlusPlus)
+ return false;
+
+ // If an object is defined in a source file, its definition can't get
----------------
zmodem wrote:
At this point it's not clear that we're looking at a definition, so maybe move this check below the "is this a definition" check below?
https://github.com/llvm/llvm-project/pull/117622
More information about the cfe-commits
mailing list