how to get source code location information in LLVM3.7.0?

could anyone give me some examples to get a instruction’s line and filename information in source codes in LLVM3.7.0?

thank you!


You could see how passes print their remarks. For instance, see lib/Transforms/Scalar/LoopUnrollPass.cpp, lines 1048-1055. You’ll probably be interested in DebugLoc type, and how function emitOptimizationRemarkMissed is implemented.