This revision was automatically updated to reflect the committed changes. Closed by commit rC360122: [Tooling] Don't mmap the JSONCompilationDatabase, it's not correct for long… (authored by sammccall, committed by ).
Changed prior to commit: https://reviews.llvm.org/D61631?vs=198408&id=198414#toc Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61631/new/ https://reviews.llvm.org/D61631 Files: lib/Tooling/JSONCompilationDatabase.cpp Index: lib/Tooling/JSONCompilationDatabase.cpp =================================================================== --- lib/Tooling/JSONCompilationDatabase.cpp +++ lib/Tooling/JSONCompilationDatabase.cpp @@ -190,8 +190,11 @@ JSONCompilationDatabase::loadFromFile(StringRef FilePath, std::string &ErrorMessage, JSONCommandLineSyntax Syntax) { + // Don't mmap: if we're a long-lived process, the build system may overwrite. llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> DatabaseBuffer = - llvm::MemoryBuffer::getFile(FilePath); + llvm::MemoryBuffer::getFile(FilePath, /*FileSize=*/-1, + /*RequiresNullTerminator=*/true, + /*IsVolatile=*/true); if (std::error_code Result = DatabaseBuffer.getError()) { ErrorMessage = "Error while opening JSON database: " + Result.message(); return nullptr;
Index: lib/Tooling/JSONCompilationDatabase.cpp =================================================================== --- lib/Tooling/JSONCompilationDatabase.cpp +++ lib/Tooling/JSONCompilationDatabase.cpp @@ -190,8 +190,11 @@ JSONCompilationDatabase::loadFromFile(StringRef FilePath, std::string &ErrorMessage, JSONCommandLineSyntax Syntax) { + // Don't mmap: if we're a long-lived process, the build system may overwrite. llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> DatabaseBuffer = - llvm::MemoryBuffer::getFile(FilePath); + llvm::MemoryBuffer::getFile(FilePath, /*FileSize=*/-1, + /*RequiresNullTerminator=*/true, + /*IsVolatile=*/true); if (std::error_code Result = DatabaseBuffer.getError()) { ErrorMessage = "Error while opening JSON database: " + Result.message(); return nullptr;
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits