From: Nico Weber Date: Sat, 9 Aug 2008 22:13:42 +0000 (+0000) Subject: add assert, use make_pair() instead of pair constructor X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b243fe5a812faddf9ec39525727739a85f603ae6;p=clang add assert, use make_pair() instead of pair constructor git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54596 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Basic/SourceManager.h b/include/clang/Basic/SourceManager.h index 425c3b08b2..7cb1f4c4ba 100644 --- a/include/clang/Basic/SourceManager.h +++ b/include/clang/Basic/SourceManager.h @@ -396,8 +396,10 @@ public: unsigned ChunkNo = FIDInfo->getChunkNo(); unsigned Offset = Loc.getRawFilePos(); Offset += (ChunkNo << SourceLocation::FilePosBits); + + assert(Loc.getFileID() >= ChunkNo && "Unexpected offset"); - return std::pair(Loc.getFileID()-ChunkNo, Offset); + return std::make_pair(Loc.getFileID()-ChunkNo, Offset); } /// getFullFilePos - This (efficient) method returns the offset from the start