tree: 3f0e36453c1e755beb40572158cf1a58ef06696c [path history] [tgz]
  1. bazel_support/
  2. importers/
  3. support/
  4. test/
  5. ast_consumer.cc
  6. ast_consumer.h
  7. ast_convert.cc
  8. ast_convert.h
  9. ast_util.cc
  10. ast_util.h
  11. bazel_types.cc
  12. bazel_types.h
  13. bazel_types_test.cc
  14. BUILD
  15. cmdline.cc
  16. cmdline.h
  17. cmdline_test.cc
  18. collect_instantiations.cc
  19. collect_instantiations.h
  20. collect_instantiations.rs
  21. collect_instantiations_test.cc
  22. collect_namespaces.cc
  23. collect_namespaces.h
  24. collect_namespaces_test.cc
  25. decl_importer.h
  26. frontend_action.cc
  27. frontend_action.h
  28. generate_bindings_and_metadata.cc
  29. generate_bindings_and_metadata.h
  30. generate_bindings_and_metadata_test.cc
  31. importer.cc
  32. importer.h
  33. importer_test.cc
  34. ir.cc
  35. ir.h
  36. ir.rs
  37. ir_from_cc.cc
  38. ir_from_cc.h
  39. ir_from_cc_test.rs
  40. ir_testing.rs
  41. json_from_cc.cc
  42. README.md
  43. rs_bindings_from_cc.cc
  44. salsa_utils.rs
  45. src_code_gen.cc
  46. src_code_gen.h
  47. src_code_gen.rs
  48. token_stream_matchers.rs
rs_bindings_from_cc/README.md

rs_bindings_from_cc

Disclaimer: This project is experimental, under heavy development, and should not be used yet.

:rs_bindings_from_cc parses C++ headers and generates:

  • a Rust source file with bindings for the C++ API
  • a C++ source file with the implementation of the bindings

For convenience, :test_wrapper is a shell script that passes all Clang command line flags from the current Bazel C++ toolchain:

bazel run //rs_bindings_from_cc:test_wrapper -- --public_headers=hello_world.h

or:

bazel build //rs_bindings_from_cc:test_wrapper
bazel-bin/rs_bindings_from_cc/test_wrapper --public_headers=hello_world.h

Testing

If possible follow these recommendations:

To run individual rust tests with bazel test (like bazel test --test_filter=<test> for gtest cases), give the test function name as --test_arg=<test>.

To get Rust backtraces for rs_bindings_from_cc when running end-to-end tests, use bazel test --action_env=RUST_BACKTRACE=1 to run the tests.

Contributing

Chat room (internal): https://chat.google.com/room/AAAAImO--WA

20% starter projects list (internal): b/hotlists/3645339