diff options
author | Thomas Köppe <tkoeppe@google.com> | 2024-09-25 17:25:46 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-25 09:25:46 -0700 |
commit | cebb7c010854e39a77065cfd681db91a79e7ce15 (patch) | |
tree | cf0642aa99efd1a5cb9db2ddd00f884920b06a53 /clang/lib/Lex/ModuleMap.cpp | |
parent | d01e336336f2b7fb4137e3dcc7d5c0b06ca1f3d6 (diff) | |
download | llvm-cebb7c010854e39a77065cfd681db91a79e7ce15.zip llvm-cebb7c010854e39a77065cfd681db91a79e7ce15.tar.gz llvm-cebb7c010854e39a77065cfd681db91a79e7ce15.tar.bz2 |
[clang-tidy] modernize-use-nullptr matches "NULL" in templates (#109169)
Make modernize-use-nullptr matcher also match "NULL", but not "0", when
it appears on a substituted type of a template specialization.
Previously, any matches on a substituted type were excluded, but this
meant that a situation like the following is not diagnosed:
```c++
template <typename T>
struct X {
T val;
X() { val = NULL; } // should diagnose
};
```
When the user says `NULL`, we expect that the destination type is always
meant to be a pointer type, so this should be converted to `nullptr`. By
contrast, we do not propose changing a literal `0` in that case, which
appears as initializers of both pointer and integer specializations in
reasonable real code. (If `NULL` is used erroneously in such a
situation, it should be changed to `0` or `{}`.)
Diffstat (limited to 'clang/lib/Lex/ModuleMap.cpp')
0 files changed, 0 insertions, 0 deletions