r203091 - [-Wunreachable-code] don't warn about dead 'return <string literal>' dominated by a 'noreturn' call, where literal becomes an std::string.

Ted Kremenek kremenek at apple.com
Wed Mar 5 23:03:36 PST 2014


On Mar 5, 2014, at 10:50 PM, Ted Kremenek <kremenek at apple.com> wrote:

> Author: kremenek
> Date: Thu Mar  6 00:50:46 2014
> New Revision: 203091
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=203091&view=rev
> Log:
> [-Wunreachable-code] don't warn about dead 'return <string literal>' dominated by a 'noreturn' call, where literal becomes an std::string.
> 
> I have mixed feelings about this one.  It's used all over the codebase,
> and is analogous to the current heuristic for ordinary C string literals.

Meant to say “all over the LLVM codebase”.

> 
> This requires some ad hoc pattern matching of the AST.  While the
> test case mirrors what we see std::string in libc++, it's not really
> testing the libc++ headers.
> 

This is also technically domain-specific knowledge, but std::string is part of C++ itself.  We obviously can’t generalize this for all cases like this.



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140305/e08e2ca3/attachment.html>


More information about the cfe-commits mailing list