[gidl][hlcpp] Enable more handle tests for HLCPP

This CL enables more GIDL handle tests for HLCPP that were omitted in
Iabf87cf877b31cd33c50622888f098c97fab5449. To make this work:

* fidlgen_hlcpp now emits `#ifdef`s based on the `resource` modifier
  instead of the `is_resource` typeshape field. This is needed because
  the code for `flexible resource union Foo {};` has a method taking
  `zx::handle`, but the typeshape field is false.

* GIDL now emits `#ifdef`s in HLCPP when the top-level type is resource
  (as before) or when handle_defs is nonempty (new). This is needed for
  decode_failure tests on value types rejecting handles.

The first change is accomplished using .IsResourceType from the embedded
Resourceness struct (represents the modifier) instead of the .IsResource
bool copied from the typeshape. This similar naming is confusing, but it
will be resolved soon when the typeshape field is removed in
I2e2ba2035f8e76004c2d4b9e64638501844b2761 (currently blocked).

This also removes xunion_handles_unittest.cc since all its tests are now
covered by union.gidl.

Test: fx test fidl-hlcpp-conformance-test
Test: fx test fidl_cpp_host_conformance_test
Bug: 36441
Bug: 62576
Change-Id: I643537a0b12c2d1480e734f31377c0ac356ee266
Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/443451
Commit-Queue: Mitchell Kember <mkember@google.com>
Reviewed-by: Felix Zhu <fcz@google.com>
Testability-Review: Felix Zhu <fcz@google.com>
18 files changed
tree: 51577a8f88a0784d17830b181327ea6af97d9882
  1. boards/
  2. build/
  3. bundles/
  4. docs/
  5. examples/
  6. garnet/
  7. products/
  8. scripts/
  9. sdk/
  10. src/
  11. third_party/
  12. tools/
  13. zircon/
  14. .clang-format
  15. .clang-tidy
  16. .gitattributes
  17. .gitignore
  18. .gn
  19. .style.yapf
  20. AUTHORS
  21. BUILD.gn
  22. CODE_OF_CONDUCT.md
  23. CONTRIBUTING.md
  24. LICENSE
  25. OWNERS
  26. PATENTS
  27. README.md
  28. rustfmt.toml
README.md

Fuchsia

Pink + Purple == Fuchsia (a new operating system)

What is Fuchsia?

Fuchsia is a modular, capability-based operating system. Fuchsia runs on modern 64-bit Intel and ARM processors.

Fuchsia is an open source project with a code of conduct that we expect everyone who interacts with the project to respect.

Read more about Fuchsia's principles.

How can I build and run Fuchsia?

See Getting Started.

Where can I learn more about Fuchsia?

See fuchsia.dev.