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.
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
Comment Actions
@jberdine This patch handles the global variable side of things. You should be able to replace those accessors in Core with a call to LLVMGlobalCopyAllMetadata. You can filter for !dbg and dig out the global variable expression. From there, you locate from global variable expression to global variable with LLVMDIGlobalVariableExpressionGetVariable and from global variable to line with LLVMDIVariableGetLine.
In general, it isn't safe to assume that the first metadata attachment you find on a global variable is !dbg, so the existing bindings in Core will fail to retrieve information in some odd cases.
llvm/lib/IR/DebugInfo.cpp | ||
---|---|---|
1257 ↗ | (On Diff #195223) | Ugh, this New MacBook keyboard of mine... Thanks. |