================
@@ -717,6 +717,32 @@ class CodeGenModule : public CodeGenTypeCache {
   /// Return true iff an Objective-C runtime has been configured.
   bool hasObjCRuntime() { return !!ObjCRuntime; }
 
+  /// Check if a direct method should use precondition thunks (exposed 
symbols).
+  /// This applies to ALL direct methods (including variadic).
+  /// Returns false if OMD is null or not a direct method.
+  bool usePreconditionThunk(const ObjCMethodDecl *OMD) const {
+    return OMD && OMD->isDirectMethod() &&
+           getLangOpts().ObjCRuntime.isNeXTFamily() &&
+           getCodeGenOpts().ObjCDirectPreconditionThunk;
+  }
+
+  /// Check if a direct method should use precondition thunks at call sites.
+  /// This applies only to non-variadic direct methods.
+  /// Returns false if OMD is null or not eligible for thunks (e.g. variadic
+  /// methods).
+  bool shouldHavePreconditionThunk(const ObjCMethodDecl *OMD) const {
+    return OMD && usePreconditionThunk(OMD) && OMD->canHavePreconditionThunk();
----------------
kyulee-com wrote:

The null check and the call to `isDirectMethod()` appear to be repeated. Can we 
simplify this logic?
```suggestion
    return usePreconditionThunk(OMD) && !OMD->isVariadic();
```

https://github.com/llvm/llvm-project/pull/170616
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to