Fix nullable-to-nonnull conversion errors in ExecuTorchModule.mm for Xcode 26#19335
Fix nullable-to-nonnull conversion errors in ExecuTorchModule.mm for Xcode 26#19335anviatmeta wants to merge 1 commit intopytorch:mainfrom
Conversation
…Xcode 26 Summary: In Xcode 26 (xcodestaging), NSString.UTF8String is annotated as returning a nullable pointer (const char * _Nullable). When this value is passed directly to C++ methods that expect const char * _Nonnull, the compiler emits -Wnullable-to-nonnull-conversion warnings which are promoted to errors via -Werror. This causes a build failure in xplat/executorch/extension/apple:ExecuTorch that blocks downstream test targets including BSLInspirationActionsTests owned by edits_workflows_ios. The fix adds ?: "" (nil-coalescing to empty string) at each call site where methodName.UTF8String or similar is passed to a C++ API expecting a non-null pointer. Since the methodName parameters are already typed as nonnull NSString *, the fallback is defensive only — it satisfies the compiler nullability analysis without changing runtime behavior. Differential Revision: D103724159
5caed51 to
b9a4172
Compare
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/19335
Note: Links to docs will display an error until the docs builds have been completed. ⏳ 1 Pending, 4 Unrelated FailuresAs of commit b9a4172 with merge base c7e8628 ( BROKEN TRUNK - The following jobs failed but were present on the merge base:👉 Rebase onto the `viable/strict` branch to avoid these failures
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
@anviatmeta has exported this pull request. If you are a Meta employee, you can view the originating Diff in D103724159. |
This PR needs a
|
Summary:
In Xcode 26 (xcodestaging), NSString.UTF8String is annotated as returning a nullable pointer (const char * _Nullable). When this value is passed directly to C++ methods that expect const char * _Nonnull, the compiler emits -Wnullable-to-nonnull-conversion warnings which are promoted to errors via -Werror. This causes a build failure in xplat/executorch/extension/apple:ExecuTorch that blocks downstream test targets including BSLInspirationActionsTests owned by edits_workflows_ios.
The fix adds ?: "" (nil-coalescing to empty string) at each call site where methodName.UTF8String or similar is passed to a C++ API expecting a non-null pointer. Since the methodName parameters are already typed as nonnull NSString *, the fallback is defensive only — it satisfies the compiler nullability analysis without changing runtime behavior.
Differential Revision: D103724159