File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change 4545end
4646reftype (:: Type{Metadata} ) = API. LLVMMetadataRef
4747
48- function Value (md:: Metadata , ctx:: Context )
49- return MetadataAsValue (API. LLVMMetadataAsValue (ref (ctx), md))
50- end
51-
5248function Metadata (val:: Value )
5349 return Metadata (LLVM. API. LLVMValueAsMetadata (ref (val)))
5450end
51+
52+ function Value (md:: Metadata , ctx:: Context )
53+ return MetadataAsValue (API. LLVMMetadataAsValue (ref (ctx), ref (md)))
54+ end
Original file line number Diff line number Diff line change @@ -530,7 +530,7 @@ LLVM.Module("SomeModule", ctx) do mod
530530 @test convert (String, datalayout (mod)) == dummyLayout
531531
532532 if LLVM. version () >= v " 8.0"
533- md = Metadata (ConstantInt (42 ))
533+ md = Metadata (ConstantInt (42 , ctx ))
534534
535535 mod_flags = flags (mod)
536536 push! (mod_flags, LLVM. API. LLVMModuleFlagBehaviorError, " foobar" , md)
@@ -942,6 +942,10 @@ LLVM.Module("SomeModule", ctx) do mod
942942 @test isempty (md)
943943 @test ! haskey (md, LLVM. MD_dbg)
944944 end
945+ let val = ConstantInt (42 , ctx)
946+ md = Metadata (val)
947+ @test first (operands (LLVM. Value (md, ctx))) == val
948+ end
945949
946950 @test retinst in instructions (bb3)
947951 delete! (bb3, retinst)
You can’t perform that action at this time.
0 commit comments