From 77eafd940a2fcbecbd82e1a649b7f081cb4a3d4a Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 5 May 2012 22:17:32 +0000 Subject: reapply my patch, with a fix for an off-by-one error. Turned out to be a lot of work for a drive-by fix :) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156246 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Support/SourceMgr.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'include/llvm/Support/SourceMgr.h') diff --git a/include/llvm/Support/SourceMgr.h b/include/llvm/Support/SourceMgr.h index 76967dbf78..f108f732b8 100644 --- a/include/llvm/Support/SourceMgr.h +++ b/include/llvm/Support/SourceMgr.h @@ -123,7 +123,14 @@ public: /// FindLineNumber - Find the line number for the specified location in the /// specified file. This is not a fast method. - unsigned FindLineNumber(SMLoc Loc, int BufferID = -1) const; + unsigned FindLineNumber(SMLoc Loc, int BufferID = -1) const { + return getLineAndColumn(Loc, BufferID).first; + } + + /// getLineAndColumn - Find the line and column number for the specified + /// location in the specified file. This is not a fast method. + std::pair + getLineAndColumn(SMLoc Loc, int BufferID = -1) const; /// PrintMessage - Emit a message about the specified location with the /// specified string. -- cgit v1.2.3-18-g5258