[PATCH] D60725: [LLVM-C] Add Accessors For Global Variable Metadata Properties

Robert Widmann via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 15 10:41:37 PDT 2019


CodaFi added a comment.

@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.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D60725/new/

https://reviews.llvm.org/D60725





More information about the llvm-commits mailing list