fix crash

This commit is contained in:
Jacob Dufault 2017-03-28 23:40:32 -07:00
parent a19d4f732f
commit aef8e9267f
2 changed files with 11 additions and 4 deletions

View File

@ -9,9 +9,9 @@
-IC:/Program Files/LLVM/include -IC:/Program Files/LLVM/include
# Use libcxx # Use libcxx
-stdlib=libc++ #-stdlib=libc++
-nostdinc++ #-nostdinc++
-IC:/Users/jacob/Desktop/superindex/indexer/libcxx/include #-IC:/Users/jacob/Desktop/superindex/indexer/libcxx/include
#-fms-compatibility #-fms-compatibility
#-fdelayed-template-parsing #-fdelayed-template-parsing

View File

@ -113,7 +113,14 @@ QueryableVarDef::DefUpdate MapIdToUsr(const IdCache& id_cache, const VarDefDefin
QueryableFile::QueryableFile(const IndexedFile& indexed) QueryableFile::QueryableFile(const IndexedFile& indexed)
: file_id(indexed.path) { : file_id(indexed.path) {
FileId local_file_id = indexed.id_cache.file_path_to_file_id.find(indexed.path)->second; auto it = indexed.id_cache.file_path_to_file_id.find(indexed.path);
if (it == indexed.id_cache.file_path_to_file_id.end()) {
// TODO: investigate
std::cerr << "Unable to find cached file " << indexed.path << std::endl;
return;
}
FileId local_file_id = it->second;
auto add_outline = [this, &indexed, local_file_id](Usr usr, Location location) { auto add_outline = [this, &indexed, local_file_id](Usr usr, Location location) {
if (location.file_id() == local_file_id) if (location.file_id() == local_file_id)
outline.push_back(UsrRef(usr, MapIdToUsr(indexed.id_cache, location))); outline.push_back(UsrRef(usr, MapIdToUsr(indexed.id_cache, location)));