summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/HeaderSearch.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2012-08-13 15:47:39 +0000
committerDouglas Gregor <dgregor@apple.com>2012-08-13 15:47:39 +0000
commit03b5ebe4cba92501e3d54c1d6b6d83ead9363915 (patch)
tree32f9db01372db7f01885e5deca5818ebfc38f3e3 /clang/lib/Lex/HeaderSearch.cpp
parent402685a881fb590beab809307c9a86acfb3838e8 (diff)
downloadbcm5719-llvm-03b5ebe4cba92501e3d54c1d6b6d83ead9363915.tar.gz
bcm5719-llvm-03b5ebe4cba92501e3d54c1d6b6d83ead9363915.zip
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. llvm-svn: 161759
Diffstat (limited to 'clang/lib/Lex/HeaderSearch.cpp')
-rw-r--r--clang/lib/Lex/HeaderSearch.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/clang/lib/Lex/HeaderSearch.cpp b/clang/lib/Lex/HeaderSearch.cpp
index a75c45e227d..bb3a67378ad 100644
--- a/clang/lib/Lex/HeaderSearch.cpp
+++ b/clang/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();
OpenPOWER on IntegriCloud