mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-29 11:01:57 +00:00
Better error message when getting a unique file id fails.
This commit is contained in:
parent
b04ce0c503
commit
f8f4c06c20
@ -29,7 +29,7 @@ IndexFile* FileConsumer::TryConsumeFile(CXFile file, bool* is_first_ownership) {
|
|||||||
|
|
||||||
CXFileUniqueID file_id;
|
CXFileUniqueID file_id;
|
||||||
if (clang_getFileUniqueID(file, &file_id) != 0) {
|
if (clang_getFileUniqueID(file, &file_id) != 0) {
|
||||||
std::cerr << "Could not get unique file id when parsing " << parse_file_ << std::endl;
|
EmitError(file);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ IndexFile* FileConsumer::ForceLocal(CXFile file) {
|
|||||||
// It's already been taken before, just create a local copy.
|
// It's already been taken before, just create a local copy.
|
||||||
CXFileUniqueID file_id;
|
CXFileUniqueID file_id;
|
||||||
if (clang_getFileUniqueID(file, &file_id) != 0) {
|
if (clang_getFileUniqueID(file, &file_id) != 0) {
|
||||||
std::cerr << "Could not get unique file id for " << FileName(file) << std::endl;
|
EmitError(file);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,3 +81,9 @@ std::vector<std::unique_ptr<IndexFile>> FileConsumer::TakeLocalState() {
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FileConsumer::EmitError(CXFile file) const {
|
||||||
|
std::string file_name = clang::ToString(clang_getFileName(file));
|
||||||
|
std::string error_message = "Could not get unique file id for " + file_name + " when parsing " + parse_file_;
|
||||||
|
std::cerr << error_message << std::endl;
|
||||||
|
}
|
@ -50,6 +50,8 @@ struct FileConsumer {
|
|||||||
std::vector<std::unique_ptr<IndexFile>> TakeLocalState();
|
std::vector<std::unique_ptr<IndexFile>> TakeLocalState();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void EmitError(CXFile file) const;
|
||||||
|
|
||||||
std::unordered_map<CXFileUniqueID, std::unique_ptr<IndexFile>> local_;
|
std::unordered_map<CXFileUniqueID, std::unique_ptr<IndexFile>> local_;
|
||||||
SharedState* shared_;
|
SharedState* shared_;
|
||||||
std::string parse_file_;
|
std::string parse_file_;
|
||||||
|
Loading…
Reference in New Issue
Block a user