Obtaining a GlobalVariable from an MDNode

I’m trying to debug SAFECode source code files, and I need to find a way to obtain a GlobalVariable from its appropriate MDNode. How can I do this? I’ve been looking over the doxygen and I can’t seem to find a way to do this.

Thanks,
Peter Finn

I’m trying to debug SAFECode source code files, and I need to find a way to obtain a GlobalVariable from its appropriate MDNode. How can I do this? I’ve been looking over the doxygen and I can’t seem to find a way to do this.

Which source file does this? I don't recall off-hand where SAFECode does this and why.

Regards,

John Criswell

DebugInstrumentation.cpp. Line 246 does the following:

if (DIGlobalVariable(*NMD->getOperand(i)).getGlobal() == GV) {

(Where i is an unsigned loop variable and NMD is a NamedMDNode.) Apparently, the compiler rejected the cast from an MDNode (the result of getOperand(i)) to a DIGlobalVariable. Also, it appears that getGlobal() doesn’t exist anymore in the DIGlobalVariable doxygen.

Peter

The API was changed. Try cast_or_null(DIGV->getVariable()) where DIGV is DIGlobalVariable.