Guard NSString.UTF8String against nil in ExecuTorchModule.mm#19712
Conversation
Summary:
Fix 8 sites in ExecuTorchModule.mm where `-[NSString UTF8String]` (returns
`_Nullable`) was passed directly into C++ `Module` APIs typed
`const char *_Nonnull`. On iOS Apple bindings these compile with
`-Werror,-Wnullable-to-nonnull-conversion`, so each site failed the build,
breaking `messenger-jest-xcodestaging-iphonesimulator-{local,profile}-buck2`
(298/280 consecutive failures since ~2026-05-12) and causing the iOS
pct_healthy regression tracked in T271188257.
Apply the standard fbobjc fallback pattern `methodName.UTF8String ?: ""` at
every affected call. Behavior is unchanged for any non-nil method name (the
common case); a nil/empty NSString now degenerates to an empty C string instead
of a null pointer, matching what the C++ API contract already required.
Affected call sites (all in
xplat/executorch/extension/apple/ExecuTorch/Exported/ExecuTorchModule.mm):
- line 322 _module->load_method(...)
- line 366 _module->load_method(..., cppMap)
- line 380 _module->is_method_loaded(...)
- line 384 _module->unload_method(...)
- line 407 _module->method_meta(...)
- line 552 _module->set_input(...)
- line 592 _module->set_inputs(...)
- line 635 _module->set_output(...)
The Messenger-owned sites in the same compilation are being addressed in
D105868578.
Differential Revision: D105904682
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/19712
Note: Links to docs will display an error until the docs builds have been completed. ❗ 1 Active SEVsThere are 1 currently active SEVs. If your PR is affected, please view them below: ❌ 1 New FailureAs of commit 4e5b024 with merge base 64684c7 ( NEW FAILURE - The following job has failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
@metascroy has exported this pull request. If you are a Meta employee, you can view the originating Diff in D105904682. |
This PR needs a
|
Summary:
Fix 8 sites in ExecuTorchModule.mm where
-[NSString UTF8String](returns_Nullable) was passed directly into C++ModuleAPIs typedconst char *_Nonnull. On iOS Apple bindings these compile with-Werror,-Wnullable-to-nonnull-conversion, so each site failed the build,breaking
messenger-jest-xcodestaging-iphonesimulator-{local,profile}-buck2(298/280 consecutive failures since ~2026-05-12) and causing the iOS
pct_healthy regression tracked in T271188257.
Apply the standard fbobjc fallback pattern
methodName.UTF8String ?: ""atevery affected call. Behavior is unchanged for any non-nil method name (the
common case); a nil/empty NSString now degenerates to an empty C string instead
of a null pointer, matching what the C++ API contract already required.
Affected call sites (all in
xplat/executorch/extension/apple/ExecuTorch/Exported/ExecuTorchModule.mm):
The Messenger-owned sites in the same compilation are being addressed in
D105868578.
Differential Revision: D105904682