<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">On Feb 12, 2014, at 6:36 AM, Dmitri Gribenko <<a href="mailto:gribozavr@gmail.com">gribozavr@gmail.com</a>> wrote:<br><div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">On Wed, Feb 12, 2014 at 11:04 AM, Dmitri Gribenko <<a href="mailto:gribozavr@gmail.com">gribozavr@gmail.com</a>> wrote:<br><blockquote type="cite">On Wed, Feb 12, 2014 at 2:05 AM, Argyrios Kyrtzidis <<a href="mailto:kyrtzidis@apple.com">kyrtzidis@apple.com</a>> wrote:<br><blockquote type="cite">This seems more complicated than it’s worth, particularly since we do add a new API that the caller must be aware of, anyway.<br><br>How about for the functions that don’t support detailed error codes we just introduce a new variant that does support error codes ?<br>Clients interested in the error codes can move to calling the new function (whether we should deprecate the existing one or not is a different question).<br></blockquote><br>This does seem cleaner.  With this approach, we will have to introduce<br>three new APIs, mirroring the following:<br><br>clang_createTranslationUnitFromSourceFile<br>clang_createTranslationUnit<br>clang_parseTranslationUnit<br></blockquote></div></blockquote><div><br></div><div>clang_createTranslationUnitFromSourceFile is just "clang_parseTranslationUnit minus options", we don't need a variant for that.</div><br><blockquote type="cite"><div style="font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><blockquote type="cite"><br>While these APIs already return error codes:<br><br>clang_reparseTranslationUnit<br>clang_indexSourceFile<br></blockquote></div></blockquote><div><br></div><div>Are you considering clang_indexTranslationUnit ?</div><br><blockquote type="cite"><div style="font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br>I have implemented this approach in the attached patch.</div></blockquote><div><br></div><div>Did you forget to attach it ?</div><br><blockquote type="cite"><div style="font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">  The new APIs<br>are just suffixed with "2", for example,<br>clang_createTranslationUnit2(), because of a lack of imagination and<br>to clearly show that the two parallel APIs are essentially the same.<br></div></blockquote><div><br></div><div>Um, "clang_createTranslationUnit_Ext" ? I don't have a strong preference, it's your call.</div><br><blockquote type="cite"><div style="font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br>I did not deprecate the old APIs, we can just treat them as<br>"convenience" wrappers.<br><br>I was thinking about changing the return type of<br>clang_reparseTranslationUnit and clang_indexSourceFile to 'enum<br>CXErrorCode', but I am not 100% that it is an ABI-compatible change on<br>all platforms (it is compatible on x86-64, I think), so I did not go<br>this way.<br></div></blockquote><div><br></div><div>That's fine.</div><br><blockquote type="cite"><div style="font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br>Please review.<br></div></blockquote><div><br></div><div>I need a patch! :-)</div><br><blockquote type="cite"><div style="font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br>Dmitri<br><br>--<span class="Apple-converted-space"> </span><br>main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if<br>(j){printf("%d\n",i);}}} /*Dmitri Gribenko <<a href="mailto:gribozavr@gmail.com">gribozavr@gmail.com</a>>*/</div></blockquote></div><br></body></html>