<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Apr 23, 2014 at 10:39 PM, Chandler Carruth <span dir="ltr"><<a href="mailto:chandlerc@google.com" target="_blank">chandlerc@google.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class=""><br>
<div class="gmail_quote">On Wed, Apr 23, 2014 at 10:16 PM, Nico Weber <span dir="ltr"><<a href="mailto:nicolasweber@gmx.de" target="_blank">nicolasweber@gmx.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="overflow:hidden">+        if (DidSetDeprecatedMessage)<br>

+          clang_disposeString(*deprecated_message);<br>
         *deprecated_message = cxstring::createDup(Deprecated->getMessage());<br>
+        DidSetDeprecatedMessage = true;</div></blockquote></div><br></div>Can we really not tell that the message doesn't hold a string to dispose of? Maybe even better, have clang_disposeString just no-op in that case (the way free, delete, etc do)?</div>
</div></blockquote><div><br></div><div>*deprecated_message is user-controlled, and there's no public api to construct an empty CXString as far as I know.</div><div><br>A different approach would be to</div><div><br></div>
<div><div>  if (deprecated_message)</div><div>    *deprecated_message = cxstring::createNull();</div></div><div><br></div><div>at the beginning of the function, then it's possible to unconditionally call clang_disposeString() – but it'd be a behavior change, since the function would then set *deprecated_message to an empty string (instead of not modifying it). I don't know how strict libclang is about behavior changes.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">
</div>
<br>_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
<br></blockquote></div><br></div></div>