diff options
author | Ben Langmuir <blangmuir@apple.com> | 2014-05-23 18:15:47 +0000 |
---|---|---|
committer | Ben Langmuir <blangmuir@apple.com> | 2014-05-23 18:15:47 +0000 |
commit | 5de00f3b56805c7e980f049ceb3f166f8c69cec0 (patch) | |
tree | 1ae1c0ee9e452f85526ef0334ecd4b115b315c0b /clang/lib/Basic/VirtualFileSystem.cpp | |
parent | 8651081bbe4b8e798a06b4e5b429098b58a1435d (diff) | |
download | llvm-5de00f3b56805c7e980f049ceb3f166f8c69cec0.zip llvm-5de00f3b56805c7e980f049ceb3f166f8c69cec0.tar.gz llvm-5de00f3b56805c7e980f049ceb3f166f8c69cec0.tar.bz2 |
Stopgap fix for finding module for a file mapped in the VFS
If we lookup a path using its 'real' path first, we need to ensure that
when we run header search we still use the VFS-mapped path or we will
not be able to find the corresponding module for the header.
The real problem is that we tie the name of a file to its underlying
FileEntry, which is uniqued by inode, so we only ever get the first name
it is looked up by. This doesn't work with modules, which rely on a
specific file system structure. I'm hoping to have time to write up a
proposal for fixing this more permanently soon, but as a stopgap this
patch updates the name of the file's directory if it comes from a VFS
mapping.
llvm-svn: 209534
Diffstat (limited to 'clang/lib/Basic/VirtualFileSystem.cpp')
-rw-r--r-- | clang/lib/Basic/VirtualFileSystem.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/clang/lib/Basic/VirtualFileSystem.cpp b/clang/lib/Basic/VirtualFileSystem.cpp index c89b071..a469c9a 100644 --- a/clang/lib/Basic/VirtualFileSystem.cpp +++ b/clang/lib/Basic/VirtualFileSystem.cpp @@ -31,13 +31,13 @@ using llvm::sys::fs::UniqueID; Status::Status(const file_status &Status) : UID(Status.getUniqueID()), MTime(Status.getLastModificationTime()), User(Status.getUser()), Group(Status.getGroup()), Size(Status.getSize()), - Type(Status.type()), Perms(Status.permissions()) {} + Type(Status.type()), Perms(Status.permissions()), IsVFSMapped(false) {} Status::Status(StringRef Name, StringRef ExternalName, UniqueID UID, sys::TimeValue MTime, uint32_t User, uint32_t Group, uint64_t Size, file_type Type, perms Perms) : Name(Name), UID(UID), MTime(MTime), User(User), Group(Group), Size(Size), - Type(Type), Perms(Perms) {} + Type(Type), Perms(Perms), IsVFSMapped(false) {} bool Status::equivalent(const Status &Other) const { return getUniqueID() == Other.getUniqueID(); @@ -801,6 +801,8 @@ ErrorOr<Status> VFSFromYAML::status(const Twine &Path) { assert(!S || S->getName() == F->getExternalContentsPath()); if (S && !F->useExternalName(UseExternalNames)) S->setName(PathStr); + if (S) + S->IsVFSMapped = true; return S; } else { // directory DirectoryEntry *DE = cast<DirectoryEntry>(*Result); |