[all-commits] [llvm/llvm-project] e9df6f: [clang-tidy] Invalid Fix-It generated for implicit...
Félix-Antoine Constantin via All-commits
all-commits at lists.llvm.org
Sat Jan 13 10:07:23 PST 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: e9df6fec59b3ea9bc7f66236bc94517bcb00f15a
https://github.com/llvm/llvm-project/commit/e9df6fec59b3ea9bc7f66236bc94517bcb00f15a
Author: Félix-Antoine Constantin <60141446+felix642 at users.noreply.github.com>
Date: 2024-01-13 (Sat, 13 Jan 2024)
Changed paths:
M clang-tools-extra/clang-tidy/bugprone/ImplicitWideningOfMultiplicationResultCheck.cpp
M clang-tools-extra/docs/ReleaseNotes.rst
M clang-tools-extra/test/clang-tidy/checkers/bugprone/implicit-widening-of-multiplication-result-array-subscript-expression.cpp
M clang-tools-extra/test/clang-tidy/checkers/bugprone/implicit-widening-of-multiplication-result-int.cpp
M clang-tools-extra/test/clang-tidy/checkers/bugprone/implicit-widening-of-multiplication-result-pointer-offset.cpp
Log Message:
-----------
[clang-tidy] Invalid Fix-It generated for implicit-widening-multiplication-result (#76315)
The check currently emits warnings for the following code:
`uint64_t fn() { return 1024 * 1024; }`
But the code generated after applying the notes will look like this:
`uint64_t fn() { return static_cast<uint64_t>(1024 * )1024; }`
This is because when generating the notes the check will use the
beginLoc() and EndLoc() of the subexpr of the implicit cast.
But in some cases the AST Node might not have a beginLoc and EndLoc.
This seems to be true when the Node is composed of only 1 token (for
example an integer literal). Calling the getEndLoc() on this type of
node will simply return the known location which is, in this case, the
beginLoc.
Fixes #63070 #56728
More information about the All-commits
mailing list