llvm.org GIT mirror llvm / dc6d652
MIR Parser: report an error when a basic block isn't found. This commit reports an error when the MIR parser can't find a basic block with the machine basic block's name. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240174 91177308-0d34-0410-b5e6-96231b3b80d8 Alex Lorenz 5 years ago
2 changed file(s) with 21 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
211211 if (!YamlMBB.Name.empty()) {
212212 BB = dyn_cast_or_null(
213213 F.getValueSymbolTable().lookup(YamlMBB.Name));
214 // TODO: Report an error if a basic block isn't found.
214 if (!BB)
215 return error(Twine("basic block '") + YamlMBB.Name +
216 "' is not defined in the function '" + MF.getName() + "'");
215217 }
216218 auto *MBB = MF.CreateMachineBasicBlock(BB);
217219 MF.insert(MF.end(), MBB);
0 # RUN: not llc -start-after branch-folder -stop-after branch-folder -o /dev/null %s 2>&1 | FileCheck %s
1 # This test ensures that an error is reported whenever the MIR parser can't find
2 # a basic block with the machine basis block's name.
3
4 --- |
5
6 define i32 @foo() {
7 entry:
8 ret i32 0
9 }
10
11 ...
12 ---
13 name: foo
14 body:
15 # CHECK: basic block 'entrie' is not defined in the function 'foo'
16 - name: entrie
17 ...