[lld] r256981 - Add llvm_unreachable to unreachable code.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 6 14:01:25 PST 2016


Author: ruiu
Date: Wed Jan  6 16:01:25 2016
New Revision: 256981

URL: http://llvm.org/viewvc/llvm-project?rev=256981&view=rev
Log:
Add llvm_unreachable to unreachable code.

The original code was an infinite recursion when the control reaches there.

Modified:
    lld/trunk/ELF/InputSection.cpp

Modified: lld/trunk/ELF/InputSection.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.cpp?rev=256981&r1=256980&r2=256981&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.cpp (original)
+++ lld/trunk/ELF/InputSection.cpp Wed Jan  6 16:01:25 2016
@@ -52,7 +52,9 @@ InputSectionBase<ELFT>::getOffset(uintX_
   case Merge:
     return cast<MergeInputSection<ELFT>>(this)->getOffset(Offset);
   case MipsReginfo:
-    return cast<MipsReginfoInputSection<ELFT>>(this)->getOffset(Offset);
+    // MIPS .reginfo sections are consumed by the linker,
+    // so it should never be copied to output.
+    llvm_unreachable("MIPS .reginfo reached writeTo().");
   }
   llvm_unreachable("Invalid section kind");
 }




More information about the llvm-commits mailing list