[clang] [TBAA] Only emit pointer tbaa metedata for record types. (PR #116991)

John McCall via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 20 15:38:21 PST 2024


================
@@ -230,6 +232,11 @@ llvm::MDNode *CodeGenTBAA::getTypeInfoHelper(const Type *Ty) {
               ->getString();
       TyName = Name;
     } else {
+      // Be conservative if the type a MemberPointerType. Those would require
+      // stripping const-qualifiers inside the type.
+      if (Ty->isMemberPointerType())
+        return AnyPtr;
----------------
rjmccall wrote:

You know, you were probably right the first time to bail out for all non-record types — if we run into a vector type, or an ObjC pointer type, or something like that, it'd be better to fall back on AnyPtr.  Please leave a comment saying that we're specifically *required* to do this for member pointers until we implement the similar-types rule, though.

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


More information about the cfe-commits mailing list