<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jul 15, 2013 at 1:54 PM, Rui Ueyama <span dir="ltr"><<a href="mailto:ruiu@google.com" target="_blank" class="cremed">ruiu@google.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="im">================<br>
Comment at: lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp:319<br>
@@ +318,3 @@<br>
+    for (const auto *layout : _atomLayouts) {<br>
+      const DefinedAtom *atom = dyn_cast<const DefinedAtom>(layout->_atom);<br>
+      for (const Reference *ref : *atom)<br>
----------------<br>
</div><div class="im">Sean Silva wrote:<br>
> Richard wrote:<br>
> > Can dyn_cast<T> return nullptr?<br>
> Good catch. If you know it is a DefinedAtom, then just use cast<>. Also, you should be able to just do dyn_cast<DefinedAtom> since I believe returned result is always const.<br>
</div>We are sure that all the atoms are defined atoms here. I'd like to continue using dyn_cast with null-checking assert() for safety.</blockquote></div><br>FYI, cast<> really is the right tool. It has internal asserts that check the cast in debug builds, so it should givey ou exactly what you want there.</div>
</div>