include/llvm/Support/raw_ostream.h, line 568: StringRef str() { return StringRef(OS.data(), OS.size()); } Why str method is without "const" attribute? Any reasonable reason? Thanks! -Stepan
George Burgess IV via llvm-dev
2020-Jan-26 05:53 UTC
[llvm-dev] Minor bug in raw_svector_ostream
> Why str method is without "const" attribute? Any reasonable reason?Probably an accident; `const` is generally best-effort until someone needs a thing to be `const` :) Added in https://github.com/llvm/llvm-project/commit/2f45a93edfe4bc62c7b2c6f8ffb0d06d83bb28cf . Thanks! George On Sat, Jan 25, 2020 at 2:30 AM via llvm-dev <llvm-dev at lists.llvm.org> wrote:> include/llvm/Support/raw_ostream.h, line 568: > > StringRef str() { return StringRef(OS.data(), OS.size()); } > > Why str method is without "const" attribute? Any reasonable reason? > > Thanks! > -Stepan > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200125/fcda9776/attachment.html>
<div>Great! Thank you!</div><div>-Stepan</div><div> </div><div>26.01.2020, 09:54, "George Burgess IV" <george.burgess.iv@gmail.com>:</div><blockquote><div>> Why str method is without "const" attribute? Any reasonable reason?<div> </div><div>Probably an accident; `const` is generally best-effort until someone needs a thing to be `const` :)</div><div> </div><div>Added in <a href="https://github.com/llvm/llvm-project/commit/2f45a93edfe4bc62c7b2c6f8ffb0d06d83bb28cf">https://github.com/llvm/llvm-project/commit/2f45a93edfe4bc62c7b2c6f8ffb0d06d83bb28cf</a> . Thanks!</div><div> </div><div>George</div></div> <div><div>On Sat, Jan 25, 2020 at 2:30 AM via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:</div><blockquote style="border-left-color:rgb( 204 , 204 , 204 );border-left-style:solid;border-left-width:1px;margin:0px 0px 0px 0.8ex;padding-left:1ex">include/llvm/Support/raw_ostream.h, line 568:<br /><br /> StringRef str() { return StringRef(OS.data(), OS.size()); }<br /><br />Why str method is without "const" attribute? Any reasonable reason?<br /><br />Thanks!<br />-Stepan<br />_______________________________________________<br />LLVM Developers mailing list<br /><a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br /><a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a></blockquote></div></blockquote>