MIR Serialization: Report an error when machine functions have the same name.

This commit reports an error when the MIR parser encounters a machine
function with the name that is the same as the name of a different
machine function.

Reviewers: Duncan P. N. Exon Smith

Differential Revision: http://reviews.llvm.org/D10130


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239774 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Alex Lorenz
2015-06-15 22:23:23 +00:00
parent 9784231221
commit 185789e9a0
2 changed files with 13 additions and 0 deletions

View File

@ -156,6 +156,9 @@ bool MIRParserImpl::parseMachineFunction(yaml::Input &In) {
if (In.error())
return true;
auto FunctionName = MF->Name;
if (Functions.find(FunctionName) != Functions.end())
return error(Twine("redefinition of machine function '") + FunctionName +
"'");
Functions.insert(std::make_pair(FunctionName, std::move(MF)));
return false;
}