From owner-svn-src-all@freebsd.org Sun Jul 30 11:50:18 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 209ABDB56DB; Sun, 30 Jul 2017 11:50:18 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E366E6E45E; Sun, 30 Jul 2017 11:50:17 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6UBoH7v015949; Sun, 30 Jul 2017 11:50:17 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6UBoHBN015948; Sun, 30 Jul 2017 11:50:17 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201707301150.v6UBoHBN015948@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 30 Jul 2017 11:50:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321719 - head/contrib/llvm/tools/clang/lib/Lex X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: head/contrib/llvm/tools/clang/lib/Lex X-SVN-Commit-Revision: 321719 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Jul 2017 11:50:18 -0000 Author: dim Date: Sun Jul 30 11:50:16 2017 New Revision: 321719 URL: https://svnweb.freebsd.org/changeset/base/321719 Log: Pull in r309503 from upstream clang trunk (by Richard Smith): PR33902: Invalidate line number cache when adding more text to existing buffer. This led to crashes as the line number cache would report a bogus line number for a line of code, and we'd try to find a nonexistent column within the line when printing diagnostics. This fixes an assertion when building the graphics/champlain port. Reported by: antoine, kwm PR: 219139 Modified: head/contrib/llvm/tools/clang/lib/Lex/ScratchBuffer.cpp Modified: head/contrib/llvm/tools/clang/lib/Lex/ScratchBuffer.cpp ============================================================================== --- head/contrib/llvm/tools/clang/lib/Lex/ScratchBuffer.cpp Sun Jul 30 10:49:13 2017 (r321718) +++ head/contrib/llvm/tools/clang/lib/Lex/ScratchBuffer.cpp Sun Jul 30 11:50:16 2017 (r321719) @@ -35,6 +35,14 @@ SourceLocation ScratchBuffer::getToken(const char *Buf const char *&DestPtr) { if (BytesUsed+Len+2 > ScratchBufSize) AllocScratchBuffer(Len+2); + else { + // Clear out the source line cache if it's already been computed. + // FIXME: Allow this to be incrementally extended. + auto *ContentCache = const_cast( + SourceMgr.getSLocEntry(SourceMgr.getFileID(BufferStartLoc)) + .getFile().getContentCache()); + ContentCache->SourceLineCache = nullptr; + } // Prefix the token with a \n, so that it looks like it is the first thing on // its own virtual line in caret diagnostics.