<div dir="ltr"><div class="gmail_extra">I think I'm not too excited about adding more predicates or inheritance. Lazy symbols are useful only when we are adding files to the symbol table. After that, there's no use of them. So maybe we can just visit all symbols at some point after reading all files but before writeResult to nuke all Lazy symbols (by replacing local undefined symbol or something), so that we don't have to think about it after that point.</div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Oct 13, 2017 at 3:27 PM, Rafael Avila de Espindola <span dir="ltr"><<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">In lld we have three types of symbols that are easily confused:<br>
undefined, shared and lazy.<br>
<br>
I just finished auditing the uses of isUndefined, and most were<br>
incorrect.<br>
<br>
The most common issue was that the code intended to check if the symbol<br>
will be undefined on the final symbol table. The actual predicate for<br>
that is isInCurrentDSO().<br>
<br>
In some other cases the intention was to check if we had a definition<br>
already, in which case the code should check also for lazy symbols<br>
too. We don't currently have a predicate for isUndefined() || isLazy().<br>
<br>
Some ideas to try to make this less error prone.<br>
<br>
* Add a isNotDefined() predicate for isUndefined() ||<br>
  isLazy(). Unfortunately the name would be confusing.<br>
<br>
* Have Lazy inherit from undefined. Very few places want to check just<br>
  for undefined, so they can use kind() directly and isUndefined() would<br>
  also return true for lazy symbols.<br>
<br>
* Rename isUndefined() to isUndefinedOnInput() to make it clear it is<br>
  not about the output symbol table.<br>
<br>
I am not too excited about any of these. Anyone has another suggestion<br>
on how to make this more intuitive?<br>
<br>
Cheers,<br>
Rafael<br>
</div></div></blockquote></div><br></div></div>