Proto commits in google/clif

These 20 commits are when the Protocol Buffers files have changed:

Commit:8c98ad0
Author:rwgk
Committer:Ralf W. Grosse-Kunstleve

Add `clif_matcher_argv0` Example output: ``` // This file was automatically generated by PyCLIF-C-API. // clif_matcher_argv0: "third_party/crosstool/v18/stable/toolchain/bin/clif_matcher" // clif_matcher_version_stamp: 546096150 // source: third_party/clif/testing/python/absl_int128.clif ``` PiperOrigin-RevId: 546110677

The documentation is generated from this commit.

Commit:cbd8cd4
Author:rwgk
Committer:Xiaofei Wang

Introduce `clif_matcher_version_stamp` This CL: Simply report the `clif_matcher_version_stamp` in the generated _clif.h, _clif.cc, _clif_init.cc files. Later: Use the `clif_matcher_version_stamp` to trigger informative build failures if the clif_matcher binary is out of date (to pre-empt fear, uncertainty, doubt, and time-consuming debugging of downstream failures). Motivation for this CL: It turns out some clif_matcher binaries in google3 are months out of date. Release of the binaries is not globally coordinated. Manually tested with `_GEN_PYBIND11 = True` in google3/devtools/clif/python/clif_build_rule.bzl PiperOrigin-RevId: 531759027

Commit:e337fbe
Author:wangxf
Committer:Xiaofei Wang

Add decorator `suppress_const_sharedptr_conversion` to ClassDecl. This is for preparation of making legacy PyCLIF generate `Clif_PyObj` functions for `shared_ptr<const T>`. Currently people are already creating their own `shared_ptr<const T>` conversion functions. For example, https://source.corp.google.com/piper///depot/google3/borg/public/python/scaling_map.h;l=12. We need this decorator to avoid conflicts. PiperOrigin-RevId: 516943126

Commit:fcf26c8
Author:wangxf
Committer:Xiaofei Wang

Add a new field cpp_canonical_type to CLIF ast. This will be used by pybind11 code generator to do topological sort. This cl is originated from cl/494078194 by rwgk@. TGP: https://fusion2.corp.google.com/presubmit/tap/502749558/OCL:502749558:BASE:502991253:1674083433358:3656ad17/targets PiperOrigin-RevId: 503256505

Commit:7e10b77
Author:wangxf
Committer:Xiaofei Wang

Allow return value policy overwrite. It is hard for the pybind11 code generator to automatically choose return value policy for complex types. So at least we have a workaround to choose the return value policy by ourselves. PiperOrigin-RevId: 446486278

Commit:f84e91e
Author:CLIF Team
Committer:Xiaofei Wang

Project import generated by Copybara. PiperOrigin-RevId: 415086653

Commit:120df2e
Author:wangxf
Committer:Ralf W. Grosse-Kunstleve

Allow building all py_clif_cc targets with pybind11 using blaze --define. This is achieved by rewriting py_clif_cc rule so that it changes behavior based on whether `--define GEN_PYBIND11=true` is found on command line or not. Note that now //devtools/clif:gen_pybind11 is a dependency for all py_clif_cc targets. PiperOrigin-RevId: 397117954

Commit:8f4d2a4
Author:wangxf
Committer:Ralf W. Grosse-Kunstleve

Fix the typo "supress". "supress" -> "suppress". PiperOrigin-RevId: 396278125

Commit:99cce38
Author:wangxf
Committer:Ralf W. Grosse-Kunstleve

Make pybind11 code generator support dependency on other CLIF targets. PiperOrigin-RevId: 379790926

Commit:e105f6a
Author:rwgk
Committer:Ralf W. Grosse-Kunstleve

