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

Clang formatter and a workflow for checking #1530

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cubicYYY
Copy link
Contributor

All source codes are now formatted.
clang-format.sh should be run for new commits.

The .clang-format file is updated. It is now corresponding to a style like the status quo.
The .clang-format-ignore file is created for future use.

A workflow to check the format is available now.

This PR is a continuation of #1524 .

What's next:

  • Resolve dependency issues in a few headers. So that we can sort includes.

All source codes are now formatted.
`clang-format.sh` is now introduced and should be run for new commits.

The `.clang-format` file is updated. It is now corresponding to a style like the status quo.
The `.clang-format-ignore` file is created for future uses.
Copy link

codecov bot commented Aug 24, 2024

Codecov Report

Attention: Patch coverage is 77.70144% with 357 lines in your changes missing coverage. Please review.

Project coverage is 62.78%. Comparing base (e1ce6a0) to head (a4a54a0).

Files Patch % Lines
svf-llvm/lib/DCHG.cpp 0.00% 152 Missing ⚠️
svf-llvm/tools/AE/ae.cpp 44.06% 33 Missing ⚠️
svf-llvm/lib/LLVMModule.cpp 80.48% 24 Missing ⚠️
svf-llvm/lib/LLVMUtil.cpp 85.96% 16 Missing ⚠️
svf-llvm/lib/CHGBuilder.cpp 86.51% 12 Missing ⚠️
svf-llvm/lib/CppUtil.cpp 86.07% 11 Missing ⚠️
svf/include/Graphs/CDG.h 0.00% 10 Missing ⚠️
svf-llvm/lib/SVFIRBuilder.cpp 93.57% 9 Missing ⚠️
svf-llvm/lib/SVFIRExtAPI.cpp 81.25% 9 Missing ⚠️
svf/include/AE/Core/IntervalValue.h 81.25% 9 Missing ⚠️
... and 27 more
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1530      +/-   ##
==========================================
- Coverage   66.68%   62.78%   -3.90%     
==========================================
  Files         244      244              
  Lines       25930    24912    -1018     
  Branches     4557     4697     +140     
==========================================
- Hits        17292    15642    -1650     
- Misses       8638     9270     +632     
Files Coverage Δ
svf-llvm/include/SVF-LLVM/BreakConstantExpr.h 33.33% <ø> (ø)
svf-llvm/include/SVF-LLVM/CHGBuilder.h 100.00% <100.00%> (ø)
svf-llvm/include/SVF-LLVM/GEPTypeBridgeIterator.h 93.10% <100.00%> (-0.45%) ⬇️
svf-llvm/include/SVF-LLVM/ICFGBuilder.h 100.00% <100.00%> (ø)
svf-llvm/include/SVF-LLVM/LLVMLoopAnalysis.h 100.00% <ø> (ø)
svf-llvm/include/SVF-LLVM/LLVMModule.h 91.83% <100.00%> (+1.54%) ⬆️
svf-llvm/include/SVF-LLVM/ObjTypeInference.h 100.00% <ø> (ø)
svf-llvm/include/SVF-LLVM/SymbolTableBuilder.h 100.00% <100.00%> (ø)
svf-llvm/lib/ICFGBuilder.cpp 100.00% <100.00%> (ø)
svf-llvm/lib/LLVMLoopAnalysis.cpp 100.00% <100.00%> (ø)
... and 232 more

@@ -0,0 +1 @@
git ls-tree --full-tree --name-only -r HEAD | grep -e ".*\.\(c\|h\|hpp\|cc\|cpp\|hh\)\$" | grep -vf .clang-format-ignore | xargs clang-format -i -style=file --verbose
Copy link
Collaborator

Choose a reason for hiding this comment

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

Move this line to svf-lib.publish.yml and remove this file

@yuleisui
Copy link
Collaborator

Don not commit the formatted cpp/h files and they will be automatically done after CI.

@cubicYYY
Copy link
Contributor Author

Just wondering what is the point of formatting after CI instead of formatting the original codes.

@yuleisui
Copy link
Collaborator

Just wondering what is the point of formatting after CI instead of formatting the original codes.

It will be done automatically after CI. The programmer does not need to format their code beforehand.

@cubicYYY
Copy link
Contributor Author

Why bother formatting after the build and deployment? IMO formatting benefits developers, not users.

@yuleisui
Copy link
Collaborator

Why bother formatting after the build and deployment? IMO formatting benefits developers, not users.

Formatting is always done after you commit your code to the repo, later developers (including my team and others) will download the formatted code.

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