mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-22 15:45:08 +00:00
Handle error condition instead of asserting, since it is occassionaly hit.
This needs to be debugged later.
This commit is contained in:
parent
6b0c3831fa
commit
87394de1cf
11
src/cache.cc
11
src/cache.cc
@ -4,7 +4,6 @@
|
|||||||
#include "language_server_api.h"
|
#include "language_server_api.h"
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
|
|
||||||
|
|
||||||
#include <loguru/loguru.hpp>
|
#include <loguru/loguru.hpp>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
@ -51,15 +50,17 @@ void WriteToCache(Config* config, IndexFile& file) {
|
|||||||
std::string cache_basename =
|
std::string cache_basename =
|
||||||
GetCachedBaseFileName(config->cacheDirectory, file.path);
|
GetCachedBaseFileName(config->cacheDirectory, file.path);
|
||||||
|
|
||||||
LOG_IF_S(ERROR, file.file_contents_.empty())
|
if (file.file_contents_.empty()) {
|
||||||
<< "Writing " << file.path << " to cache but it has no contents";
|
LOG_S(ERROR) << "No cached file contents; performing potentially stale "
|
||||||
|
<< "file-copy for " << file.path;
|
||||||
assert(!file.file_contents_.empty());
|
CopyFileTo(cache_basename, file.path);
|
||||||
|
} else {
|
||||||
std::ofstream cache_content;
|
std::ofstream cache_content;
|
||||||
cache_content.open(cache_basename);
|
cache_content.open(cache_basename);
|
||||||
assert(cache_content.good());
|
assert(cache_content.good());
|
||||||
cache_content << file.file_contents_;
|
cache_content << file.file_contents_;
|
||||||
cache_content.close();
|
cache_content.close();
|
||||||
|
}
|
||||||
|
|
||||||
std::string indexed_content = Serialize(file);
|
std::string indexed_content = Serialize(file);
|
||||||
std::ofstream cache;
|
std::ofstream cache;
|
||||||
|
Loading…
Reference in New Issue
Block a user