blob: 2da3887a1721fa0c1aa71ee8427f0ab78a016be5 [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
14#include "llvm-c-test.h"
15#include "llvm-c/DebugInfo.h"
16#include <string.h>
17#include <stdio.h>
18
19int llvm_test_dibuilder() {
20 LLVMModuleRef M = LLVMModuleCreateWithName("debuginfo.c");
21 LLVMDIBuilderRef DIB = LLVMCreateDIBuilder(M);
22
23 LLVMMetadataRef File = LLVMDIBuilderCreateFile(DIB, "debuginfo.c", 12,
24 ".", 1);
25
26 LLVMDIBuilderCreateCompileUnit(DIB,
27 LLVMDWARFSourceLanguageC, File,"llvm-c-test", 11, 0, NULL, 0, 0,
28 NULL, 0, LLVMDWARFEmissionFull, 0, 0, 0);
29
30 char *MStr = LLVMPrintModuleToString(M);
31 puts(MStr);
32 LLVMDisposeMessage(MStr);
33
34 LLVMDisposeDIBuilder(DIB);
35 LLVMDisposeModule(M);
36
37 return 0;
38}