Yes, pure is strictly better, attached :-) Howard: I agree that it would be better if the frontend could figure out automatically when a function is pure. However, that bug hasn't seen any action in a over 10 months, so I figured this low-tech patch could catch a few bugs until the better solution is implemented. I only sent it out because I saw that bug twice recently and this patch was easy to write. If you don't want to merge this, that's fine with me. (We don't use libc++ yet anyway.)
Nico On Wed, Apr 11, 2012 at 11:57 AM, Chris Lattner <[email protected]> wrote: > > On Apr 10, 2012, at 8:49 PM, Nico Weber wrote: > >> Hi, >> >> the attached patch marks vector:: and string::empty() as >> warn_unused_result. It looks like it's fairly often confused with >> clear() in practice: >> >> https://breakpad.appspot.com/377003/ >> http://codereview.chromium.org/10034006/ >> http://www.viva64.com/en/a/0079/ (search for "empty") >> >> See also http://llvm.org/bugs/show_bug.cgi?id=10011 for a more general >> approach. > > Besides, wouldn't it be better to mark it as "pure"? > > -Chris
libcxx-pure.patch
Description: Binary data
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
