From 51c2351d30ac2f2126ed0ea2d7b70bc27d7bf140 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Fri, 19 Mar 2010 06:12:06 +0000 Subject: Fix a longstanding (but previously unknown) bug in the lazy deserialization of precompiled headers, where the deserialization of the source location entry for a buffer (e.g., macro instantiation scratch space) would overwrite a one-element FileID cache in the source manager. When tickled at the wrong time, we would return the wrong decomposed source location and eventually cause c-index-test to crash. Found by dumb luck. It's amazing this hasn't shown up before. llvm-svn: 98940 --- clang/lib/Basic/SourceManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'clang/lib/Basic/SourceManager.cpp') diff --git a/clang/lib/Basic/SourceManager.cpp b/clang/lib/Basic/SourceManager.cpp index 4c24d030b87..6def967c4cf 100644 --- a/clang/lib/Basic/SourceManager.cpp +++ b/clang/lib/Basic/SourceManager.cpp @@ -411,7 +411,7 @@ FileID SourceManager::createFileID(const ContentCache *File, = SLocEntry::get(Offset, FileInfo::get(IncludePos, File, FileCharacter)); SLocEntryLoaded[PreallocatedID] = true; FileID FID = FileID::get(PreallocatedID); - return LastFileIDLookup = FID; + return FID; } SLocEntryTable.push_back(SLocEntry::get(NextOffset, -- cgit v1.2.3