[PATCH] D105421: [analyzer] Handle << operator for std::unique_ptr
Artem Dergachev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 9 10:30:33 PDT 2021
NoQ accepted this revision.
NoQ added a comment.
This revision is now accepted and ready to land.
Great, thanks!
================
Comment at: clang/test/Analysis/smart-ptr.cpp:472-474
+ // We are testing the fact that in our modelling of
+ // operator<<(basic_ostream<T1> &, const unique_ptr<T2> &)
+ // we set the return SVal to the SVal of the ostream arg.
----------------
Another thing to test could be that global variables are not invalidated. Eg.:
```lang=c++
int glob;
void foo(std::unique_ptr<int> P) {
int x = glob;
std::cout << P;
int y = glob;
clang_analyzer_eval(x == y); // expected-warning{{TRUE}}
}
================
Comment at: clang/test/Analysis/smart-ptr.cpp:476
+ clang_analyzer_eval(&Cout == &PtrCout); // expected-warning {{TRUE}}
+ clang_analyzer_eval(&Cout == &StringCout); // expected-warning {{UNKNOWN}}
+}
----------------
This deserves a `FIXME:` because the expected result is still `TRUE`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D105421/new/
https://reviews.llvm.org/D105421
More information about the cfe-commits
mailing list