[clang] [TBAA] Don't emit pointer tbaa for unnamed structs or unions. (PR #116596)
Florian Hahn via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 20 11:12:38 PST 2024
================
@@ -230,6 +230,15 @@ llvm::MDNode *CodeGenTBAA::getTypeInfoHelper(const Type *Ty) {
->getString();
TyName = Name;
} else {
+ // For unnamed structs or unions C's compatible types rule applies. Two
+ // compatible types in different compilation units can have different
+ // mangled names, meaning the metadata emitted below would incorrectly
+ // mark them as no-alias. Use AnyPtr for such types in both C and C++, as
+ // C and C++ types may be visible when doing LTO.
----------------
fhahn wrote:
Thanks, added the clarifications as suggested!
https://github.com/llvm/llvm-project/pull/116596
More information about the cfe-commits
mailing list