commit | 54efc16014402e5ebab2c2135b4de824a429c8df | [log] [tgz] |
---|---|---|
author | Lukasz Anforowicz <lukasza@google.com> | Fri Dec 16 15:58:44 2022 -0800 |
committer | Copybara-Service <copybara-worker@google.com> | Fri Dec 16 15:59:29 2022 -0800 |
tree | f282a734ec43e03682836ce29936d700cd3a579c | |
parent | 4c19ad934e8094a7dddeebde4eebcd1bc9215ac5 [diff] |
Hiding more namespace-body-formatting within `code_gen_utils.rs`. As pointed out in "A Philosophy of Software Design" moving code up or down the architectural layers can often bring related code together and therefore help improve modularity of code. Before this CL `common/code_gen_utils.rs` would provide `NamespaceQualifier::format_with_cc_body` and `cc_bindings_from_rs/bindings.rs` would group consecutive snippets from the same namespace. After this CL, all of this is hidden as an implementation detail of a new `format_namespace_bound_cc_tokens` API offered by `common/code_gen_utils.rs`. The public API of `common/code_gen_utils.rs` is slightly simpler before this CL: fn format_with_cc_body(&self, body: TokenStream) -> Result<TokenStream> and slightly more complicated after this CL: pub fn format_namespace_bound_cc_tokens( iter: impl IntoIterator<Item = (NamespaceQualifier, TokenStream)>, ) -> Result<TokenStream> Nevertheless, overall the modularity and readability seems improved. The only behavior change in this CL is to insert an empty line between different namespaces. PiperOrigin-RevId: 495980348
Extremely experimental interop tooling 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.
$ 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