Issue |
131215
|
Summary |
[clang-tidy] Check request: don't use `reset` for an optional Resetable
|
Labels |
clang-tidy
|
Assignees |
|
Reporter |
denzor200
|
Need a check that does all the same as https://github.com/llvm/llvm-project/issues/120908, but for `std::optional`.
Keep in mind that it's impossible to assign `nullptr` to an `std::optional` instance, use `std::nullopt` for it.
BEFORE:
```
struct A {
void reset();
};
std::optional<A> a = A{};
a->reset(); // BAD
a.reset(); // BAD
```
AFTER:
```
struct A {
void reset();
};
std::optional<A> a = A{};
(*a).reset(); // OK
a = std::nullopt; // OK
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs