mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-03 11:23:58 +00:00
[clangd] IncludeCleaner: Stop crashing when included file is not found
This commit is contained in:
parent
71fd5a735e
commit
6393c21d47
@ -161,7 +161,10 @@ getUnused(const IncludeStructure &Structure,
|
||||
std::vector<const Inclusion *> Unused;
|
||||
for (const Inclusion &MFI : Structure.MainFileIncludes) {
|
||||
// FIXME: Skip includes that are not self-contained.
|
||||
assert(MFI.HeaderID);
|
||||
if (!MFI.HeaderID) {
|
||||
elog("File {0} not found.", MFI.Written);
|
||||
continue;
|
||||
}
|
||||
auto IncludeID = static_cast<IncludeStructure::HeaderID>(*MFI.HeaderID);
|
||||
if (!ReferencedFiles.contains(IncludeID)) {
|
||||
Unused.push_back(&MFI);
|
||||
|
Loading…
Reference in New Issue
Block a user