MIR Parser: Report an error when a jump table entry is redefined.
[oota-llvm.git] / lib / CodeGen / MIRParser / MIRParser.cpp
index cc277eea9f4b45cea59d371001cd62cf9839706d..0679ec02c988fe30a399dae74edce260988d2d6b 100644 (file)
@@ -582,8 +582,11 @@ bool MIRParserImpl::initializeJumpTableInfo(
       Blocks.push_back(MBB);
     }
     unsigned Index = JTI->createJumpTableIndex(Blocks);
-    // TODO: Report an error when the same jump table slot ID is redefined.
-    PFS.JumpTableSlots.insert(std::make_pair(Entry.ID, Index));
+    if (!PFS.JumpTableSlots.insert(std::make_pair(Entry.ID.Value, Index))
+             .second)
+      return error(Entry.ID.SourceRange.Start,
+                   Twine("redefinition of jump table entry '%jump-table.") +
+                       Twine(Entry.ID.Value) + "'");
   }
   return false;
 }