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] readability-use-std-min-max drops comments #121613

Open
LegalizeAdulthood opened this issue Jan 3, 2025 · 2 comments
Open

[clang-tidy] readability-use-std-min-max drops comments #121613

LegalizeAdulthood opened this issue Jan 3, 2025 · 2 comments
Labels
bug Indicates an unexpected problem or unintended behavior clang-tidy

Comments

@LegalizeAdulthood
Copy link
Contributor

Suppose you have the following code:

        if (box_depth > max_depth) // limit the depth to max
        {
            box_depth = max_depth;
        }

after applying readability-use-std-min-max, the code is:

        box_depth = std::min(box_depth, max_depth);

the explaining comment is dropped.

The expected code is:

        box_depth = std::min(box_depth, max_depth); // limit the depth to max
@LegalizeAdulthood LegalizeAdulthood added bug Indicates an unexpected problem or unintended behavior clang-tidy labels Jan 3, 2025
@llvmbot
Copy link
Member

llvmbot commented Jan 3, 2025

@llvm/issue-subscribers-bug

Author: Richard Thomson (LegalizeAdulthood)

Suppose you have the following code:
        if (box_depth > max_depth) // limit the depth to max
        {
            box_depth = max_depth;
        }

after applying readability-use-std-min-max, the code is:

        box_depth = std::min(box_depth, max_depth);

the explaining comment is dropped.

The expected code is:

        box_depth = std::min(box_depth, max_depth); // limit the depth to max

@llvmbot
Copy link
Member

llvmbot commented Jan 3, 2025

@llvm/issue-subscribers-clang-tidy

Author: Richard Thomson (LegalizeAdulthood)

Suppose you have the following code:
        if (box_depth > max_depth) // limit the depth to max
        {
            box_depth = max_depth;
        }

after applying readability-use-std-min-max, the code is:

        box_depth = std::min(box_depth, max_depth);

the explaining comment is dropped.

The expected code is:

        box_depth = std::min(box_depth, max_depth); // limit the depth to max

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior clang-tidy
Projects
None yet
Development

No branches or pull requests

2 participants