diff options
author | Douglas Gregor <dgregor@apple.com> | 2012-08-13 15:47:39 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2012-08-13 15:47:39 +0000 |
commit | 21efbb606fe905b0f5a479b7b3e6d79023cb82ee (patch) | |
tree | d22a33ae9164cc9f072a7c200e25614274c91016 /lib/Lex/HeaderSearch.cpp | |
parent | 4846470d20348f2e7b1f6cf6c68f81fc0657d129 (diff) |
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 <rdar://problem/11261291>.
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
Diffstat (limited to 'lib/Lex/HeaderSearch.cpp')
-rw-r--r-- | lib/Lex/HeaderSearch.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
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(); |