I'm trying to get debugging metadata from an llvm Instruction using the DILocation class.
However, when I query the DILocation for the filename where the instruction came from, I get a filename with a directory tagged onto the front.
I though it would return just the file and the entire directory path should be retrieved via a call to getDirectory().
For example, instead of XMain_0.c I end up with pbg/XMain_0.c
I compiled my bitcode like this:
XMain_0.o: pbg/XMain_0.c
$(CC) <snip> -c pbg/XMain_0.c
Does the fact that I passed in my source with a directory on it mean that the metadata saves the source filename as the input?
Here's a cut down example:
const llvm::Instruction* inst //passed in
MDNode *n = inst->getMetadata("dbg");
DILocation loc(n);
file = loc.getFilename().str(); // => pbg/XMain_0.c
dir = loc.getDirectory().str(); // => /projects/pbg/pbg-m/DIR
Are there calls I can make to "normalize" this data or do I need to do it by hand?
Clang 3.1 if that matters.