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-tidy: Add .clang-tidy config file and use it to refine code base #31

Merged
merged 6 commits into from
Apr 18, 2023

Conversation

honggyukim
Copy link
Owner

@honggyukim honggyukim commented Apr 15, 2023

clang-tidy is very useful when it comes to refine C++ project and this PR adds its configuration file and adopt its suggestions.

The clang-tidy can be executed by the following commands.

  $ cmake -B out
  $ run-clang-tidy -fix -header-filter=.* -format -style file -p out

The current change was made based on clang-tidy-14.

The full list of checkers can be found at https://clang.llvm.org/extra/clang-tidy/checks/list.html.

The .clang-tidy file was generated by the following command.

  $ clang-tidy-14 -dump-config > .clang-tidy

The clang-tidy can be executed by the following commands.

  $ cmake -B out
  $ run-clang-tidy -fix -header-filter=.* -format -style file -p out

Signed-off-by: Honggyu Kim <honggyu.kp@gmail.com>
@honggyukim
Copy link
Owner Author

@Bojun-Seo Please have a look at this changes.

This patch fixes the following clang-tidy warnings.

  src/heaptrace.cc:117:8: warning: Value stored to 'old_libpath' during
    its initialization is never read
  src/libheaptrace.cc:71:8: warning: Value stored to 'tfs' during its
    initialization is never read
  src/libheaptrace.cc:171:24: warning: function previously declared with
    an explicit exception specification red eclared with an implicit
    exception specification
  src/libheaptrace.cc:189:24: warning: function previously declared with
    an explicit exception specification red eclared with an implicit
    exception specification
  src/stacktrace.cc:310:10: warning: Value stored to 'count' during its
    initialization is never read
  src/utils.cc:24:2: warning: Value stored to 'ret' is never read

Signed-off-by: Honggyu Kim <honggyu.kp@gmail.com>
This patch adds bugprone and modernize clang-tidy checkers excluding
some unnecessary checkers.

It also applies automatic fixes by the checkers.

Signed-off-by: Honggyu Kim <honggyu.kp@gmail.com>
This patch resolves some clang-tidy warnings by applying manual fixes.

Signed-off-by: Honggyu Kim <honggyu.kp@gmail.com>
Signed-off-by: Honggyu Kim <honggyu.kp@gmail.com>
Signed-off-by: Honggyu Kim <honggyu.kp@gmail.com>
@Bojun-Seo
Copy link
Collaborator

@honggyukim It looks great.

@honggyukim honggyukim merged commit f17e22b into main Apr 18, 2023
@honggyukim honggyukim deleted the review/use-clang-tidy branch April 18, 2023 12:12
@honggyukim
Copy link
Owner Author

@Bojun-Seo Thanks.

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