diff options
-rw-r--r-- | include/clang/Basic/FileManager.h | 8 | ||||
-rw-r--r-- | include/clang/Frontend/ASTUnit.h | 3 | ||||
-rw-r--r-- | lib/Basic/FileManager.cpp | 8 | ||||
-rw-r--r-- | lib/Basic/SourceManager.cpp | 18 | ||||
-rw-r--r-- | lib/Frontend/ASTUnit.cpp | 5 |
5 files changed, 13 insertions, 29 deletions
diff --git a/include/clang/Basic/FileManager.h b/include/clang/Basic/FileManager.h index 3ee7d40c1e..77eb1f4d1e 100644 --- a/include/clang/Basic/FileManager.h +++ b/include/clang/Basic/FileManager.h @@ -216,16 +216,14 @@ public: /// MemoryBuffer if successful, otherwise returning null. llvm::MemoryBuffer *getBufferForFile(const FileEntry *Entry, const FileSystemOptions &FileSystemOpts, - std::string *ErrorStr = 0, - struct stat *FileInfo = 0) { + std::string *ErrorStr = 0) { return getBufferForFile(Entry->getName(), FileSystemOpts, - ErrorStr, Entry->getSize(), FileInfo); + ErrorStr, Entry->getSize()); } llvm::MemoryBuffer *getBufferForFile(llvm::StringRef Filename, const FileSystemOptions &FileSystemOpts, std::string *ErrorStr = 0, - int64_t FileSize = -1, - struct stat *FileInfo = 0); + int64_t FileSize = -1); /// \brief If path is not absolute and FileSystemOptions set the working /// directory, the path is modified to be relative to the given diff --git a/include/clang/Frontend/ASTUnit.h b/include/clang/Frontend/ASTUnit.h index 559c8c5e07..b6398f7926 100644 --- a/include/clang/Frontend/ASTUnit.h +++ b/include/clang/Frontend/ASTUnit.h @@ -463,8 +463,7 @@ public: llvm::MemoryBuffer *getBufferForFile(llvm::StringRef Filename, std::string *ErrorStr = 0, - int64_t FileSize = -1, - struct stat *FileInfo = 0); + int64_t FileSize = -1); /// \brief Whether this AST represents a complete translation unit. /// diff --git a/lib/Basic/FileManager.cpp b/lib/Basic/FileManager.cpp index e5ec545f16..c8515a356b 100644 --- a/lib/Basic/FileManager.cpp +++ b/lib/Basic/FileManager.cpp @@ -399,15 +399,13 @@ void FileManager::FixupRelativePath(llvm::sys::Path &path, llvm::MemoryBuffer *FileManager:: getBufferForFile(llvm::StringRef Filename, const FileSystemOptions &FileSystemOpts, - std::string *ErrorStr, int64_t FileSize, - struct stat *FileInfo) { + std::string *ErrorStr, int64_t FileSize) { if (FileSystemOpts.WorkingDir.empty()) - return llvm::MemoryBuffer::getFile(Filename, ErrorStr, FileSize, FileInfo); + return llvm::MemoryBuffer::getFile(Filename, ErrorStr, FileSize); llvm::sys::Path FilePath(Filename); FixupRelativePath(FilePath, FileSystemOpts); - return llvm::MemoryBuffer::getFile(FilePath.c_str(), ErrorStr, - FileSize, FileInfo); + return llvm::MemoryBuffer::getFile(FilePath.c_str(), ErrorStr, FileSize); } int FileManager::stat_cached(const char *path, struct stat *buf, diff --git a/lib/Basic/SourceManager.cpp b/lib/Basic/SourceManager.cpp index 4fa7d1d879..2e47cdc275 100644 --- a/lib/Basic/SourceManager.cpp +++ b/lib/Basic/SourceManager.cpp @@ -73,10 +73,9 @@ const llvm::MemoryBuffer *ContentCache::getBuffer(Diagnostic &Diag, // Lazily create the Buffer for ContentCaches that wrap files. if (!Buffer.getPointer() && Entry) { std::string ErrorStr; - struct stat FileInfo; Buffer.setPointer(SM.getFileManager().getBufferForFile(Entry, SM.getFileSystemOpts(), - &ErrorStr, &FileInfo)); + &ErrorStr)); // If we were unable to open the file, then we are in an inconsistent // situation where the content cache referenced a file which no longer @@ -105,17 +104,9 @@ const llvm::MemoryBuffer *ContentCache::getBuffer(Diagnostic &Diag, Buffer.setInt(Buffer.getInt() | InvalidFlag); - // FIXME: This conditionalization is horrible, but we see spurious failures - // in the test suite due to this warning and no one has had time to hunt it - // down. So for now, we just don't emit this diagnostic on Win32, and hope - // nothing bad happens. - // - // PR6812. -#if !defined(LLVM_ON_WIN32) - } else if (FileInfo.st_size != Entry->getSize() || - FileInfo.st_mtime != Entry->getModificationTime()) { - // Check that the file's size and modification time are the same - // as in the file entry (which may have come from a stat cache). + } else if (getRawBuffer()->getBufferSize() != (size_t)Entry->getSize()) { + // Check that the file's size is the same as in the file entry (which may + // have come from a stat cache). if (Diag.isDiagnosticInFlight()) Diag.SetDelayedDiagnostic(diag::err_file_modified, Entry->getName()); @@ -124,7 +115,6 @@ const llvm::MemoryBuffer *ContentCache::getBuffer(Diagnostic &Diag, << Entry->getName(); Buffer.setInt(Buffer.getInt() | InvalidFlag); -#endif } // If the buffer is valid, check to see if it has a UTF Byte Order Mark diff --git a/lib/Frontend/ASTUnit.cpp b/lib/Frontend/ASTUnit.cpp index 3956cc23e3..d590d6966f 100644 --- a/lib/Frontend/ASTUnit.cpp +++ b/lib/Frontend/ASTUnit.cpp @@ -457,10 +457,9 @@ const std::string &ASTUnit::getASTFileName() { llvm::MemoryBuffer *ASTUnit::getBufferForFile(llvm::StringRef Filename, std::string *ErrorStr, - int64_t FileSize, - struct stat *FileInfo) { + int64_t FileSize) { return FileMgr->getBufferForFile(Filename, FileSystemOpts, - ErrorStr, FileSize, FileInfo); + ErrorStr, FileSize); } /// \brief Configure the diagnostics object for use with ASTUnit. |