-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Pass the Apple event tracer's C++ handle opaquely across the framework boundary #22396
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,8 +11,6 @@ | |
| #import "ExecuTorchDumpError.h" | ||
| #import "ExecuTorchDumpTracer+Internal.h" | ||
|
|
||
| #import <ExecuTorch/ExecuTorchEventTracer+Internal.h> | ||
|
|
||
| #import <flatcc/flatcc_builder.h> | ||
|
|
||
|
Comment on lines
11
to
15
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This compiles today (all six |
||
| using namespace executorch::etdump; | ||
|
|
@@ -39,25 +37,21 @@ @implementation ExecuTorchDumpTracer { | |
| NSLock *_lock; | ||
| } | ||
|
|
||
| // init chains to the base class's real designated initializer, initWithCppTracer:, | ||
| // which takes a C++ type and so lives in an Objective-C++ category rather than the | ||
| // public interface. Clang cannot see a category initializer as designated, so it | ||
| // wrongly flags this chain; the pattern is deliberate and correct. | ||
| #pragma clang diagnostic push | ||
| #pragma clang diagnostic ignored "-Wobjc-designated-initializers" | ||
|
|
||
| - (instancetype)init { | ||
| auto generator = std::make_unique<ETDumpGen>(); | ||
| _generator = generator.get(); | ||
| self = [super initWithCppTracer:std::move(generator)]; | ||
| // The base moves out of the pointee as a std::unique_ptr<EventTracer>, so the | ||
| // local must be that type, not unique_ptr<ETDumpGen>. _generator keeps the | ||
| // concrete pointer for readback. | ||
|
Comment on lines
41
to
+45
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This ivar-before-super ordering is pre-existing and unchanged by this PR ( |
||
| std::unique_ptr<executorch::runtime::EventTracer> tracer = | ||
| std::move(generator); | ||
| self = [super initWithNativeInstance:&tracer]; | ||
| if (self) { | ||
| _lock = [NSLock new]; | ||
| } | ||
| return self; | ||
| } | ||
|
|
||
| #pragma clang diagnostic pop | ||
|
|
||
| - (ETDumpGen *)generator { | ||
| return _generator; | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does compile in a clean build: the
apple (*) / buildandbuild-frameworks-iosCI jobs (OSS CMake framework build) all pass on this branch, and I also compiled the pattern locally under Xcode 26.event_tracer.htransitively provides both: itsevalue.h/result.h/array_ref.hincludes pullplatform/assert.h(ET_CHECK), and<memory>is present in its preprocessed output. The siblingExecuTorchTensor.mmrelies on the same transitive availability (no explicit<memory>there), so this follows the module convention.