https://github.com/DKLoehr updated
https://github.com/llvm/llvm-project/pull/125526
>From 486c3297f1a316a103c6583daf732af2d00d0b96 Mon Sep 17 00:00:00 2001
From: Devon Loehr
Date: Thu, 21 Nov 2024 19:29:00 +
Subject: [PATCH 1/6] Warn when unique objects might be duplicated in shared
librar
DKLoehr wrote:
Thanks @zmodem for merging (and also reverting). Follow-up PR with the fix is
#125526.
https://github.com/llvm/llvm-project/pull/117622
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listi
https://github.com/DKLoehr created
https://github.com/llvm/llvm-project/pull/125526
This is attempt 2 to merge this, the first one is #117622. This properly
disables the tests when building for playstation, since the warning is disabled
there.
When a hidden object is built into multiple share
@@ -13374,6 +13374,62 @@ void Sema::checkNonTrivialCUnion(QualType QT,
SourceLocation Loc,
.visit(QT, nullptr, false);
}
+bool Sema::GloballyUniqueObjectMightBeAccidentallyDuplicated(
+const VarDecl *Dcl) {
+ if (!Dcl || !getLangOpts().CPlusPlus)
https://github.com/DKLoehr updated
https://github.com/llvm/llvm-project/pull/117622
>From 798b3f21593499194487c9877b8f4a3d9e44bb6e Mon Sep 17 00:00:00 2001
From: Devon Loehr
Date: Thu, 21 Nov 2024 19:29:00 +
Subject: [PATCH 1/5] Warn when unique objects might be duplicated in shared
librar
@@ -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,
DKLoehr wrote:
Addressed feedback, responded where appropriate. I've also done some digging
into how the warning should work on Windows: it seems like it'll be very
straightforward (just replace "has hidden visibility" with "doesn't have a dll
import/export attribute"), but I'll leave that for
https://github.com/DKLoehr updated
https://github.com/llvm/llvm-project/pull/117622
>From 798b3f21593499194487c9877b8f4a3d9e44bb6e Mon Sep 17 00:00:00 2001
From: Devon Loehr
Date: Thu, 21 Nov 2024 19:29:00 +
Subject: [PATCH 1/4] Warn when unique objects might be duplicated in shared
librar
https://github.com/DKLoehr updated
https://github.com/llvm/llvm-project/pull/117622
>From 798b3f21593499194487c9877b8f4a3d9e44bb6e Mon Sep 17 00:00:00 2001
From: Devon Loehr
Date: Thu, 21 Nov 2024 19:29:00 +
Subject: [PATCH 1/5] Warn when unique objects might be duplicated in shared
librar
https://github.com/DKLoehr updated
https://github.com/llvm/llvm-project/pull/117622
>From 798b3f21593499194487c9877b8f4a3d9e44bb6e Mon Sep 17 00:00:00 2001
From: Devon Loehr
Date: Thu, 21 Nov 2024 19:29:00 +
Subject: [PATCH 1/4] Warn when unique objects might be duplicated in shared
librar
@@ -0,0 +1,187 @@
+/**
+ * When building shared libraries, hidden objects which are defined in header
+ * files will be duplicated, with one copy in each shared library. If the
object
+ * was meant to be globally unique (one copy per program), this can cause very
+ * subtle bugs.
https://github.com/DKLoehr edited
https://github.com/llvm/llvm-project/pull/117622
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,187 @@
+/**
+ * When building shared libraries, hidden objects which are defined in header
+ * files will be duplicated, with one copy in each shared library. If the
object
+ * was meant to be globally unique (one copy per program), this can cause very
+ * subtle bugs.
@@ -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,
@@ -0,0 +1,187 @@
+/**
+ * When building shared libraries, hidden objects which are defined in header
+ * files will be duplicated, with one copy in each shared library. If the
object
+ * was meant to be globally unique (one copy per program), this can cause very
+ * subtle bugs.
@@ -13374,6 +13374,62 @@ void Sema::checkNonTrivialCUnion(QualType QT,
SourceLocation Loc,
.visit(QT, nullptr, false);
}
+bool Sema::GloballyUniqueObjectMightBeAccidentallyDuplicated(
+const VarDecl *Dcl) {
+ if (!Dcl || !getLangOpts().CPlusPlus)
@@ -0,0 +1,187 @@
+/**
+ * When building shared libraries, hidden objects which are defined in header
+ * files will be duplicated, with one copy in each shared library. If the
object
+ * was meant to be globally unique (one copy per program), this can cause very
+ * subtle bugs.
DKLoehr wrote:
> Can you share a few of the examples where it triggers, to get a feel for what
> this looks like on the LLVM code?
There's a text file linked in the initial description
([here](https://github.com/user-attachments/files/18563888/clang-warnings.txt),
for convenience) that summar
https://github.com/DKLoehr updated
https://github.com/llvm/llvm-project/pull/117622
>From 5ef8b8f3b84133ac7501331bf9b86b0b2f8b9ed9 Mon Sep 17 00:00:00 2001
From: Devon Loehr
Date: Thu, 21 Nov 2024 19:29:00 +
Subject: [PATCH 1/2] Warn when unique objects might be duplicated in shared
librar
https://github.com/DKLoehr updated
https://github.com/llvm/llvm-project/pull/117622
>From 5ef8b8f3b84133ac7501331bf9b86b0b2f8b9ed9 Mon Sep 17 00:00:00 2001
From: Devon Loehr
Date: Thu, 21 Nov 2024 19:29:00 +
Subject: [PATCH 1/3] Warn when unique objects might be duplicated in shared
librar
DKLoehr wrote:
I've now added documentation for this warning explaining what it means and how
to resolve it. I also added a release note mentioning its existence.
https://github.com/llvm/llvm-project/pull/117622
___
cfe-commits mailing list
cfe-commit
DKLoehr wrote:
@zmodem Thanks for the review! I've addressed the code comments. To your
questions:
> What about code that's not going into a shared library?
My impression is that you wouldn't mark things as having hidden visibility if
they're not going to a shared library at least some of the
DKLoehr wrote:
If a review was requested from you and this code isn't related, apologies: For
some reason attempting to rebase onto the current state of the repo ended up
including a bunch of random extra commits that aren't related, and that
resulted in a bunch of people automatically being a
https://github.com/DKLoehr updated
https://github.com/llvm/llvm-project/pull/117622
>From 5ef8b8f3b84133ac7501331bf9b86b0b2f8b9ed9 Mon Sep 17 00:00:00 2001
From: Devon Loehr
Date: Thu, 21 Nov 2024 19:29:00 +
Subject: [PATCH 1/2] Warn when unique objects might be duplicated in shared
librar
https://github.com/DKLoehr updated
https://github.com/llvm/llvm-project/pull/117622
>From 5ef8b8f3b84133ac7501331bf9b86b0b2f8b9ed9 Mon Sep 17 00:00:00 2001
From: Devon Loehr
Date: Thu, 21 Nov 2024 19:29:00 +
Subject: [PATCH 1/6] Warn when unique objects might be duplicated in shared
librar
@@ -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)
DKLoehr wrote:
Ping
https://github.com/llvm/llvm-project/pull/117622
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
DKLoehr wrote:
Ping
https://github.com/llvm/llvm-project/pull/117622
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
DKLoehr wrote:
Because this warning keeps firing in many different places, including in
third-party libraries, I've disabled it by default until I can go through and
fix all the instances. I think this provides a cleaner separation of concerns,
so that this PR isn't clogged up with various hou
https://github.com/DKLoehr updated
https://github.com/llvm/llvm-project/pull/117622
>From ba531f3dce1b992dad191e5a9f724ebdc6750d6c Mon Sep 17 00:00:00 2001
From: Devon Loehr
Date: Thu, 21 Nov 2024 19:29:00 +
Subject: [PATCH] Warn when unique objects might be duplicated in shared
libraries
https://github.com/DKLoehr updated
https://github.com/llvm/llvm-project/pull/117622
>From d944b2fde573a4fb352400ce3425121265b02685 Mon Sep 17 00:00:00 2001
From: Devon Loehr
Date: Thu, 21 Nov 2024 19:29:00 +
Subject: [PATCH 1/2] Warn when unique objects might be duplicated in shared
librar
https://github.com/DKLoehr updated
https://github.com/llvm/llvm-project/pull/117622
>From d944b2fde573a4fb352400ce3425121265b02685 Mon Sep 17 00:00:00 2001
From: Devon Loehr
Date: Thu, 21 Nov 2024 19:29:00 +
Subject: [PATCH] Warn when unique objects might be duplicated in shared
libraries
https://github.com/DKLoehr created
https://github.com/llvm/llvm-project/pull/117622
When a hidden object is built into multiple shared libraries, each instance of
the library will get its own copy. If
the object was supposed to be globally unique (e.g. a global variable or static
data member),
33 matches
Mail list logo