How to compare two FullSourceLoc?

Hi everyone,

I have a problem that I couldn’t solve in spite of being trying all sorts of things.

Imagine that I have two files, file1.cpp and file2.cpp, and both have the same header file included, header.h.

First I process file1.cpp and I find a SourceLocation within header.h that I don’t want to visit again when I process other files. My solution was to save it in a list of FullSourceLoc. When I process file2.cpp and I detect a SourceLocation, to assure that it hasn’t visited yet, I need to compare it with the source locations that I had saved in the list. But, how can I compare them?

The simplest way (if (fullsourceLoc1 == fullsourceLoc2) ) is not working, so I have been trying with the FileID, the spellingLineNumber and so on, but I wasn’t able to find the correct solution. I don’t know if I should use SourceLocation or FullSourceLoc, if the FileID is the same for header.h when I process file1 and file2… so I’m rather lost with this.

Please, anyone knows the solution to this?

Thanks in advance.