<div dir="ltr">Ahh, so I misinterpreted what you originally said.  There is one Clang AST <b>per SymboFile</b>.  In PDB land, compile units are often called "modules" so it's easy to get confused.  So in my original response, what I actually meant was that there's no notion of a per compile-unit AST.  But that also had nothing to do with your question, which was about LLDB modules :)<div><br></div><div>So anyway, yea the command already supports that as you noted, and specifying the module basename would also have worked here so that there would always only be 1 module dumped (turns out, there's only 1 module dumped anyway because we don't have PDBs for any of the system libraries, so DumpClangAST is a no-op in those cases).</div></div><br><div class="gmail_quote"><div dir="ltr">On Fri, Dec 14, 2018 at 11:00 AM Pavel Labath <<a href="mailto:pavel@labath.sk">pavel@labath.sk</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 14/12/2018 19:52, Zachary Turner wrote:<br>
> I don't know if there's a good way to do that.  Because debuggers need <br>
> to be able to see across multiple translation units, this is implemented <br>
> internally as constructing one giant AST that contains everything for <br>
> the entire program.  LLDB has no notion of a per-module AST, so it would <br>
> be hard to make this work.<br>
> <br>
<br>
That's not how it's implemented now. The code actually iterates through <br>
all the modules and dumps each one in turn.<br>
<br>
       result.GetOutputStream().Printf("Dumping clang ast for %" PRIu64<br>
                                       " modules.\n",<br>
                                       (uint64_t)num_modules);<br>
       for (size_t image_idx = 0; image_idx < num_modules; ++image_idx) {<br>
         if (m_interpreter.WasInterrupted())<br>
           break;<br>
         Module *m = target->GetImages().GetModulePointerAtIndex(image_idx);<br>
         SymbolFile *sf = m->GetSymbolVendor()->GetSymbolFile();<br>
         sf->DumpClangAST(result.GetOutputStream());<br>
       }<br>
<br>
<br>
In fact, it looks like this command already supports specifying the <br>
exact module to dump (either by basename or full path).<br>
</blockquote></div>