diff options
| author | Robert Widmann <devteam.codafi@gmail.com> | 2019-04-16 21:39:48 +0000 |
|---|---|---|
| committer | Robert Widmann <devteam.codafi@gmail.com> | 2019-04-16 21:39:48 +0000 |
| commit | d6eb4bb8010752c0f51c391bb050725c0484a208 (patch) | |
| tree | 56bfe6ae0bf89d20a2f90d1c7db4e3adf550cff2 /llvm/lib | |
| parent | e8de5cd6023feee263ced0586155947f219f1c96 (diff) | |
| download | bcm5719-llvm-d6eb4bb8010752c0f51c391bb050725c0484a208.tar.gz bcm5719-llvm-d6eb4bb8010752c0f51c391bb050725c0484a208.zip | |
[LLVM-C] Add Accessors For Global Variable Metadata Properties
Summary: Metadata for a global variable is really a (GlobalVariable, Expression) tuple. Allow access to these, then allow retrieving the file, scope, and line for a DIVariable, whether global or local. This should be the last of the accessors required for uniform access to location and file information metadata.
Reviewers: jberdine, whitequark, deadalnix
Reviewed By: jberdine, whitequark
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D60725
llvm-svn: 358532
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/IR/DebugInfo.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp index 773d547a136..124462355cd 100644 --- a/llvm/lib/IR/DebugInfo.cpp +++ b/llvm/lib/IR/DebugInfo.cpp @@ -1248,6 +1248,27 @@ LLVMMetadataRef LLVMDIBuilderCreateGlobalVariableExpression( nullptr, AlignInBits)); } +LLVMMetadataRef LLVMDIGlobalVariableExpressionGetVariable(LLVMMetadataRef GVE) { + return wrap(unwrapDI<DIGlobalVariableExpression>(GVE)->getVariable()); +} + +LLVMMetadataRef LLVMDIGlobalVariableExpressionGetExpression( + LLVMMetadataRef GVE) { + return wrap(unwrapDI<DIGlobalVariableExpression>(GVE)->getExpression()); +} + +LLVMMetadataRef LLVMDIVariableGetFile(LLVMMetadataRef Var) { + return wrap(unwrapDI<DIVariable>(Var)->getFile()); +} + +LLVMMetadataRef LLVMDIVariableGetScope(LLVMMetadataRef Var) { + return wrap(unwrapDI<DIVariable>(Var)->getScope()); +} + +unsigned LLVMDIVariableGetLine(LLVMMetadataRef Var) { + return unwrapDI<DIVariable>(Var)->getLine(); +} + LLVMMetadataRef LLVMTemporaryMDNode(LLVMContextRef Ctx, LLVMMetadataRef *Data, size_t Count) { return wrap( @@ -1359,6 +1380,10 @@ void LLVMSetSubprogram(LLVMValueRef Func, LLVMMetadataRef SP) { unwrap<Function>(Func)->setSubprogram(unwrap<DISubprogram>(SP)); } +unsigned LLVMDISubprogramGetLine(LLVMMetadataRef Subprogram) { + return unwrapDI<DISubprogram>(Subprogram)->getLine(); +} + LLVMMetadataRef LLVMInstructionGetDebugLoc(LLVMValueRef Inst) { return wrap(unwrap<Instruction>(Inst)->getDebugLoc().getAsMDNode()); } |

