refactor: [tidy] modernize-type-traits #28664

pull fanquake wants to merge 2 commits into bitcoin:master from fanquake:modernize_type_traits changing 28 files +70 −59
  1. fanquake commented at 10:28 am on October 17, 2023: member

    We currently use a mix of both, consolidate to the (less verbose) later.

    0std::is_integral<T>::value -> std::is_integral_v<T>
    1std::is_same<A,B>::value -> std::is_same_v<A,B>
    2std::decay<T>::type -> std:decay_t<T>
    3std::common_type<D>::type -> std::common_type_t<D>
    4std::is_lvalue_reference<T>::value -> std::is_lvalue_reference_v<T>
    5std::remove_cv<T>::type -> std::remove_cv_t<T>
    6std::enable_if<A,B>::type -> std::enable_if_t<A,B>
    7std::is_convertible<A,B>::value -> std::is_convertible_v<A,B>
    8std::underlying_type<T>::type -> std::underlying_type_t<T>
    

    See https://clang.llvm.org/extra/clang-tidy/checks/modernize/type-traits.html.

  2. refactor: consolidate to C++14/17 type traits
    We currently use a mix of both, so consolidate to the later.
    
    std::is_integral<T>::value -> std::is_integral_v<T>
    std::is_same<A,B>::value -> std::is_same_v<A,B>
    std::decay<T>::type -> std:decay_t<T>
    std::common_type<D>::type -> std::common_type_t<D>
    std::is_lvalue_reference<T>::value -> std::is_lvalue_reference_v<T>
    std::remove_cv<T>::type -> std::remove_cv_t<T>
    std::enable_if<A,B>::type -> std::enable_if_t<A,B>
    std::is_convertible<A,B>::value -> std::is_convertible_v<A,B>
    std::underlying_type<T>::type -> std::underlying_type_t<T>
    6934312fa2
  3. clang-tidy: use modernize-type-traits
    https://clang.llvm.org/extra/clang-tidy/checks/modernize/type-traits.html
    
    Requires LLVM 17.x.
    55330d71dd
  4. DrahtBot commented at 10:28 am on October 17, 2023: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Code Coverage

    For detailed information about the code coverage, see the test coverage report.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    Concept ACK hebasto

    If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #28579 (refactor: Remove redundant checks in compat/assumptions.h by maflcko)
    • #25665 (refactor: Add util::Result failure values, multiple error and warning messages by ryanofsky)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  5. DrahtBot added the label Refactoring on Oct 17, 2023
  6. hebasto commented at 10:33 am on October 17, 2023: member
    Concept ACK.
  7. DrahtBot added the label CI failed on Oct 17, 2023
  8. fanquake commented at 1:02 pm on October 17, 2023: member
    Not sure why this is failing, with errors coming from i.e src/bench/nanobench.h. We added that to be filtered as part of #28583 (should be the case anyways as it’s upstream code). So tidy should be failing in master, if the filtering does not work?
  9. maflcko commented at 3:06 pm on October 25, 2023: member

    Not sure if we want to add tidy checks that only benefit the readability for developers, given that a tidy CI result may take anywhere from tens of minutes to hours to get. Thus, the author may be forced to check back after that time, only to force push for a tidy-up for an otherwise passing CI result?

    No opinion on this, but if those “style checks” are added, might as well add readability-redundant-smartptr-get in the same go.

  10. in src/.bear-tidy-config:14 in 55330d71dd
     9@@ -10,6 +10,8 @@
    10         "src/minisketch",
    11         "src/bench/nanobench.cpp",
    12         "src/bench/nanobench.h",
    13+        "src/test/fuzz/FuzzedDataProvider.h",
    14+        "src/minisketch/include/minisketch.h",
    


    maflcko commented at 5:03 pm on November 1, 2023:
    I don’t think it is possible to exclude headers via bear, as they are not listed as translation unit anyway
  11. fanquake commented at 11:04 am on November 2, 2023: member
    Might come back to this when bear/tidy are working.
  12. fanquake closed this on Nov 2, 2023

  13. fanquake deleted the branch on Apr 4, 2024

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-06-29 07:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me