Added "getCanonicalID()", "isFromSameFile", and "isFromMainFile" to compare
the files of different SourceLocations. These methods correctly handle the
case where a file may have multiple FileIDs due to it being large enough
to be spread across several chunks.
llvm-svn: 49682
diff --git a/clang/lib/Basic/SourceLocation.cpp b/clang/lib/Basic/SourceLocation.cpp
index c014475..83c264a 100644
--- a/clang/lib/Basic/SourceLocation.cpp
+++ b/clang/lib/Basic/SourceLocation.cpp
@@ -88,3 +88,7 @@
assert (isValid());
return SrcMgr->getBuffer(Loc.getFileID());
}
+
+unsigned FullSourceLoc::getCanonicalFileID() const {
+ return SrcMgr->getCanonicalFileID(Loc);
+}