Clang SourceLocation full file path

Hi All,

I have been using SourceLocation::printToString(SourceManager) to get the string containing the full-path of a source location in Clang.

However, the API is suddenly behaving inconsistently: when ran with some files it prints their absolute path:line:col, for others it only prints the filename (basename):line:col.

Could someone please let me know how to make sure that I always get the absolute path?

Thanks,

Hi All,

I have been using SourceLocation::printToString(SourceManager) to get the string containing the full-path of a source location in Clang.

However, the API is suddenly

What do you mean by suddenly? Did you see a change in behavior recently?

behaving inconsistently: when ran with some files it prints their absolute path:line:col, for others it only prints the filename (basename):line:col.

Could someone please let me know how to make sure that I always get the absolute path?

Are those paths valid relative paths at your current working directory?

Hi Manuel,

Yes I noticed the change recently. I can’t pinpoint a date, but I believe it was after the llvm update as I was using 3.8 release prior to that and it returned the absolute paths.

Yes the returned paths are valid paths, but they seem to be relative to the TU file under analysis.