]> granicus.if.org Git - clang/commitdiff
Add FullSourceLoc::getDecomposedLoc.
authorTed Kremenek <kremenek@apple.com>
Tue, 10 Mar 2009 05:13:43 +0000 (05:13 +0000)
committerTed Kremenek <kremenek@apple.com>
Tue, 10 Mar 2009 05:13:43 +0000 (05:13 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66522 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/SourceLocation.h
lib/Basic/SourceLocation.cpp

index b5906e1393b83d1e337993145efd59960602890f..ba0bb6faac52c85a9d9426f7f700ec09a6750728 100644 (file)
@@ -216,6 +216,11 @@ public:
   /// data for the specified FileID.
   std::pair<const char*, const char*> getBufferData() const;
   
+  /// getDecomposedLoc - Decompose the specified location into a raw FileID +
+  /// Offset pair.  The first element is the FileID, the second is the
+  /// offset from the start of the buffer of the location.
+  std::pair<FileID, unsigned> getDecomposedLoc() const;
+
   bool isInSystemHeader() const;
   
   /// Prints information about this FullSourceLoc to stderr. Useful for
index fd90b5a2ce99dbe4e4fc0ce083adf7bc839741b5..dc1dceb7248c347306916973763f47d343f59089 100644 (file)
@@ -142,3 +142,7 @@ std::pair<const char*, const char*> FullSourceLoc::getBufferData() const {
   const llvm::MemoryBuffer *Buf = getBuffer();
   return std::make_pair(Buf->getBufferStart(), Buf->getBufferEnd());
 }
+
+std::pair<FileID, unsigned> FullSourceLoc::getDecomposedLoc() const {
+  return SrcMgr->getDecomposedLoc(*this);
+}