File tree Expand file tree Collapse file tree 5 files changed +26
-14
lines changed Expand file tree Collapse file tree 5 files changed +26
-14
lines changed Original file line number Diff line number Diff line change 15
15
16
16
@inline function refcheck (:: Type{T} , ref:: API.LLVMValueRef ) where T<: Instruction
17
17
ref== C_NULL && throw (UndefRefError ())
18
- T′ = identify (Instruction, ref)
19
- if T != T′
20
- error (" invalid conversion of $T′ instruction reference to $T " )
18
+ @static if Base. JLOptions (). debug_level >= 2
19
+ T′ = identify (Instruction, ref)
20
+ if T != T′
21
+ error (" invalid conversion of $T′ instruction reference to $T " )
22
+ end
21
23
end
22
24
end
23
25
Original file line number Diff line number Diff line change 14
14
15
15
@inline function refcheck (:: Type{T} , ref:: API.LLVMMetadataRef ) where T<: Metadata
16
16
ref== C_NULL && throw (UndefRefError ())
17
- T′ = identify (Metadata, ref)
18
- if T != T′
19
- error (" invalid conversion of $T′ metadata reference to $T " )
17
+ @static if Base. JLOptions (). debug_level >= 2
18
+ T′ = identify (Metadata, ref)
19
+ if T != T′
20
+ error (" invalid conversion of $T′ metadata reference to $T " )
21
+ end
20
22
end
21
23
end
22
24
Original file line number Diff line number Diff line change 16
16
17
17
@inline function refcheck (:: Type{T} , ref:: API.LLVMTypeRef ) where T<: LLVMType
18
18
ref== C_NULL && throw (UndefRefError ())
19
- T′ = identify (LLVMType, ref)
20
- if T != T′
21
- error (" invalid conversion of $T′ type reference to $T " )
19
+ @static if Base. JLOptions (). debug_level >= 2
20
+ T′ = identify (LLVMType, ref)
21
+ if T != T′
22
+ error (" invalid conversion of $T′ type reference to $T " )
23
+ end
22
24
end
23
25
end
24
26
Original file line number Diff line number Diff line change 17
17
18
18
@inline function refcheck (:: Type{T} , ref:: API.LLVMValueRef ) where T<: Value
19
19
ref== C_NULL && throw (UndefRefError ())
20
- T′ = identify (Value, ref)
21
- if T != T′
22
- error (" invalid conversion of $T′ value reference to $T " )
20
+ @static if Base. JLOptions (). debug_level >= 2
21
+ T′ = identify (Value, ref)
22
+ if T != T′
23
+ error (" invalid conversion of $T′ value reference to $T " )
24
+ end
23
25
end
24
26
end
25
27
Original file line number Diff line number Diff line change @@ -33,7 +33,9 @@ Context() do ctx
33
33
@test typeof (typ. ref) == LLVM. API. LLVMTypeRef # untyped
34
34
35
35
@test typeof (LLVM. IntegerType (typ. ref)) == LLVM. IntegerType # type reconstructed
36
- @test_throws ErrorException LLVM. FunctionType (typ. ref) # wrong type
36
+ if Base. JLOptions (). debug_level >= 2
37
+ @test_throws ErrorException LLVM. FunctionType (typ. ref) # wrong type
38
+ end
37
39
@test_throws UndefRefError LLVM. FunctionType (LLVM. API. LLVMTypeRef (C_NULL ))
38
40
39
41
@test typeof (typ. ref) == LLVM. API. LLVMTypeRef
@@ -202,7 +204,9 @@ LLVM.Module("SomeModule"; ctx) do mod
202
204
@test typeof (val. ref) == LLVM. API. LLVMValueRef # untyped
203
205
204
206
@test typeof (LLVM. Instruction (val. ref)) == LLVM. AllocaInst # type reconstructed
205
- @test_throws ErrorException LLVM. Function (val. ref) # wrong
207
+ if Base. JLOptions (). debug_level >= 2
208
+ @test_throws ErrorException LLVM. Function (val. ref) # wrong
209
+ end
206
210
@test_throws UndefRefError LLVM. Function (LLVM. API. LLVMValueRef (C_NULL ))
207
211
208
212
@test typeof (Value (val. ref)) == LLVM. AllocaInst # type reconstructed
You can’t perform that action at this time.
0 commit comments