[llvm-branch-commits] [clang] [ExposeObjCDirect] Optimizations (PR #170619)

Oliver Hunt via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Feb 4 20:08:45 PST 2026


================
@@ -330,10 +340,23 @@ class CGObjCRuntime {
                                      QualType resultType,
                                      CallArgList &callArgs);
 
-  bool canMessageReceiverBeNull(CodeGenFunction &CGF,
-                                const ObjCMethodDecl *method, bool isSuper,
-                                const ObjCInterfaceDecl *classReceiver,
-                                llvm::Value *receiver);
+  /// Check if the receiver of an ObjC message send can be null.
+  /// Returns true if the receiver may be null, false if provably non-null.
+  ///
+  /// This can be overridden by subclasses to add runtime-specific heuristics.
+  /// Base implementation checks:
+  /// - Super dispatch (always non-null)
+  /// - Self in const-qualified methods (ARC)
+  /// - Weak-linked classes
+  ///
+  /// Future enhancements in CGObjCCommonMac override:
+  /// - _Nonnull attributes
+  /// - Results of alloc, new, ObjC literals
----------------
ojhunt wrote:

This change seems unnecessary?

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


More information about the llvm-branch-commits mailing list