As described in http://llvm.org/docs/SourceLevelDebugging.html,
I can find the line & column number of source code from LLVM IR using the following piece of code.
if (MDNode *N = I->getMetadata("dbg")) { // Here I is an LLVM instruction
DILocation Loc(N); // DILocation is in DebugInfo.h
unsigned Line = Loc.getLineNumber();
StringRef File = Loc.getFilename();
StringRef Dir = Loc.getDirectory();
}
Howerver, I want more precise information.
In AST level, clang provides the FullSourceLoc API (getCharaterData()) so that I can find the mapping between AST node and the original source code. And I want to find such mapping between LLVM IR and source code.
Is it possible for me to get the exact charater data from IR's debug information?
Thanks.