mirror of
https://github.com/RPCSX/llvm.git
synced 2025-01-18 02:16:43 +00:00
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:
parent
9784231221
commit
185789e9a0
@ -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;
|
||||
}
|
||||
|
10
test/CodeGen/MIR/machine-function-redefinition-error.mir
Normal file
10
test/CodeGen/MIR/machine-function-redefinition-error.mir
Normal file
@ -0,0 +1,10 @@
|
||||
# RUN: not llc -start-after branch-folder -stop-after branch-folder -o /dev/null %s 2>&1 | FileCheck %s
|
||||
# This test ensures that the machine function errors are reported correctly.
|
||||
|
||||
---
|
||||
name: foo
|
||||
...
|
||||
---
|
||||
# CHECK: redefinition of machine function 'foo'
|
||||
name: foo
|
||||
...
|
Loading…
x
Reference in New Issue
Block a user