[cfe-commits] r66522 - in /cfe/trunk: include/clang/Basic/SourceLocation.h lib/Basic/SourceLocation.cpp
Ted Kremenek
kremenek at apple.com
Mon Mar 9 22:13:44 PDT 2009
Author: kremenek
Date: Tue Mar 10 00:13:43 2009
New Revision: 66522
URL: http://llvm.org/viewvc/llvm-project?rev=66522&view=rev
Log:
Add FullSourceLoc::getDecomposedLoc.
Modified:
cfe/trunk/include/clang/Basic/SourceLocation.h
cfe/trunk/lib/Basic/SourceLocation.cpp
Modified: cfe/trunk/include/clang/Basic/SourceLocation.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/SourceLocation.h?rev=66522&r1=66521&r2=66522&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/SourceLocation.h (original)
+++ cfe/trunk/include/clang/Basic/SourceLocation.h Tue Mar 10 00:13:43 2009
@@ -216,6 +216,11 @@
/// 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
Modified: cfe/trunk/lib/Basic/SourceLocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/SourceLocation.cpp?rev=66522&r1=66521&r2=66522&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/SourceLocation.cpp (original)
+++ cfe/trunk/lib/Basic/SourceLocation.cpp Tue Mar 10 00:13:43 2009
@@ -142,3 +142,7 @@
const llvm::MemoryBuffer *Buf = getBuffer();
return std::make_pair(Buf->getBufferStart(), Buf->getBufferEnd());
}
+
+std::pair<FileID, unsigned> FullSourceLoc::getDecomposedLoc() const {
+ return SrcMgr->getDecomposedLoc(*this);
+}
More information about the cfe-commits
mailing list