<div dir="ltr">How do you handle name lookup for nested classes? They have the same problem (they don't appear in all definitions) - don't appear in all descriptions of the outer/parent class. (in theory we could ensure there's always at least a declaration of the nested class - but we don't even do that if the nested class is unused)<br><br>Is it just the case that Clang doesn't mind you adding a new nested class but it does mind you adding a new member function template? If so, maybe we could change Clang to support adding new member function templates instead of extending DWARF?<br></div><br><div class="gmail_quote"><div dir="ltr">On Fri, Jun 15, 2018 at 11:59 AM <<a href="mailto:paul.robinson@sony.com">paul.robinson@sony.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">gc> Solution #1 would cause us to dig through all definitions of all C++<br>
gc> classes all the time when parsing DWARF to check if definitions of<br>
gc> the classes had template methods. And we would need to find the class<br>
gc> that has the most template methods. This would cause us to parse much<br>
gc> more of the debug info all of the time and cause increased memory<br>
gc> consumption and performance regressions.<br>
<br>
pr> It would be cheap to put a flag on the class DIE that tells you there<br>
pr> are template methods to go look for. Then you incur the cost only<br>
pr> when necessary. And the accelerator table makes it fast to find the<br>
pr> other class descriptions.<br>
<br>
gc> That is a fine solution. But we still run into the problem where we don't<br>
gc> know if the DWARF knows about that flag. If we do a flag, it would be nice<br>
gc> if it were mandatory on all classes to indicate support for the flag. But<br>
gc> this would be a fine solution and not hard to implement.<br>
<br>
pr> So what you really want is not a flag, but a count, so you can tell when<br>
pr> you've found all the different templates. If the count is zero, there's<br>
pr> nothing to look for. If the count is two, you look around at all the<br>
pr> various definitions of the class until you find two different templates,<br>
pr> then you stop. If there's no count attribute, your producer doesn't <br>
pr> know you want this information and you do it the hard way. Or, we've<br>
pr> invented a way to describe the templates directly in the class.<br>
pr><br>
pr> How's that?<br>
<br>
gc> that would work fine.<br>
<br>
I filed PR37816 to track this idea.<br>
<br>
The other ideas:<br>
<br>
- accelerator to point to the actual instantiations<br>
- emitting template definitions not just instantiations<br>
<br>
would be trickier to define and harder to implement correctly.<br>
I won't say they can't be done, but somebody else would have to do<br>
the heavy lifting here, unless it turns out that our debugger folks<br>
like the idea.<br>
<br>
--paulr<br>
<br>
</blockquote></div>