For PR351: \

* Get file information from a MappedFile instance \
* Convert file type tests to sys::Path form


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18854 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Reid Spencer
2004-12-13 02:59:15 +00:00
parent 5af46883f2
commit 663601cca6
2 changed files with 17 additions and 49 deletions

View File

@ -170,11 +170,16 @@ SourceFileInfo::~SourceFileInfo() {
SourceFile &SourceFileInfo::getSourceText() const {
// FIXME: this should take into account the source search directories!
if (SourceText == 0) // Read the file in if we haven't already.
if (!Directory.empty() && FileOpenable(Directory+"/"+BaseName))
SourceText = new SourceFile(Directory+"/"+BaseName, Descriptor);
if (SourceText == 0) { // Read the file in if we haven't already.
sys::Path tmpPath;
if (!Directory.empty())
tmpPath.setDirectory(Directory);
tmpPath.appendFile(BaseName);
if (tmpPath.readable())
SourceText = new SourceFile(tmpPath.toString(), Descriptor);
else
SourceText = new SourceFile(BaseName, Descriptor);
}
return *SourceText;
}