xref: /llvm-project/llvm/test/Assembler/captures-errors.ll (revision 22e9024c9f374c0c740647829050c289673dbb11)
1; RUN: split-file --leading-lines %s %t
2; RUN: not llvm-as < %t/missing-lparen.ll 2>&1 | FileCheck %s --check-prefix=CHECK-MISSING-LPAREN
3; RUN: not llvm-as < %t/missing-rparen.ll 2>&1 | FileCheck %s --check-prefix=CHECK-MISSING-RPAREN
4; RUN: not llvm-as < %t/missing-rparen-none.ll 2>&1 | FileCheck %s --check-prefix=CHECK-MISSING-RPAREN-NONE
5; RUN: not llvm-as < %t/missing-colon.ll 2>&1 | FileCheck %s --check-prefix=CHECK-MISSING-COLON
6; RUN: not llvm-as < %t/invalid-component.ll 2>&1 | FileCheck %s --check-prefix=CHECK-INVALID-COMPONENT
7; RUN: not llvm-as < %t/duplicate-ret.ll 2>&1 | FileCheck %s --check-prefix=CHECK-DUPLICATE-RET
8; RUN: not llvm-as < %t/none-after.ll 2>&1 | FileCheck %s --check-prefix=CHECK-NONE-AFTER
9; RUN: not llvm-as < %t/none-before.ll 2>&1 | FileCheck %s --check-prefix=CHECK-NONE-BEFORE
10; RUN: not opt -disable-output < %t/non-pointer-type.ll 2>&1 | FileCheck %s --check-prefix=CHECK-NON-POINTER-TYPE
11
12;--- missing-lparen.ll
13
14; CHECK-MISSING-LPAREN: <stdin>:[[@LINE+1]]:32: error: expected '('
15define void @test(ptr captures %p) {
16  ret void
17}
18
19;--- missing-rparen.ll
20
21; CHECK-MISSING-RPAREN: <stdin>:[[@LINE+1]]:40: error: expected ',' or ')'
22define void @test(ptr captures(address %p) {
23  ret void
24}
25
26;--- missing-rparen-none.ll
27
28; CHECK-MISSING-RPAREN-NONE: <stdin>:[[@LINE+1]]:37: error: expected ',' or ')'
29define void @test(ptr captures(none %p) {
30  ret void
31}
32
33;--- missing-colon.ll
34
35; CHECK-MISSING-COLON: <stdin>:[[@LINE+1]]:36: error: expected ':'
36define void @test(ptr captures(ret address) %p) {
37  ret void
38}
39
40;--- invalid-component.ll
41
42; CHECK-INVALID-COMPONENT: <stdin>:[[@LINE+1]]:32: error: expected one of 'none', 'address', 'address_is_null', 'provenance' or 'read_provenance'
43define void @test(ptr captures(foo) %p) {
44  ret void
45}
46
47;--- duplicate-ret.ll
48
49; CHECK-DUPLICATE-RET: <stdin>:[[@LINE+1]]:51: error: duplicate 'ret' location
50define void @test(ptr captures(ret: address, ret: provenance) %p) {
51  ret void
52}
53
54;--- none-after.ll
55
56; CHECK-NONE-AFTER: <stdin>:[[@LINE+1]]:45: error: cannot use 'none' with other component
57define void @test(ptr captures(address, none) %p) {
58  ret void
59}
60
61;--- none-before.ll
62
63; CHECK-NONE-BEFORE: <stdin>:[[@LINE+1]]:38: error: cannot use 'none' with other component
64define void @test(ptr captures(none, address) %p) {
65  ret void
66}
67
68;--- non-pointer-type.ll
69
70; CHECK-NON-POINTER-TYPE: Attribute 'captures(none)' applied to incompatible type!
71define void @test(i32 captures(none) %p) {
72  ret void
73}
74