1 /*===-- object.c - tool for testing libLLVM and llvm-c API ----------------===*\
3 |* The LLVM Compiler Infrastructure *|
5 |* This file is distributed under the University of Illinois Open Source *|
6 |* License. See LICENSE.TXT for details. *|
8 |*===----------------------------------------------------------------------===*|
10 |* This file implements the --add-named-metadata-operand and --set-metadata *|
11 |* commands in llvm-c-test. *|
13 \*===----------------------------------------------------------------------===*/
15 #include "llvm-c-test.h"
16 #include "llvm-c/Core.h"
18 int add_named_metadata_operand(void) {
19 LLVMModuleRef m = LLVMModuleCreateWithName("Mod");
20 LLVMValueRef values[] = { LLVMConstInt(LLVMInt32Type(), 0, 0) };
22 // This used to trigger an assertion
23 LLVMAddNamedMetadataOperand(m, "name", LLVMMDNode(values, 1));
30 int set_metadata(void) {
31 LLVMBuilderRef b = LLVMCreateBuilder();
32 LLVMValueRef values[] = { LLVMConstInt(LLVMInt32Type(), 0, 0) };
34 // This used to trigger an assertion
37 LLVMGetMDKindID("kind", 4),
38 LLVMMDNode(values, 1));
40 LLVMDisposeBuilder(b);