question about DIDescriptor and MDNode


I’m a little confused about the relationship between llvm::DIDescriptor and llvm::MDNode, I find DIDescriptor has an attribute DbgNode, which is a MDNode, and they seem to share many similar functions…So I just want to in what kind of situation should we use one of them against another ?

Another more specific question: is there anyway(some member functions) that allows me to directly grab the corresponding debug info(metadata) of a certain item in the module(e.g. a global variable) with a pointer/ref to that item ?

as an example:

I have llvm::GlobalVariable gv1, I want to get the full debug info of gv1, how can I do that ?

Thanks !