diff --git a/clang/lib/Rewrite/Rewriter.cpp b/clang/lib/Rewrite/Rewriter.cpp index bea7c00352d2..e1a6651a9aea 100644 --- a/clang/lib/Rewrite/Rewriter.cpp +++ b/clang/lib/Rewrite/Rewriter.cpp @@ -100,6 +100,7 @@ int Rewriter::getRangeSize(SourceRange Range) const { unsigned Rewriter::getLocationOffsetAndFileID(SourceLocation Loc, unsigned &FileID) const { + assert(Loc.isValid() && "Invalid location"); std::pair V = SourceMgr->getDecomposedFileLoc(Loc); FileID = V.first; return V.second;