[PATCH] [PECOFF][Writer] Emit .reloc section.

Chandler Carruth chandlerc at google.com
Mon Jul 15 13:58:10 PDT 2013


On Mon, Jul 15, 2013 at 1:54 PM, Rui Ueyama <ruiu at google.com> wrote:

> ================
> Comment at: lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp:319
> @@ +318,3 @@
> +    for (const auto *layout : _atomLayouts) {
> +      const DefinedAtom *atom = dyn_cast<const
> DefinedAtom>(layout->_atom);
> +      for (const Reference *ref : *atom)
> ----------------
> Sean Silva wrote:
> > Richard wrote:
> > > Can dyn_cast<T> return nullptr?
> > 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.
> 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.


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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130715/2d709bc8/attachment.html>


More information about the llvm-commits mailing list