Leveraging `StatusEnvelope` for full PyCLIF-SWIG `absl::Status` interoperability. The immediate motivation for this CL is to unblock the SWIG-PyCLIF conversion of `pywraprpc`, specifically to unblock completing the work started under the submitted cl/374311562, and the chain of pending follow-on CLs cl/372457844, cl/372459026, cl/372462745, cl/373266225. This CL effectively implements `NonRaisingStatus` similar to the ideas in a [small slide deck from last year](https://docs.google.com/presentation/d/16gwDCv9yZJp1psYKeLArfIpCjnOuEsxLuJFRSSTI6ng/), but in a minimally intrusive fashion, by introducing a new `@non_raising` decorator in third_party/clif/python. A `Status` return marked `@non_raising` in .clif files produces a `StatusEnvelope` object, which: * contains an `absl::Status` object, but also * emulates the `absl::Status` API relevant to Python (with some omissions that can be filled in as needed in the future). PyCLIF-SWIG `absl::Status` interoperability is achieved via Python capsules with `absl::Status` pointers. The corresponding (very small) implementations are in: * util/task/python/clif/status_from_capsule.h|cc (calls `as_absl_Status`; used by `Clif_PyObjAs` in clif.cc) * util/task/python/task.swig (provides `as_absl_Status` for `Clif_PyObjAs`) * util/task/python/clif/status_envelope.h (provides both `as_void_ptr_capsule` for SWIG and `as_absl_Status` for `Clif_PyObjAs`) For `as_void_ptr_capsule` see: go/clif-primer#pyclif_swig_interop The bulk of the non-test changes in this CL is to factor out most of the code from util/task/python/clif.h|cc into: * util/task/python/clif/status_envelope.h * util/task/python/clif/status_pyexc.h|cc The moved code is mostly unchanged, except for clang-format cleanup. The refactoring is needed to make `StatusEnvelope` independent of the `Clif_PyObjFrom` and `ClifPyObjAs` functions for `absl::Status`, to avoid a dependency cycle. The moved code is in a new `util_task_python_clif` namespace, for improved code organization, which might also be useful later when pulling the `absl::Status` converters completely out of the legacy `util` namespace and the util/task directory. To untangle the complicated two-way dependencies between `//util/task/python` and `//devtools/clif/python`, `util::Get_UtilStatusOk()` was moved to `devtools_clif_python_postproc::SingletonIndicatingStatusOk()`. Related follow-on cleanup work will be tracked under b/189101233. Additional cleanup work will be tracked under b/189103907: migrate dependents of the moved code, remove the then obsolete `util::StatusEnvelope`, the backwards-compatibility functions in clif.h, and clif.clif. All new code is IWYU clean. build_cleaner was run as well. PiperOrigin-RevId: 375739274

Commit:e9b4263
Author:wangxf
Committer:Ralf W. Grosse-Kunstleve

Temporarily disable default_args_test until matcher releases. Right now default_args_test causes ASAN failure because the pybind11 code generator generates function casts with incorrect number of parameters. For example, in default_args.h, `MethodWithOutputDefault` takes 2 parameters where both of them has default values. PyCLIF supports wrapping `MethodWithOutputDefault` without parameters because default values exist. The function cast generated is based on PyCLIF function definition, which might be different from the actual C++ function definition. One way to fix the error is to generate a lambda expression for functions like this. But now we are not able to know when the function signature between PyCLIF and C++ differs. Therefore I added another attribute to func_decl for the number of C++ function parameters. PiperOrigin-RevId: 371946517

Commit:d9abdb6
Author:wangxf
Committer:Ralf W. Grosse-Kunstleve

Make PyCLIF matcher support checking implicit conversions. PiperOrigin-RevId: 367524250

Commit:c39aa51
Author:wangxf
Committer:Ralf W. Grosse-Kunstleve

Add cpp_polymorphic to PyCLIF ast. PiperOrigin-RevId: 363692495

Commit:77cab12
Author:wangxf
Committer:Ralf W. Grosse-Kunstleve

Make PyCLIF matcher set mangle name for functions. PiperOrigin-RevId: 363288530

Commit:9cda597
Author:wangxf
Committer:Ralf W. Grosse-Kunstleve

Make cindex extractor support checking overloaded functions. Functions with parameters like reference to pointers, rvalue references, pointer to pointers, pointer to constants might not work properly. This CL introduces very low-level manipulations of C++ type names (stripping spaces, stars, ampersands) that are difficult to generalize and maintain. We are exploring alternative approaches that may allow us to avoid such manipulations. In the meantime this CL unblocks the work on the pybind11 code generator. PiperOrigin-RevId: 362354347

Commit:1cfcc62
Author:wangxf
Committer:Ralf W. Grosse-Kunstleve

Make the extractor support checking whether a function is pure virtual or not. The cindex based extractor traverses the Clang AST, and registers function and class declarations to maps indexed by fully qualified names. The extractor only extracts the information needed by the pybind11 code generator and ignores other declarations. For example, when the extractor sees an variable declaration, it simply ignores it because currently we don't need any extra information from var declarations. PiperOrigin-RevId: 358485630

Commit:4a2914a
Author:wangxf
Committer:Ralf W. Grosse-Kunstleve

Add @supress_upcasts to CLIF. If this decorator is specified, upcasts will not be generated by CLIF. PiperOrigin-RevId: 349335667

Commit:5976e27
Author:CLIF Team
Committer:Akekawit Jitprasert

Project import generated by Copybara. PiperOrigin-RevId: 331177628

Commit:59d4e16
Author:CLIF Team
Committer:Mike Rovner

Project import generated by Copybara. PiperOrigin-RevId: 170557539

Commit:4e412c0
Author:CLIF Team
Committer:Mike Rovner

Project import generated by Copybara (go/copybara). PiperOrigin-RevId: 153898415