<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>I've used libclang to implement a code folding/collapsing plugin for my editor. It's working quite well in my test files, but I ran into a showstopper when I started using it on real files. If there are any unresolved symbols (and presumably other types of errors) chunks of the AST will be missing. For example, if I have a file with the following<br></div><div><br></div><div>void Foo()<br>{<br>    while (PeekMessageA())<br>    {<br>    }<br>}</div><div><br></div><div>all I'll get out of the AST is a FunctionDecl for Foo and a CompoundStmt. Nothing for the while loop or function call even with CXTranslationUnit_SingleFileParse and CXTranslationUnit_KeepGoing specified for parsing.</div><div><br></div><div>This behavior seems to make it impossible to use libclang for code folding information and other single-file or while-editing tools. It seems unreasonable to have to parse an entire translation unit for syntax based folding information in a single file. And I don't want to lose folding simply because I've got an unresolved symbol in syntactically correct code while I'm in the process of editing it.<br></div><div><br></div><div>Is there any other way to accomplish this with libclang? I understand that without being able to resolve the symbol it leaves things ambiguous and PeekMessageA would likely be an UnexposedDecl. That's fine in this case as long as the location range is correct.</div><div><br></div><div>Cheers,</div><div>Adam<br></div></div></div></div></div>