Issue |
134559
|
Summary |
[clang-tidy] "modernize-use-auto" - shared pointer specific casts not supported
|
Labels |
clang-tidy
|
Assignees |
|
Reporter |
denzor200
|
As the doc says, the check handles `static_cast,` `dynamic_cast,` `const_cast,` `reinterpret_cast,` functional casts, C-style casts and function templates that behave as casts, such as `llvm::dyn_cast,` `boost::lexical_cast` and `gsl::narrow_cast.` Calls to function templates are considered to behave as casts if the first template argument is explicit and is a type, and the function returns that type, or a pointer or reference to it.
Nothing written about `std::static_pointer_cast`, `std::dynamic_pointer_cast`, `std::const_pointer_cast`, `std::reinterpret_pointer_cast`, so I suggest to add support of all of them and their boost analogues.
Below is the sample how do I see such transformation.
BEFORE:
```
std::shared_ptr<const Derived> d = std::dynamic_pointer_cast<const Derived>(get_base());
std::shared_ptr<Derived> dm = std::const_pointer_cast<Derived>(d);
```
AFTER:
```
auto d = std::dynamic_pointer_cast<const Derived>(get_base());
auto dm = std::const_pointer_cast<Derived>(d);
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs