mirror of
https://github.com/MaskRay/ccls.git
synced 2025-02-07 17:32:14 +00:00
Do not import empty dependencies
This commit is contained in:
parent
3ab4d0455d
commit
7faedfdf00
@ -120,22 +120,25 @@ IndexFile* ConsumeFile(IndexParam* param, CXFile file) {
|
|||||||
// generating an index for it):
|
// generating an index for it):
|
||||||
if (param->seen_cx_files.insert(file).second) {
|
if (param->seen_cx_files.insert(file).second) {
|
||||||
std::string file_name = FileName(file);
|
std::string file_name = FileName(file);
|
||||||
|
// Sometimes the fill name will be empty. Not sure why. Not much we can do
|
||||||
|
// with it.
|
||||||
|
if (!file_name.empty()) {
|
||||||
|
// Add to all files we have seen so we can generate proper dependency
|
||||||
|
// graph.
|
||||||
|
param->seen_files.push_back(file_name);
|
||||||
|
|
||||||
// Add to all files we have seen so we can generate proper dependency
|
// Set modification time.
|
||||||
// graph.
|
param->file_modification_times[file_name] = GetLastModificationTime(file_name);
|
||||||
param->seen_files.push_back(file_name);
|
|
||||||
|
|
||||||
// Set modification time.
|
// Capture file contents in |param->file_contents| if it was not specified
|
||||||
param->file_modification_times[file_name] = GetLastModificationTime(file_name);
|
// at the start of indexing.
|
||||||
|
if (db && param->file_contents.find(file_name) == param->file_contents.end()) {
|
||||||
// Capture file contents in |param->file_contents| if it was not specified
|
optional<std::string> content = ReadContent(file_name);
|
||||||
// at the start of indexing.
|
if (content)
|
||||||
if (db && param->file_contents.find(file_name) == param->file_contents.end()) {
|
param->file_contents[file_name] = *content;
|
||||||
optional<std::string> content = ReadContent(file_name);
|
else
|
||||||
if (content)
|
LOG_S(ERROR) << "[indexer] Failed to read file content for " << file_name;
|
||||||
param->file_contents[file_name] = *content;
|
}
|
||||||
else
|
|
||||||
LOG_S(ERROR) << "[indexer] Failed to read file content for " << file_name;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user