commit | a8680262533feaa5b5f6f677d649dba62a6d6c06 | [log] [tgz] |
---|---|---|
author | Sam McCall <sammccall@google.com> | Thu Sep 21 05:55:27 2023 -0700 |
committer | Copybara-Service <copybara-worker@google.com> | Thu Sep 21 05:56:29 2023 -0700 |
tree | d2a15d8cf70eecba787202d7895deb4caea37e3b | |
parent | a68991eb371fb48a9fbfe4cbf9508e6b2871f64d [diff] |
Rework PointerNullState APIs These now return Formulas instead of BoolValues, which drops the requirement to be atomic bools, and opens the door to true/false becoming Formula primitives rather than Atoms in the framework (and formula simplification). The connection between nonnull annotations and the is_null property is now expressed as a global invariant, so it works properly when is_null is neither exactly true/false nor unconstrained - i.e. when it's restricted by a symbolic nullability variable in inference. PiperOrigin-RevId: 567282695 Change-Id: I2e8ac1c173c8bb1526a357d3eafc08935ec8a2da
Crubit is an experimental bidirectional bindings generator for C++ and Rust.
Please don‘t use, this is an experiment and we don’t yet know where will it take us. There will be breaking changes without warning. Unfortunately, we can't take contributions at this point.
Crubit allows for C++ code and Rust code to call each other without manually wrapping the APIs in an FFI-friendly interop layer. For example, a C++ function like this:
bool IsAbsPath(std::string_view path);
... becomes callable from Rust as if it were defined as:
pub fn IsAbsPath(path: std::string_view) -> bool {...}
Crubit automatically generates ABI-compatible bindings for structs (which can be passed both by value and by reference), functions, and methods, for a large variety of types. (Trivial types, nontrivial types, templated types, etc.)
$ apt install clang lld bazel $ git clone git@github.com:google/crubit.git $ cd crubit $ bazel build --linkopt=-fuse-ld=/usr/bin/ld.lld //rs_bindings_from_cc:rs_bindings_from_cc_impl
$ git clone https://github.com/llvm/llvm-project $ cd llvm-project $ CC=clang CXX=clang++ cmake -S llvm -B build -DLLVM_ENABLE_PROJECTS='clang' -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install $ cmake --build build -j $ # wait... $ cmake --install build $ cd ../crubit $ LLVM_INSTALL_PATH=../llvm-project/install bazel build //rs_bindings_from_cc:rs_bindings_from_cc_impl