Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
472e8d4
non-originating error compiles
antmor Dec 14, 2023
e358b92
fix with test cases
antmor Dec 15, 2023
a6ab125
and remove ignore
antmor Dec 15, 2023
cefa5fa
add runsettings to run tests from visual studio tester, modified read…
antmor Dec 18, 2023
a66ecd3
change map shouldOriginate to template parameter. Note, could be a br…
antmor Dec 19, 2023
3972237
settle on avoid_originate as naming scheme
antmor Dec 20, 2023
72689da
fix errors, more merging
antmor Sep 15, 2025
815d734
Merge branch 'microsoft-master' into user/antmor/non_originating
antmor Sep 15, 2025
dd18558
add a printf only to Lookup so we can add SFINAE or something like that.
antmor Sep 16, 2025
0dfa235
weird templating magic required... still not working, has error
antmor Sep 16, 2025
3f44814
trylookup exists to avoid throwing an error, and let's avoid avoid_or…
antmor Sep 17, 2025
cfaa2a6
remove test.
antmor Sep 17, 2025
e69a7fe
cleaned up and correctness.
antmor Sep 17, 2025
7051f24
undo changes to untouched files
antmor Sep 17, 2025
7b0072a
spacing changes , change do declval.
antmor Sep 18, 2025
783413a
added special tag to parameter list to make sure not to break existin…
antmor Sep 19, 2025
18a57a8
address avoid_oritinate comment, no need for a different name, resuse…
antmor Sep 19, 2025
2ee9368
change out async to a new name, with it being true by default.
antmor Sep 25, 2025
050fa7a
Address hresult comments by adding tests and removing source_locatoin…
antmor Sep 26, 2025
dc6777e
Merge branch 'master' into user/antmor/non_originating
ChrisGuzak Oct 16, 2025
4632e57
add unittest without specialization, make sure that the behaviour is …
antmor Oct 28, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add a printf only to Lookup so we can add SFINAE or something like that.
  • Loading branch information
antmor committed Sep 16, 2025
commit dd18558bbd253ca6939c120cc4de49a9aaa33475
63 changes: 56 additions & 7 deletions cppwinrt/code_writers.h
Original file line number Diff line number Diff line change
Expand Up @@ -1873,6 +1873,36 @@ namespace cppwinrt
}
}

static void write_produce_upcall_LOOKUP(writer& w, std::string_view const& upcall, method_signature const& method_signature)
{
if (method_signature.return_signature())
{
auto name = method_signature.return_param_name();

w.write("*% = detach_from<%>(%(%));",
name,
method_signature.return_signature(),
upcall,
bind<write_produce_args>(method_signature));
}
else
{
w.write("%(%);",
upcall,
bind<write_produce_args>(method_signature));
}

for (auto&& [param, param_signature] : method_signature.params())
{
if (param.Flags().Out() && !param_signature->Type().is_szarray() && is_object(param_signature->Type()))
{
auto param_name = param.Name();

w.write("\n if (%) *% = detach_abi(winrt_impl_%);", param_name, param_name, param_name);
}
}
}

static void write_produce_method(writer& w, MethodDef const& method)
{
std::string_view format;
Expand Down Expand Up @@ -1902,13 +1932,32 @@ namespace cppwinrt
method_signature signature{ method };
auto async_types_guard = w.push_async_types(signature.is_async());
std::string upcall = "this->shim().";
upcall += get_name(method);

w.write(format,
get_abi_name(method),
bind<write_produce_params>(signature),
bind<write_produce_cleanup>(signature),
bind<write_produce_upcall>(upcall, signature));
auto name = get_name(method);
upcall += name;
if (name == "Lookup")
{
format = R"( int32_t __stdcall %(%) noexcept final try
{
% typename D::abi_guard guard(this->shim());// hello world
%
return 0;
}
catch (...) { return to_hresult(); }
)";
w.write(format,
get_abi_name(method),
bind<write_produce_params>(signature),
bind<write_produce_cleanup>(signature),
bind<write_produce_upcall_LOOKUP>(upcall, signature));
}
else
{
w.write(format,
get_abi_name(method),
bind<write_produce_params>(signature),
bind<write_produce_cleanup>(signature),
bind<write_produce_upcall>(upcall, signature));
}
}

static void write_fast_produce_methods(writer& w, TypeDef const& default_interface)
Expand Down