aboutsummaryrefslogtreecommitdiff
path: root/llvm/test/Assembler/captures-errors.ll
blob: 44788c79a2453da38b77445b588d577acde18147 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
; RUN: split-file --leading-lines %s %t
; RUN: not llvm-as < %t/missing-lparen.ll 2>&1 | FileCheck %s --check-prefix=CHECK-MISSING-LPAREN
; RUN: not llvm-as < %t/missing-rparen.ll 2>&1 | FileCheck %s --check-prefix=CHECK-MISSING-RPAREN
; RUN: not llvm-as < %t/missing-rparen-none.ll 2>&1 | FileCheck %s --check-prefix=CHECK-MISSING-RPAREN-NONE
; RUN: not llvm-as < %t/missing-colon.ll 2>&1 | FileCheck %s --check-prefix=CHECK-MISSING-COLON
; RUN: not llvm-as < %t/invalid-component.ll 2>&1 | FileCheck %s --check-prefix=CHECK-INVALID-COMPONENT
; RUN: not llvm-as < %t/duplicate-ret.ll 2>&1 | FileCheck %s --check-prefix=CHECK-DUPLICATE-RET
; RUN: not llvm-as < %t/none-after.ll 2>&1 | FileCheck %s --check-prefix=CHECK-NONE-AFTER
; RUN: not llvm-as < %t/none-before.ll 2>&1 | FileCheck %s --check-prefix=CHECK-NONE-BEFORE
; RUN: not opt -disable-output < %t/non-pointer-type.ll 2>&1 | FileCheck %s --check-prefix=CHECK-NON-POINTER-TYPE

;--- missing-lparen.ll

; CHECK-MISSING-LPAREN: <stdin>:[[@LINE+1]]:32: error: expected '('
define void @test(ptr captures %p) {
  ret void
}

;--- missing-rparen.ll

; CHECK-MISSING-RPAREN: <stdin>:[[@LINE+1]]:40: error: expected ',' or ')'
define void @test(ptr captures(address %p) {
  ret void
}

;--- missing-rparen-none.ll

; CHECK-MISSING-RPAREN-NONE: <stdin>:[[@LINE+1]]:37: error: expected ',' or ')'
define void @test(ptr captures(none %p) {
  ret void
}

;--- missing-colon.ll

; CHECK-MISSING-COLON: <stdin>:[[@LINE+1]]:36: error: expected ':'
define void @test(ptr captures(ret address) %p) {
  ret void
}

;--- invalid-component.ll

; CHECK-INVALID-COMPONENT: <stdin>:[[@LINE+1]]:32: error: expected one of 'none', 'address', 'address_is_null', 'provenance' or 'read_provenance'
define void @test(ptr captures(foo) %p) {
  ret void
}

;--- duplicate-ret.ll

; CHECK-DUPLICATE-RET: <stdin>:[[@LINE+1]]:51: error: duplicate 'ret' location
define void @test(ptr captures(ret: address, ret: provenance) %p) {
  ret void
}

;--- none-after.ll

; CHECK-NONE-AFTER: <stdin>:[[@LINE+1]]:45: error: cannot use 'none' with other component
define void @test(ptr captures(address, none) %p) {
  ret void
}

;--- none-before.ll

; CHECK-NONE-BEFORE: <stdin>:[[@LINE+1]]:38: error: cannot use 'none' with other component
define void @test(ptr captures(none, address) %p) {
  ret void
}

;--- non-pointer-type.ll

; CHECK-NON-POINTER-TYPE: Attribute 'captures(none)' applied to incompatible type!
define void @test(i32 captures(none) %p) {
  ret void
}