Fix two bugs in readability-use-std-min-max when the if body has no braces. For brace-less if bodies, If->getEndLoc() points to the expression end rather than the trailing semicolon, truncating replacements and losing comments. We find the semicolon via findNextToken and extend the range consistent with compound statement logic. Before: if (n < -1) n = -1 ; -> n = std::max(n, -1); ; if (n > 1) n = 1/*comment*/; -> n = std::min(n, 1);; After: if (n < -1) n = -1 ; -> n = std::max(n, -1); if (n > 1) n = 1/*comment*/; -> n = std::min(n, 1); /*comment*/ Fixes #208708. AI Usage: This patch is AI-assisted, reviewed and verified by me. |
||
|---|---|---|
| .. | ||
| _static | ||
| _templates | ||
| clang-tidy | ||
| clangd | ||
| clang-change-namespace.rst | ||
| clang-doc.rst | ||
| clang-include-fixer.rst | ||
| clang-modernize.rst | ||
| clang-reorder-fields.rst | ||
| clang-tidy.rst | ||
| clangd.rst | ||
| CMakeLists.txt | ||
| conf.py | ||
| cpp11-migrate.rst | ||
| doxygen-mainpage.dox | ||
| doxygen.cfg.in | ||
| index.rst | ||
| Maintainers.md | ||
| make.bat | ||
| modularize.rst | ||
| ModularizeUsage.rst | ||
| pp-trace.rst | ||
| README.txt | ||
| ReleaseNotes.rst | ||
| ReleaseNotesTemplate.txt | ||
---------------------------------- Documentation in clang-tools-extra ---------------------------------- To generate documentation in HTML format from files in clang-tools-extra/docs, build the docs-clang-tools-html target. To generate documentation from the source code using Doxygen, build the doxygen-clang-tools target.