NoQ marked an inline comment as done.
NoQ added a comment.
In D66847#1648209 <https://reviews.llvm.org/D66847#1648209>, @Szelethus wrote:
> > if the dyn_ part is really necessary here, then you crash with a null
> > dereference a few lines below because you didn't check the result
>
> Hmm, can we detect things like this?:
>
> if (isa<FunctionDecl>(D)) {
> const auto *FD = dyn_cast(D); // warn: D is known to be a FunctionDecl,
> prefer using cast<>
> // ...
> }
>
We should be detecting things like this as of D66325
<https://reviews.llvm.org/D66325> and D66423 <https://reviews.llvm.org/D66423>
(we remember which casts were successful and don't re-assume them again), but
`LocalizationChecker.cpp` turned out to have a false positive of this kind.
@Charusso, you may want to take a look.
================
Comment at: clang/lib/StaticAnalyzer/Checkers/LocalizationChecker.cpp:885-888
- const Decl *D = Call.getDecl();
- if (D && isa<FunctionDecl>(D)) {
- const FunctionDecl *FD = dyn_cast<FunctionDecl>(D);
- auto formals = FD->parameters();
----------------
Note: this was a false positive.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D66847/new/
https://reviews.llvm.org/D66847
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits