diff options
author | Robert Widmann <devteam.codafi@gmail.com> | 2018-04-22 19:24:44 +0000 |
---|---|---|
committer | Robert Widmann <devteam.codafi@gmail.com> | 2018-04-22 19:24:44 +0000 |
commit | 12e367b6dba21c8d466d7cb012cc74de5487adaf (patch) | |
tree | 93dca84f56b67633398d9a56308e9a33e9e2b5d0 /llvm/tools/llvm-c-test | |
parent | 06e16541ba695ad3fd39f4d646a55a08482b096b (diff) | |
download | bcm5719-llvm-12e367b6dba21c8d466d7cb012cc74de5487adaf.tar.gz bcm5719-llvm-12e367b6dba21c8d466d7cb012cc74de5487adaf.zip |
[LLVM-C] Add DIBuilder Bindings For Variable Creation
Summary: Wrap LLVMDIBuilderCreateAutoVariable, LLVMDIBuilderCreateParameterVariable, LLVMDIBuilderCreateExpression, and move and correct LLVMDIBuilderInsertDeclareBefore and LLVMDIBuilderInsertDeclareAtEnd from the Go bindings to the C bindings.
Reviewers: harlanhaskins, whitequark, deadalnix
Reviewed By: harlanhaskins, whitequark
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D45928
llvm-svn: 330555
Diffstat (limited to 'llvm/tools/llvm-c-test')
-rw-r--r-- | llvm/tools/llvm-c-test/debuginfo.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/llvm/tools/llvm-c-test/debuginfo.c b/llvm/tools/llvm-c-test/debuginfo.c index 2d594d004d9..b1cc8519785 100644 --- a/llvm/tools/llvm-c-test/debuginfo.c +++ b/llvm/tools/llvm-c-test/debuginfo.c @@ -48,6 +48,7 @@ int llvm_test_dibuilder(void) { LLVMTypeRef FooParamTys[] = { LLVMInt64Type(), LLVMInt64Type() }; LLVMTypeRef FooFuncTy = LLVMFunctionType(LLVMInt64Type(), FooParamTys, 2, 0); LLVMValueRef FooFunction = LLVMAddFunction(M, "foo", FooFuncTy); + LLVMBasicBlockRef FooEntryBlock = LLVMAppendBasicBlock(FooFunction, "entry"); LLVMMetadataRef ParamTypes[] = {Int64Ty, Int64Ty}; LLVMMetadataRef FunctionTy = @@ -56,6 +57,23 @@ int llvm_test_dibuilder(void) { LLVMDIBuilderCreateFunction(DIB, File, "foo", 3, "foo", 3, File, 42, FunctionTy, true, true, 42, 0, false); + LLVMMetadataRef FooParamLocation = + LLVMDIBuilderCreateDebugLocation(LLVMGetGlobalContext(), 42, 0, + FunctionMetadata, NULL); + LLVMMetadataRef FooParamExpression = + LLVMDIBuilderCreateExpression(DIB, NULL, 0); + LLVMMetadataRef FooParamVar1 = + LLVMDIBuilderCreateParameterVariable(DIB, FunctionMetadata, "a", 1, 1, File, + 42, Int64Ty, true, 0); + LLVMDIBuilderInsertDeclareAtEnd(DIB, LLVMConstInt(LLVMInt64Type(), 0, false), + FooParamVar1, FooParamExpression, + FooParamLocation, FooEntryBlock); + LLVMMetadataRef FooParamVar2 = + LLVMDIBuilderCreateParameterVariable(DIB, FunctionMetadata, "b", 1, 2, File, + 42, Int64Ty, true, 0); + LLVMDIBuilderInsertDeclareAtEnd(DIB, LLVMConstInt(LLVMInt64Type(), 0, false), + FooParamVar2, FooParamExpression, + FooParamLocation, FooEntryBlock); LLVMSetSubprogram(FooFunction, FunctionMetadata); LLVMMetadataRef FooLexicalBlock = |