diff options
Diffstat (limited to 'llvm/lib/CodeGen/MIRParser/MIRParser.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MIRParser/MIRParser.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/MIRParser/MIRParser.cpp b/llvm/lib/CodeGen/MIRParser/MIRParser.cpp index 7966f389d3e..1bf4684e924 100644 --- a/llvm/lib/CodeGen/MIRParser/MIRParser.cpp +++ b/llvm/lib/CodeGen/MIRParser/MIRParser.cpp @@ -559,9 +559,12 @@ bool MIRParserImpl::initializeConstantPool( YamlConstant.Alignment ? YamlConstant.Alignment : M.getDataLayout().getPrefTypeAlignment(Value->getType()); - // TODO: Report an error when the same constant pool value ID is redefined. - ConstantPoolSlots.insert(std::make_pair( - YamlConstant.ID, ConstantPool.getConstantPoolIndex(Value, Alignment))); + unsigned Index = ConstantPool.getConstantPoolIndex(Value, Alignment); + if (!ConstantPoolSlots.insert(std::make_pair(YamlConstant.ID.Value, Index)) + .second) + return error(YamlConstant.ID.SourceRange.Start, + Twine("redefinition of constant pool item '%const.") + + Twine(YamlConstant.ID.Value) + "'"); } return false; } |