Commit Graph
9 Commits
Author SHA1 Message Date
SADIK KUZUandJon Ross-Perkins a0763413cb Update pre-commit config (#2498)
Updating https://github.com/pre-commit/pre-commit-hooks ... updating 3298ddab3c13dd77d6ce1fc0baf97691430d84b0 -> v4.4.0 (frozen).
Updating https://github.com/google/pre-commit-tool-hooks ... already up to date.
Updating https://github.com/psf/black ... updating 2018e667a6a36ee3fbfa8041cd36512f92f60d49 -> 22.12.0 (frozen).
Updating https://github.com/pre-commit/mirrors-prettier ... updating d0a4882e1c96eca274f90b273f0f809ab3d98aff -> v3.0.0-alpha.4 (frozen).
Updating https://github.com/PyCQA/flake8 ... updating f8e1b317742036ff11ff86356fd2b68147e169f7 -> 6.0.0 (frozen).
Updating https://github.com/pre-commit/mirrors-mypy ... updating fde4bb992b03943ecb94207a52739ba07957bd06 -> v0.991 (frozen).
Updating https://github.com/codespell-project/codespell ... updating c6ecb9fc51571a77bc92e6c265c358aef7cb6c38 -> v2.2.2 (frozen).
Updating https://github.com/google/pre-commit-tool-hooks ... already up to date.

Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
2022-12-27 13:37:51 -08:00
Martim Martinsandmartimartins 31df852738 Remove non-needed Python 2.x inherit from object (#1622)
In Python 3.x it is not necessary to have `object` inheritance in classes, it may be useful to have `object` inheritance in classes if the code has support for Python 3.x, 2.x, but currently the present code does not contain support for python 2.x.

Co-authored-by: martimartins <martim13artins13@gmail.com>
2022-07-23 18:15:29 -07:00
Jon Meow 8b8715e871 Add mypy hints for migrate_cpp (#784)
(these are minimal, but adding them for completeness)
2021-08-26 09:28:16 -07:00
Jon Meow c94ff74ea2 Switch to run-clang-tidy for parallelism (#629)
Not sure why this affects include ordering, but it makes execution a _lot_ faster.
2021-07-16 10:48:20 -07:00
Jon Meow 2344a52e24 Start handling variable declarations (#571)
TODOs in the test for known issues.

I may switch the approach to getting the variable type (on examination, this isn't working quite as well as I'd thought) but for now I think it's okay. I had an earlier approach though that may work better overall -- I'd been thinking this would work better, but as you can see in the null check for type information, I think I missed a key point.

Anyways, what'd really been vexing me was `int i, j` which I think I handle passably well now. There's obviously room for improvement, but given I've been going at this for a couple days now, I thought it best to checkpoint where I was.

This also includes some related framework changes to fix bumps I was running into. Overall the tool should operate a bit more smoothly with these changes. There are still issues with overlapping replacements, but I think it's primarily with range-based for loops which I just need to take some time to fix.
2021-06-23 10:58:32 -07:00
Chandler CarruthandJon Meow 05261b7fe7 Remove the LLVM bootstrap and use Hombrew installed LLVM-12. (#551)
Now that LLVM 12 has been released we no longer have any need to
bootstrap LLVM to get the desired featureset. LLVM 12 is available
widely, including in Homebrew across multiple platforms and in the
GitHub action runners.

Sadly, the Linux distribution builds of LLVM-12 are largely broken and
not as useful for us. The Homebrew Linux install was also broken
originally, but I've worked extensively with the Homebrew folks to get
the Linux install into a really good shape. It should now work reliably.

There are two primary bugs in Linux LLVM packages that need to be fixed
before we can just use them:

- https://bugs.llvm.org/show_bug.cgi?id=43604
- https://bugs.llvm.org/show_bug.cgi?id=46321

Once those are addressed and point releases with the fixes widely
available we can further simplify things.

Even with the need to use Homebrew installs, using the released LLVM has
the extra advantage of making it easy to properly support Darwin ARM and
I've added that configuration so that I can test things there.

Last but not least, this will significantly shrink our build outputs
which should allow building much more in continuous integration on
GitHub actions without exceeding the action cache size limits. I've even
added several tweaks and adjustments to the compile and build flags to
improve the build performance and reduce the build output size.

Once this is landed and stable, we can consider adding the refactoring
tooling back to our CI.

One of the biggest downsides of this path is that our CI has to download
and install the LLVM toolchain from Homebrew on each run. This is pretty
slow (takes a couple of minutes). But it is a fixed overhead -- it won't
get worse over time. Eventually, we can either look at a much fancier
action configuration to avoid this or hopefully the Debian packages will
get updated and we can move back to those.

The bootstrapping has served us long enough at this point. We can
resurrect it if we ever find a compelling reason for breaking off of the
latest LLVM release as our host toolchain.

Co-authored-by: Jon Meow <46229924+jonmeow@users.noreply.github.com>
2021-06-09 10:00:46 -07:00
Jon Meow e619d3d632 Shift migrate script to a workflow class, and file renames to .carbon (#535)
This might need some customization, e.g. `woff2_decompress.impl.carbon` (as a file with a `main`) might be better as `woff2_decompress.carbon`, but I thought at least putting on `.carbon` extensions would help perspectives on files.

This restructures the script to make it easier to access standard info (e.g. cpp_files) without passing everywhere.
2021-06-01 10:15:03 -07:00
Jon Meow 6f544494b3 Use AST to start inserting fn (#530) 2021-05-13 14:58:32 -07:00
Jon MeowandMatthew Riley 88a9d244b7 Initial migration framework (#525)
What this does:

- Sets up a `migrate_cpp` tool which currently only runs `clang-tidy`.
  - This is intended to have more transformations in the future.
- Sets up a `migrate_cpp.sh` script.
  - This copies the original woff2 code into a `carbon` directory and runs the `migrate_cpp` tool on it there.
- Adds the initial `carbon` directory of woff2
  - To be clear, this is currently only updated via `clang-tidy`.
  - More transformations should be expected in the future.
- Minor related edits. For example:
  - Adjust pre-commit to skip the `carbon` directory, because it's third-party code and shouldn't be edited in the same way.
  - Adds `@brotli_carbon` as a local repository so that we can "build" outputs.
  - Makes clang-tidy from the bootstrap toolchain accessible for BUILD dependencies, as it's then used for `migrate_cpp`.

What this does not do:

- Any actual transformation of C++ code to Carbon

Co-authored-by: Matthew Riley <mdriley@gmail.com>
2021-05-11 10:13:47 -07:00