1 /*===-- object.c - tool for testing libLLVM and llvm-c API ----------------===*\
3 |* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
5 |* See https://llvm.org/LICENSE.txt for license information. *|
6 |* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
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"
17 int llvm_add_named_metadata_operand(void) {
18 LLVMModuleRef m
= LLVMModuleCreateWithName("Mod");
19 LLVMValueRef values
[] = { LLVMConstInt(LLVMInt32Type(), 0, 0) };
21 // This used to trigger an assertion
22 LLVMAddNamedMetadataOperand(m
, "name", LLVMMDNode(values
, 1));
29 int llvm_set_metadata(void) {
30 LLVMBuilderRef b
= LLVMCreateBuilder();
31 LLVMValueRef values
[] = { LLVMConstInt(LLVMInt32Type(), 0, 0) };
33 // This used to trigger an assertion
36 LLVMGetMDKindID("kind", 4),
37 LLVMMDNode(values
, 1));
39 LLVMDisposeBuilder(b
);