Fix nullable-to-nonnull conversion errors in ExecuTorchModule.mm for Xcode 26#19335
Open
anviatmeta wants to merge 2 commits into
Open
Fix nullable-to-nonnull conversion errors in ExecuTorchModule.mm for Xcode 26#19335anviatmeta wants to merge 2 commits into
anviatmeta wants to merge 2 commits into
Conversation
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. This comment was automatically generated by Dr. CI and updates every 15 minutes. |
Contributor
|
@anviatmeta has exported this pull request. If you are a Meta employee, you can view the originating Diff in D103724159. |
…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
b9a4172 to
b42a0f4
Compare
shoumikhin
approved these changes
May 7, 2026
|
@pytorchbot label "release notes: none" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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