@@ -19,16 +19,22 @@ void ModuleSearchPathLookup::addFilesInPathToLookupTable(
1919 llvm::vfs::FileSystem *FS, StringRef SearchPath, ModuleSearchPathKind Kind,
2020 bool IsSystem, unsigned SearchPathIndex) {
2121 std::error_code Error;
22- assert (llvm::all_of (LookupTable, [&](const auto &LookupTableEntry) {
23- return llvm::none_of (LookupTableEntry.second , [&](const ModuleSearchPath &ExistingSearchPath) -> bool {
24- return ExistingSearchPath.Kind == Kind && ExistingSearchPath.Index == SearchPathIndex;
25- });
26- }) && " Search path with this kind and index already exists" );
22+ assert (llvm::all_of (
23+ LookupTable,
24+ [&](const auto &LookupTableEntry) {
25+ return llvm::none_of (
26+ LookupTableEntry.second ,
27+ [&](const ModuleSearchPath &ExistingSearchPath) -> bool {
28+ return ExistingSearchPath.getKind () == Kind &&
29+ ExistingSearchPath.getIndex () == SearchPathIndex;
30+ });
31+ }) &&
32+ " Search path with this kind and index already exists" );
2733 for (auto Dir = FS->dir_begin (SearchPath, Error);
2834 !Error && Dir != llvm::vfs::directory_iterator (); Dir.increment (Error)) {
2935 StringRef Filename = llvm::sys::path::filename (Dir->path ());
30- LookupTable[Filename].push_back (
31- {SearchPath, Kind, IsSystem, SearchPathIndex} );
36+ LookupTable[Filename].emplace_back (SearchPath, Kind, IsSystem,
37+ SearchPathIndex);
3238 }
3339}
3440
@@ -92,7 +98,8 @@ ModuleSearchPathLookup::searchPathsContainingFile(
9298
9399 for (auto &Filename : Filenames) {
94100 for (auto &Entry : LookupTable[Filename]) {
95- if (ResultIds.insert (std::make_pair (Entry.Kind , Entry.Index )).second ) {
101+ if (ResultIds.insert (std::make_pair (Entry.getKind (), Entry.getIndex ()))
102+ .second ) {
96103 Result.push_back (&Entry);
97104 }
98105 }
0 commit comments