[all-commits] [llvm/llvm-project] 2ce765: [clang-tidy] Don't split \r\n in modernize-use-std...
Mike Crowe via All-commits
all-commits at lists.llvm.org
Tue Jul 11 12:23:10 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 2ce765eb2f4feb7555d1416842c542743990b004
https://github.com/llvm/llvm-project/commit/2ce765eb2f4feb7555d1416842c542743990b004
Author: Mike Crowe <mac at mcrowe.com>
Date: 2023-07-11 (Tue, 11 Jul 2023)
Changed paths:
M clang-tools-extra/clang-tidy/utils/FormatStringConverter.cpp
M clang-tools-extra/docs/clang-tidy/checks/modernize/use-std-print.rst
M clang-tools-extra/test/clang-tidy/checkers/modernize/use-std-print.cpp
Log Message:
-----------
[clang-tidy] Don't split \r\n in modernize-use-std-print check
When given:
printf("Hello\r\n");
it's clearer to leave the CRLF intact and convert this to:
std::print("Hello\r\n");
than to remove the trailing newline and convert it to:
std::println("Hello\r");
Update the documentation to match, and clarify the situations for using
println vs print which weren't previously explained.
Reviewed By: PiotrZSL
Differential Revision: https://reviews.llvm.org/D154788
Commit: b389a62518ad54ae5a183efa43f8408571b2b8cb
https://github.com/llvm/llvm-project/commit/b389a62518ad54ae5a183efa43f8408571b2b8cb
Author: Mike Crowe <mac at mcrowe.com>
Date: 2023-07-11 (Tue, 11 Jul 2023)
Changed paths:
M clang-tools-extra/clang-tidy/utils/Matchers.h
M clang-tools-extra/test/clang-tidy/checkers/modernize/use-std-print-custom.cpp
Log Message:
-----------
[clang-tidy] Make MatchesAnyListedNameMatcher cope with unnamed Decl
If MatchesAnyListedNameMatcher::NameMatcher::match() is called in
MatchMode::MatchUnqualified mode with a NamedDecl that has no name then
calling NamedDecl::getName() will assert with:
`Name.isIdentifier() && "Name is not a simple identifier"'
It seems unfair to force all matchers using
matchers::matchesAnyListedName to defend against this, particularly
since test cases are unlikely to provoke the problem. Let's just check
whether the identifier has a name before attempting to use it instead.
Add test case that reproduces the problem to the
use-std-print-custom.cpp lit check.
Reviewed By: PiotrZSL
Differential Revision: https://reviews.llvm.org/D154884
Compare: https://github.com/llvm/llvm-project/compare/d7e79bd7d4fe...b389a62518ad
More information about the All-commits
mailing list