[LLVMbugs] [Bug 10882] New: FileManager::getVirtualFile() fails due to bug in FileManager::addAncestorsAsVirtualDirs()
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Wed Sep 7 07:49:01 PDT 2011
http://llvm.org/bugs/show_bug.cgi?id=10882
Summary: FileManager::getVirtualFile() fails due to bug in
FileManager::addAncestorsAsVirtualDirs()
Product: clang
Version: trunk
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P
Component: Frontend
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: vinay_sajip at yahoo.co.uk
CC: llvmbugs at cs.uiuc.edu
A call to FileManager::getVirtualFile() with a filename such as
"/usr/include/i386._types.h" fails with an assertion error: "The directory of a
virtual file should already be in the cache."
This is because code in the FileManager::addAncestorsAsVirtualDirs() method -
called from FileManager::getVirtualFile() - looks like this:
llvm::StringMapEntry<DirectoryEntry *> &NamedDirEnt =
SeenDirEntries.GetOrCreateValue(DirName);
// When caching a virtual directory, we always cache its ancestors
// at the same time. Therefore, if DirName is already in the cache,
// we don't need to recurse as its ancestors must also already be in
// the cache.
if (NamedDirEnt.getValue())
return;
// continue to set the value and add the directory's ancestors
However, the GetOrCreateValue() call creates an entry with a bogus "tombstone"
value of -1. So, the if test always returns true and causes a premature return.
If the test is changed to
if (NamedDirEnt.getValue() != (DirectoryEntry *)
SeenDirEntries.getTombstoneVal())
return;
all is seemingly well.
See:
https://github.com/vsajip/clang/commit/6958016e54862b1f5bc17a44bffeba8d4df7cb97
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list