diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-04-14 21:04:18 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-04-14 21:04:18 +0000 |
commit | 17acadebb493ea4a1227d18a87abf8a56953b205 (patch) | |
tree | 8ef10f54ea82ccf3d382f5f45b67e9fdfe1e49e7 /clang/lib/Basic/SourceLocation.cpp | |
parent | 4fff979a434199b1f842fb04f4c5faf5390fffda (diff) | |
download | bcm5719-llvm-17acadebb493ea4a1227d18a87abf8a56953b205.tar.gz bcm5719-llvm-17acadebb493ea4a1227d18a87abf8a56953b205.zip |
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
Diffstat (limited to 'clang/lib/Basic/SourceLocation.cpp')
-rw-r--r-- | clang/lib/Basic/SourceLocation.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/Basic/SourceLocation.cpp b/clang/lib/Basic/SourceLocation.cpp index c01447567fb..83c264ad0b0 100644 --- a/clang/lib/Basic/SourceLocation.cpp +++ b/clang/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); +} |