[cfe-dev] How to compare two FullSourceLoc?

Pedro Delgado Perez pedro.delgadoperez at mail.uca.es
Mon Feb 10 03:49:56 PST 2014


 
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.



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140210/c42f0320/attachment.html>


More information about the cfe-dev mailing list