<div dir="ltr">Hello!<div>Let me explain my problem:</div><div><br></div><div>I have a translation unit which I want to parse but I don't want clang to build AST because</div><div>I will make it externally (in code editor); </div><div>At the moment the process looks like calling <a class="gmail-code" href="https://clang.llvm.org/doxygen/namespaceclang.html#a27f04f4d92161ea521f726019b93073e" style="font-size:13px;color:rgb(70,101,162);text-decoration-line:none;font-family:monospace,fixed;white-space:pre-wrap;background-color:rgb(251,252,253)">clang::ParseAST</a>, waiting for <span style="font-size:13px;color:rgb(0,0,0);font-family:monospace,fixed;white-space:pre-wrap;background-color:rgb(251,252,253)">ASTConsumer::</span><a class="gmail-code" href="https://clang.llvm.org/doxygen/classclang_1_1ASTConsumer.html#a2bea2db1d0e8af16c60ee7847f0d46ff" style="font-size:13px;color:rgb(70,101,162);font-family:monospace,fixed;white-space:pre-wrap;background-color:rgb(251,252,253)">HandleTranslationUnit</a><span style="font-size:13px;color:rgb(0,0,0);font-family:monospace,fixed;white-space:pre-wrap;background-color:rgb(251,252,253)">() and traversing through the clang's AST with sending each token to the editor that will rebuild its own AST.</span></div><div><span style="font-size:13px;color:rgb(0,0,0);font-family:monospace,fixed;white-space:pre-wrap;background-color:rgb(251,252,253)"><br></span></div><div>First things first, I tried to write my own <a class="gmail-code" href="https://clang.llvm.org/doxygen/namespaceclang.html#a27f04f4d92161ea521f726019b93073e" style="font-size:13px;color:rgb(70,101,162);text-decoration-line:none;font-family:monospace,fixed;white-space:pre-wrap;background-color:rgb(251,252,253)">ParseAST</a> but I found out that (seemingly) any interaction with Parser or Sema lead to saving parsing results into the ASTContext;</div><div><br></div><div>At the moment I'm thinking on calling <span style="color:rgb(106,106,106);font-weight:bold">Parser::ParseTopLevelDecl() </span>and translating it's output like I did before for the whole translating unit; Then call and translate it again and so forth until the EOF.<br></div><div><br></div><div>Is it okay to delete DeclGroups that were already parsed from the AST Context?</div><div>Are there any other options?</div><div><br></div><div>Regards,</div><div>Fedor. </div></div>