From: Douglas Gregor Date: Mon, 13 Aug 2012 15:47:39 +0000 (+0000) Subject: When the header file search resolves a quoted include to a file in the X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=21efbb606fe905b0f5a479b7b3e6d79023cb82ee;p=clang When the header file search resolves a quoted include to a file in the current directory, propagate the framework and in-index-header-map from the including header's information down to the included header's information. Fixes . As with everything header-map related, we can't really test this in isolation within Clang, so it's tested elsewhere. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161759 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Lex/HeaderSearch.cpp b/lib/Lex/HeaderSearch.cpp index a75c45e227..bb3a67378a 100644 --- a/lib/Lex/HeaderSearch.cpp +++ b/lib/Lex/HeaderSearch.cpp @@ -442,11 +442,19 @@ const FileEntry *HeaderSearch::LookupFile( // Leave CurDir unset. // This file is a system header or C++ unfriendly if the old file is. // - // Note that the temporary 'DirInfo' is required here, as either call to - // getFileInfo could resize the vector and we don't want to rely on order - // of evaluation. - unsigned DirInfo = getFileInfo(CurFileEnt).DirInfo; - getFileInfo(FE).DirInfo = DirInfo; + // Note that we only use one of FromHFI/ToHFI at once, due to potential + // reallocation of the underlying vector potentially making the first + // reference binding dangling. + HeaderFileInfo &FromHFI = getFileInfo(CurFileEnt); + unsigned DirInfo = FromHFI.DirInfo; + bool IndexHeaderMapHeader = FromHFI.IndexHeaderMapHeader; + StringRef Framework = FromHFI.Framework; + + HeaderFileInfo &ToHFI = getFileInfo(FE); + ToHFI.DirInfo = DirInfo; + ToHFI.IndexHeaderMapHeader = IndexHeaderMapHeader; + ToHFI.Framework = Framework; + if (SearchPath != NULL) { StringRef SearchPathRef(CurFileEnt->getDir()->getName()); SearchPath->clear();