<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div><br></div><div>On 5 apr. 2013, at 00:45, Argyrios Kyrtzidis <<a href="mailto:akyrtzi@gmail.com">akyrtzi@gmail.com</a>> wrote:<br><br></div><blockquote type="cite"><div><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1">On Apr 4, 2013, at 12:14 AM, Oliver Giles <<a href="mailto:ogtifs@gmail.com">ogtifs@gmail.com</a>> wrote:<br><div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="letter-spacing: 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;">I just tried this again with the latest clang from svn. The original snippet works but the next lines in my original code are:<br><br>CXCursor cursor = clang_getTranslationUnitCursor(tu);<br>CXSourceRange sr = clang_getCursorExtent(cursor);<br>CXToken* tokens;<br>unsigned numtokens;<br>clang_tokenize(tu, sr, &tokens, &numtokens);<br>CXCursor* cursors = new CXCursor[numtokens];<br>clang_annotateTokens(tu, tokens, numtokens, cursors);<br><br>Appending even the first line of this (clang_getTranslationUnitCursor) to the example I gave earlier causes a segfault in the clang 3.3 library.<br></div></blockquote><div><br></div><div>Fixed in r178800. FYI, it looks like the CXTranslationUnit object that you get is null, so there was a problem during parsing.</div></div></div></blockquote><div><br></div><div>I've also noticed this behaviour, where a null-TU gets returned when parsing failed. It's usually unrecoverable for clang, and the only way to debug it is to turn on the option to write messages to stdout/stderr. I never got around to ask it, but is there a way to get these error messages even when the TU is null? I mean, the only way for e.g. an IDE to handle  this is to silently ignore it, and that's not very helpful...</div><div><br></div><div>-- Erik. </div></body></html>