Skip to content
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

llama : add .clang-format file #10415

Merged
merged 1 commit into from
Nov 20, 2024
Merged

llama : add .clang-format file #10415

merged 1 commit into from
Nov 20, 2024

Conversation

slaren
Copy link
Collaborator

@slaren slaren commented Nov 19, 2024

I don't think we will be able to use this in large file since it breaks the alignment in many cases, but it should be ok for some files and formatting selections.

Formatted llama-bench.cpp as an example.

Note: this .clang-format file is compatible with clang-format 17. It may not work with previous versions.

Copy link
Collaborator

@JohannesGaessler JohannesGaessler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would be fine with enforcing a specific code style. I don't know about other IDEs/editors but the one I use (Doom Emacs) unfortunately does not highlight code that is in violation of the format specified in.clang_format. I can still format code from the command line using clang-format but one of my weaknesses is that I am prone to forgetting things like this.

It may make sense to amend CONTRIBUTING.md to instruct people to format newly added code.

SpacesInParentheses: false
SpacesInSquareBrackets: false
SpaceBeforeSquareBrackets: false
Standard: c++17
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be c++11?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be moving to c++17 now. The was some discussion on #10180.

@slaren slaren merged commit fab5d30 into master Nov 20, 2024
55 checks passed
@slaren slaren deleted the sl/clang-format branch November 20, 2024 11:57
arthw pushed a commit to arthw/llama.cpp that referenced this pull request Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants