Fix LLVMSetMetadata and LLVMAddNamedMetadataOperand for single value MDNodes
authorBjorn Steinbrink <bsteinbr@gmail.com>
Wed, 28 Jan 2015 16:35:59 +0000 (16:35 +0000)
committerBjorn Steinbrink <bsteinbr@gmail.com>
Wed, 28 Jan 2015 16:35:59 +0000 (16:35 +0000)
commita09ac0085d33695754f04a66d5e1991b3a96b724
tree66d726a4cc166b832e6702abb60588f205c5a5d2
parente13a9624c282e30d0ec0290166cc16dc1892918a
Fix LLVMSetMetadata and LLVMAddNamedMetadataOperand for single value MDNodes

Summary:
MetadataAsValue uses a canonical format that strips the MDNode if it
contains only a single constant value. This triggers an assertion when
trying to cast the value to a MDNode.

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D7165

llvm-svn: 227319
llvm/lib/IR/Core.cpp
llvm/test/Bindings/llvm-c/add_named_metadata_operand.ll [new file with mode: 0644]
llvm/test/Bindings/llvm-c/set_metadata.ll [new file with mode: 0644]
llvm/tools/llvm-c-test/CMakeLists.txt
llvm/tools/llvm-c-test/llvm-c-test.h
llvm/tools/llvm-c-test/main.c
llvm/tools/llvm-c-test/metadata.c [new file with mode: 0644]