Skip to content

format: run rg --files --type c --type cpp --glob '!external/' | xags clang-format -i #518

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

kkysen
Copy link
Contributor

@kkysen kkysen commented Mar 3, 2025

A lot of files aren't formatted correctly, so whenever I edit files and format, it adds a lot of extra formatting fixes, which makes PRs much harder to review with all of this extraneous info.

We should probably add this to CI/pre-commit hook, but this should be enough for now.

This is a more complete fix to #516, which was getting in the way of reviewing #514.

@fw-immunant
Copy link
Contributor

This looks to have broken lit testing for the rewriter.

@kkysen
Copy link
Contributor Author

kkysen commented Mar 3, 2025

This looks to have broken lit testing for the rewriter.

Oh weird, it worked fine locally. I'll fix it later at some point, not too important if it's not trivial.

@kkysen kkysen force-pushed the kkysen/clang-format branch 2 times, most recently from 9567b6b to f039543 Compare March 3, 2025 20:11
@fw-immunant
Copy link
Contributor

I'd like to wait until other PRs land before we merge this, since it'll create a lot of conflicts. There are also some formatting decisions that clang-format makes here that really destroy readability, mostly around macros. Can we ask clang-format not to alter macro definitions? E.g. see ia2_internal.h where it puts comments and newlines on the wrong lines.

kkysen added 2 commits March 7, 2025 08:10
This disables `clang-format` in some macros with `__asm__`s,
where it moves comments to the wrong lines.

This also adds `AllowShortBlocksOnASingleLine: Always` to `.clang-format`,
as this is needed to keep LLVM `lit` tests still working.
…gs clang-format -i`

A lot of files aren't formatted correctly,
so whenever I edit files and format,
it adds a lot of extra formatting fixes,
which makes PRs much harder to review
with all of this extraneous info.

We should probably add this to CI/pre-commit hook,
but this should be enough for now.
@kkysen kkysen force-pushed the kkysen/clang-format branch from f039543 to 8404474 Compare March 7, 2025 16:11
@kkysen
Copy link
Contributor Author

kkysen commented Mar 7, 2025

I'd like to wait until other PRs land before we merge this, since it'll create a lot of conflicts.

It makes it a bit easier for me actually, as most of those PRs are mine, and they've been having conflicts on formatting since not everything is formatted, especially when I try to move them around and re-order them. Having everything consistently formatted should make that easier.

There are also some formatting decisions that clang-format makes here that really destroy readability, mostly around macros. Can we ask clang-format not to alter macro definitions? E.g. see ia2_internal.h where it puts comments and newlines on the wrong lines.

I disabled clang-format there. It was already disabled for the __x86_64__ macro for the same reason, just not the aarch64 one. For the other macros, I checked and it's mostly just lining up the \s, not moving comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants