aboutsummaryrefslogtreecommitdiff
path: root/lib/Basic/SourceLocation.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-04-14 21:04:18 +0000
committerTed Kremenek <kremenek@apple.com>2008-04-14 21:04:18 +0000
commit9fd87b1db485e2f31d0e5687f9168b370d546847 (patch)
treed1570b1589af3dbcfcdf2a608350d3a7c81ef3ca /lib/Basic/SourceLocation.cpp
parent70778c85825a00170c8c70ae351252743463d8dd (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49682 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Basic/SourceLocation.cpp')
-rw-r--r--lib/Basic/SourceLocation.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/Basic/SourceLocation.cpp b/lib/Basic/SourceLocation.cpp
index c01447567f..83c264ad0b 100644
--- a/lib/Basic/SourceLocation.cpp
+++ b/lib/Basic/SourceLocation.cpp
@@ -88,3 +88,7 @@ const llvm::MemoryBuffer* FullSourceLoc::getBuffer() const {
assert (isValid());
return SrcMgr->getBuffer(Loc.getFileID());
}
+
+unsigned FullSourceLoc::getCanonicalFileID() const {
+ return SrcMgr->getCanonicalFileID(Loc);
+}