leonardchan added a comment. In D64256#1626025 <https://reviews.llvm.org/D64256#1626025>, @xazax.hun wrote:
> In D64256#1625998 <https://reviews.llvm.org/D64256#1625998>, @leonardchan > wrote: > > > Hi. I noticed in our builders that both of the warnings introduced in this > > patch are being diagnosed for pointers that don't use GSL at all. I'm > > attempting to make a small reproducer now. > > > Hi! > > Clang now apply GSL annotations for some STL types automatically. So this is > the expected behavior. Are any of those warnings unwanted/false positive with > the newest Clang version? If so, please share the reproducers and I will > either fix them ASAP or revert/turn off the warnings. Thanks! I didn't know that they were applied to stl types. This could explain why the warning is raised in my case (std::string), but I don't think there's anything wrong in this example that would lead to a warning: leonardchan@cp-snakewater:~/llvm-monorepo/llvm-build-3-master$ cat ~/misc/test.cpp #include <string> std::string MakeStr(); void other_func(const char *s); void func(std::string s) { const char *x = MakeStr().c_str(); other_func(x); } leonardchan@cp-snakewater:~/llvm-monorepo/llvm-build-3-master$ ~/llvm-monorepo/llvm-build-3-master/bin/clang++ -c ~/misc/test.cpp /usr/local/google/home/leonardchan/misc/test.cpp:7:19: warning: object backing the pointer will be destroyed at the end of the full-expression [-Wdangling] const char *x = MakeStr().c_str(); ^~~~~~~~~ 1 warning generated. This was made using a release build from ToT clang. Repository: rL LLVM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D64256/new/ https://reviews.llvm.org/D64256 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits