[clang] [CIR] Upstream RTTI Builder & RTTI for VTable Definitions (PR #160002)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 24 13:08:15 PDT 2025


================
@@ -250,6 +267,18 @@ class CIRGenModule : public CIRGenTypeCache {
   mlir::Attribute getAddrOfRTTIDescriptor(mlir::Location loc, QualType ty,
                                           bool forEH = false);
 
+  static mlir::SymbolTable::Visibility getCIRVisibility(Visibility v) {
+    switch (v) {
+    case DefaultVisibility:
+      return mlir::SymbolTable::Visibility::Public;
+    case HiddenVisibility:
+      return mlir::SymbolTable::Visibility::Private;
+    case ProtectedVisibility:
+      llvm_unreachable("NYI");
----------------
andykaylor wrote:

```suggestion
      // The distinction between ProtectedVisibility and DefaultVisibility is that
      // symbols with ProtectedVisibility, while visible to the dynamic linker like
      // DefaultVisibility, are guaranteed to always dynamically resolve to a
      // symbol in the current shared object. There is currently no equivalent
      // MLIR visibility, so we fall back on the fact that the symbol is visible.
      return mlir::SymbolTable::Visibility::Public;
```

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


More information about the cfe-commits mailing list