blob: c88c74167b6391b7afcfcd7f30305cef65da5623 [file] [log] [blame]
whitequark789164d2017-11-01 22:18:52 +00001/*===-- debuginfo.c - tool for testing libLLVM and llvm-c API -------------===*\
2|* *|
3|* The LLVM Compiler Infrastructure *|
4|* *|
5|* This file is distributed under the University of Illinois Open Source *|
6|* License. See LICENSE.TXT for details. *|
7|* *|
8|*===----------------------------------------------------------------------===*|
9|* *|
10|* Tests for the LLVM C DebugInfo API *|
11|* *|
12\*===----------------------------------------------------------------------===*/
13
whitequark789164d2017-11-01 22:18:52 +000014#include "llvm-c/DebugInfo.h"
whitequark789164d2017-11-01 22:18:52 +000015#include <stdio.h>
16
Galina Kistanova5f8c84c2017-12-16 02:54:17 +000017int llvm_test_dibuilder(void) {
whitequark789164d2017-11-01 22:18:52 +000018 LLVMModuleRef M = LLVMModuleCreateWithName("debuginfo.c");
19 LLVMDIBuilderRef DIB = LLVMCreateDIBuilder(M);
20
21 LLVMMetadataRef File = LLVMDIBuilderCreateFile(DIB, "debuginfo.c", 12,
22 ".", 1);
23
24 LLVMDIBuilderCreateCompileUnit(DIB,
25 LLVMDWARFSourceLanguageC, File,"llvm-c-test", 11, 0, NULL, 0, 0,
26 NULL, 0, LLVMDWARFEmissionFull, 0, 0, 0);
27
28 char *MStr = LLVMPrintModuleToString(M);
29 puts(MStr);
30 LLVMDisposeMessage(MStr);
31
32 LLVMDisposeDIBuilder(DIB);
33 LLVMDisposeModule(M);
34
35 return 0;
36}