[all-commits] [llvm/llvm-project] 98146c: [clang-tidy] fix modernize-use-nullptr false posit...
Conrad Poelman via All-commits
all-commits at lists.llvm.org
Tue Feb 9 06:03:26 PST 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 98146c1f5d0c772aec56149724119d49990f4d0c
https://github.com/llvm/llvm-project/commit/98146c1f5d0c772aec56149724119d49990f4d0c
Author: poelmanc <cpllvm at stellarscience.com>
Date: 2021-02-09 (Tue, 09 Feb 2021)
Changed paths:
M clang-tools-extra/clang-tidy/modernize/UseNullptrCheck.cpp
A clang-tools-extra/test/clang-tidy/checkers/modernize-use-nullptr-cxx20.cpp
Log Message:
-----------
[clang-tidy] fix modernize-use-nullptr false positive with spaceship operator comparisons
`clang-tidy -std=c++20` with `modernize-use-nullptr` mistakenly inserts `nullptr` in place of the comparison operator if the comparison internally expands in the AST to a rewritten spaceship operator. This can be reproduced by running the new `modernize-use-nullptr-cxx20.cpp` test without applying the supplied patch to `UseNullptrCheck.cpp`; the current clang-tidy will mistakenly replace:
```result = (a1 < a2);```
with
```result = (a1 nullptr a2);```
Reviewed By: njames93
Differential Revision: https://reviews.llvm.org/D95714
More information about the All-commits
mailing list