mirror-llvm-project/clang-tools-extra/docs
hehuan 60f965b1f6
[clang-tidy] Fix trailing semicolon and lost comment in readability-use-std-min-max (#208782)
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.
2026-08-01 19:09:50 +08:00
..
_static
_templates
clang-tidy [clang-tidy][docs] Fix broken redundant-void-arg documentation. NFC. (#212692) 2026-07-29 15:54:54 +08:00
clangd [clangd][NFC] fix broken documentation link (#147088) 2025-07-07 05:08:49 -04:00
clang-change-namespace.rst [doc] Add documentation for clang-change-namespace (#148277) 2025-08-18 21:46:34 +02:00
clang-doc.rst
clang-include-fixer.rst
clang-modernize.rst
clang-reorder-fields.rst [clang-tools-extra][docs] Add documentation for clang-reorder-fields (#178446) 2026-01-29 15:28:58 +01:00
clang-tidy.rst
clangd.rst
CMakeLists.txt [docs] try again to handle doxygen everywhere (#203081) 2026-06-11 08:58:36 -04:00
conf.py [docs] Create utils/docs (#203962) 2026-06-24 15:12:48 -04:00
cpp11-migrate.rst
doxygen-mainpage.dox
doxygen.cfg.in [docs] update CI to use latest release of doxygen (#202420) 2026-06-10 10:25:33 -04:00
index.rst [clang-tools-extra][docs] Add documentation for clang-reorder-fields (#178446) 2026-01-29 15:28:58 +01:00
Maintainers.md [clang-tools-extra][docs] Convert maintainers file to Markdown (#200365) 2026-06-01 11:13:00 +01:00
make.bat
modularize.rst
ModularizeUsage.rst
pp-trace.rst
README.txt
ReleaseNotes.rst [clang-tidy] Fix trailing semicolon and lost comment in readability-use-std-min-max (#208782) 2026-08-01 19:09:50 +08:00
ReleaseNotesTemplate.txt [clang-tools-extra][docs] Add "Potentially Breaking Changes" section to ReleaseNotes (#158434) 2025-09-14 11:45:55 +03:00

----------------------------------
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.