Source Line/Filename + LLVM

Hello all,
I have a rather simple question. We compiled our code with debug information and called Loc.getLineNumber() and Loc.getFilename() from the DILocation library. However, these methods return 0 and NIL, respectively for some calls. Most of the calls return valid filenames and src line numbers, but a couple return 0/NIL.

What is happening here? Does anyone have any experience with this kind of behavior?

Is it a problem with how I compiled my program? Is it an LLVM problem? Am I error handling incorrectly?



Sometimes instructions don't have locations.

Especially after optimization - there are cases where there's no
singular/unambiguous location that would be accurate for an
instruction, so no location is provided.