[lld] r233453 - Remove else after return.

David Blaikie dblaikie at gmail.com
Fri Mar 27 17:06:09 PDT 2015


On Mar 27, 2015 4:56 PM, "Rui Ueyama" <ruiu at google.com> wrote:
>
> Author: ruiu
> Date: Fri Mar 27 18:50:09 2015
> New Revision: 233453
>
> URL: http://llvm.org/viewvc/llvm-project?rev=233453&view=rev
> Log:
> Remove else after return.
>
> Modified:
>     lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h
> URL:
http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h?rev=233453&r1=233452&r2=233453&view=diff
>
==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h Fri Mar 27 18:50:09
2015
> @@ -633,17 +633,16 @@ DefaultLayout<ELFT>::addAtom(const Atom
>
>        _referencedDynAtoms.insert(reloc->target());
>      }
> -
>      return section->appendAtom(atom);
> -  } else if (const AbsoluteAtom *absoluteAtom =
dyn_cast<AbsoluteAtom>(atom)) {
> +  }
> +  if (const AbsoluteAtom *absoluteAtom = dyn_cast<AbsoluteAtom>(atom)) {
>      // Absolute atoms are not part of any section, they are global for
the whole
>      // link
>      _absoluteAtoms.push_back(new (_allocator)
>          lld::AtomLayout(absoluteAtom, 0, absoluteAtom->value()));
>      return _absoluteAtoms.back();
> -  } else {
> -    llvm_unreachable("Only absolute / defined atoms can be added here");
>    }
> +  llvm_unreachable("Only absolute / defined atoms can be added here");

You could just switch the above dyn-cast to a cast instead? Rather than
essentially branching to unreachable here.

>  }
>
>  /// Output sections with the same name into a OutputSection
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150327/f1277ab9/attachment.html>


More information about the llvm-commits mailing list