[clang] [CIR] Implement pointer type RTTI (PR #184011)

Amr Hesham via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 9 10:41:08 PDT 2026


================
@@ -0,0 +1,79 @@
+// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-linux-gnu -fcxx-exceptions -fexceptions -fclangir -emit-cir %s -o %t.cir
+// RUN: FileCheck --input-file=%t.cir %s -check-prefix=CIR
+// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-linux-gnu -fcxx-exceptions -fexceptions -fclangir -emit-llvm %s -o %t-cir.ll
+// RUN: FileCheck --input-file=%t-cir.ll %s -check-prefix=LLVM
+// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-linux-gnu -fcxx-exceptions -fexceptions -emit-llvm %s -o %t.ll
+// RUN: FileCheck --input-file=%t.ll %s -check-prefix=OGCG
+
+// Test RTTI emission for pointer-to-member types (abi::__pointer_to_member_type_info).
+// Each descriptor must use the __pointer_to_member_type_info vtable and carry
+// three extra fields beyond the standard type_info header:
+//   __flags    (unsigned int)
+//   __pointee  (const type_info* for the pointed-to type)
+//   __context  (const __class_type_info* for the containing class)
+
+struct A {
+  int data;
+  void func();
+};
+
+// --- Test 1: data member pointer (int A::*) ---
----------------
AmrDeveloper wrote:

IMO, we can remove those comments from the test file, the information can be known from the function signature and body, same for the explanation about mapping between type and type info global name.

cc. @andykaylor 

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


More information about the cfe-commits mailing list