From 321abd4583dc02a254489132c5ccbe125d18ce4f Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Tue, 10 Mar 2009 05:13:43 +0000 Subject: [PATCH] Add FullSourceLoc::getDecomposedLoc. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66522 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Basic/SourceLocation.h | 5 +++++ lib/Basic/SourceLocation.cpp | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/include/clang/Basic/SourceLocation.h b/include/clang/Basic/SourceLocation.h index b5906e1393..ba0bb6faac 100644 --- a/include/clang/Basic/SourceLocation.h +++ b/include/clang/Basic/SourceLocation.h @@ -216,6 +216,11 @@ public: /// data for the specified FileID. std::pair 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 getDecomposedLoc() const; + bool isInSystemHeader() const; /// Prints information about this FullSourceLoc to stderr. Useful for diff --git a/lib/Basic/SourceLocation.cpp b/lib/Basic/SourceLocation.cpp index fd90b5a2ce..dc1dceb724 100644 --- a/lib/Basic/SourceLocation.cpp +++ b/lib/Basic/SourceLocation.cpp @@ -142,3 +142,7 @@ std::pair FullSourceLoc::getBufferData() const { const llvm::MemoryBuffer *Buf = getBuffer(); return std::make_pair(Buf->getBufferStart(), Buf->getBufferEnd()); } + +std::pair FullSourceLoc::getDecomposedLoc() const { + return SrcMgr->getDecomposedLoc(*this); +} -- 2.50.1