summaryrefslogtreecommitdiffstats
path: root/gnu/llvm/tools/llvm-c-test/debuginfo.c
diff options
context:
space:
mode:
authorpatrick <patrick@openbsd.org>2018-04-06 14:26:03 +0000
committerpatrick <patrick@openbsd.org>2018-04-06 14:26:03 +0000
commitbdabc2f19ffb9e20600dad6e8a300842a7bda50e (patch)
treec50e7b2e5449b074651bb82a58517a8ebc4a8cf7 /gnu/llvm/tools/llvm-c-test/debuginfo.c
parentPrint a 'p' flag for file descriptors that were opened after pledge(2). (diff)
downloadwireguard-openbsd-bdabc2f19ffb9e20600dad6e8a300842a7bda50e.tar.xz
wireguard-openbsd-bdabc2f19ffb9e20600dad6e8a300842a7bda50e.zip
Import LLVM 6.0.1 release including clang, lld and lldb.
"where is the kaboom?" deraadt@
Diffstat (limited to 'gnu/llvm/tools/llvm-c-test/debuginfo.c')
-rw-r--r--gnu/llvm/tools/llvm-c-test/debuginfo.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/gnu/llvm/tools/llvm-c-test/debuginfo.c b/gnu/llvm/tools/llvm-c-test/debuginfo.c
new file mode 100644
index 00000000000..c88c74167b6
--- /dev/null
+++ b/gnu/llvm/tools/llvm-c-test/debuginfo.c
@@ -0,0 +1,36 @@
+/*===-- debuginfo.c - tool for testing libLLVM and llvm-c API -------------===*\
+|* *|
+|* The LLVM Compiler Infrastructure *|
+|* *|
+|* This file is distributed under the University of Illinois Open Source *|
+|* License. See LICENSE.TXT for details. *|
+|* *|
+|*===----------------------------------------------------------------------===*|
+|* *|
+|* Tests for the LLVM C DebugInfo API *|
+|* *|
+\*===----------------------------------------------------------------------===*/
+
+#include "llvm-c/DebugInfo.h"
+#include <stdio.h>
+
+int llvm_test_dibuilder(void) {
+ LLVMModuleRef M = LLVMModuleCreateWithName("debuginfo.c");
+ LLVMDIBuilderRef DIB = LLVMCreateDIBuilder(M);
+
+ LLVMMetadataRef File = LLVMDIBuilderCreateFile(DIB, "debuginfo.c", 12,
+ ".", 1);
+
+ LLVMDIBuilderCreateCompileUnit(DIB,
+ LLVMDWARFSourceLanguageC, File,"llvm-c-test", 11, 0, NULL, 0, 0,
+ NULL, 0, LLVMDWARFEmissionFull, 0, 0, 0);
+
+ char *MStr = LLVMPrintModuleToString(M);
+ puts(MStr);
+ LLVMDisposeMessage(MStr);
+
+ LLVMDisposeDIBuilder(DIB);
+ LLVMDisposeModule(M);
+
+ return 0;
+}