etienneb added a comment.

In http://reviews.llvm.org/D18475#383520, @Eugene.Zelenko wrote:

> Thank you for enhancement!
>
> I think will be good idea to extend check for any function call that receives 
> .c_str(), since it mat be in other classes could have methods which receives 
> both C++ or C strings. See also PR24870.


I was thinking the same when I started that patch. But, there is multiple cases 
where it will bring a false-positive.
As an example:

  string& insert (size_t pos, const string& str, size_t subpos, size_t sublen = 
npos);
  string& insert (size_t pos, const char* s, size_t n);

Even if the overloaded name/types are compatible, the semantic is not the same. 
You can't simply remove the .c_str() here.

I agree that a more general cases could exists, but I would like to be able to 
turn it off over a large code base when trying to keep false positives as low 
as posible.


http://reviews.llvm.org/D18475



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to