Move decompose from PrettyStackTrace.cpp to the SourceManager

It requires direct access to the SourceLoc internals and is generally useful
anyway.


Swift SVN r7111
This commit is contained in:
Dmitri Hrybenko
2013-08-09 22:50:58 +00:00
parent dc655eb1cb
commit aacef757ed
3 changed files with 35 additions and 22 deletions

View File

@@ -18,6 +18,14 @@
namespace swift {
/// \brief A decomposed representation of a source location, useful for
/// printing diagnostics.
struct DecomposedLoc {
const llvm::MemoryBuffer *Buffer;
unsigned Line;
unsigned Column;
};
/// \brief This class manages and owns source buffers.
class SourceManager {
llvm::SourceMgr LLVMSourceMgr;
@@ -91,6 +99,8 @@ public:
/// \brief Returns the offset in bytes for the given source location.
unsigned getLocOffsetInBuffer(SourceLoc Loc, unsigned BufferID) const;
DecomposedLoc decompose(SourceLoc Loc) const;
};
} // namespace swift