SourceManager: emphasize that some APIs accept only valid SourceLocations

Adding these asserts would help debugging.  Without the asserts it would fail
anyway, but in a more obscure place, usually with a null pointer dereference.


Swift SVN r14512
This commit is contained in:
Dmitri Hrybenko
2014-02-28 10:58:17 +00:00
parent 88b6efcc43
commit b71d4c5a2c
2 changed files with 6 additions and 2 deletions

View File

@@ -111,10 +111,11 @@ public:
/// might point at whitespace or comment.
SourceLoc getLocForBufferStart(unsigned BufferID) const;
/// \brief Returns the offset in bytes for the given source location.
/// \brief Returns the offset in bytes for the given valid source location.
unsigned getLocOffsetInBuffer(SourceLoc Loc, unsigned BufferID) const;
/// \brief Returns the distance in bytes between the given source locations.
/// \brief Returns the distance in bytes between the given valid source
/// locations.
unsigned getByteDistance(SourceLoc Start, SourceLoc End) const;
/// Returns the SourceLoc for the byte offset in the specified buffer.