@@ -1173,17 +1173,18 @@ ClangImporter::create(ASTContext &ctx, const ClangImporterOptions &importerOpts,
1173
1173
bool ClangImporter::addSearchPath (StringRef newSearchPath, bool isFramework,
1174
1174
bool isSystem) {
1175
1175
clang::FileManager &fileMgr = Impl.Instance ->getFileManager ();
1176
- auto entry = fileMgr.getDirectory (newSearchPath);
1177
- if (!entry )
1176
+ auto optionalEntry = fileMgr.getOptionalDirectoryRef (newSearchPath);
1177
+ if (!optionalEntry )
1178
1178
return true ;
1179
+ auto entry = *optionalEntry;
1179
1180
1180
1181
auto &headerSearchInfo = Impl.getClangPreprocessor ().getHeaderSearchInfo ();
1181
1182
auto exists = std::any_of (headerSearchInfo.search_dir_begin (),
1182
1183
headerSearchInfo.search_dir_end (),
1183
1184
[&](const clang::DirectoryLookup &lookup) -> bool {
1184
1185
if (isFramework)
1185
- return lookup.getFrameworkDir () == * entry;
1186
- return lookup.getDir () == * entry;
1186
+ return lookup.getFrameworkDir () == & entry. getDirEntry () ;
1187
+ return lookup.getDir () == & entry. getDirEntry () ;
1187
1188
});
1188
1189
if (exists) {
1189
1190
// Don't bother adding a search path that's already there. Clang would have
@@ -1192,7 +1193,7 @@ bool ClangImporter::addSearchPath(StringRef newSearchPath, bool isFramework,
1192
1193
}
1193
1194
1194
1195
auto kind = isSystem ? clang::SrcMgr::C_System : clang::SrcMgr::C_User;
1195
- headerSearchInfo.AddSearchPath ({* entry, kind, isFramework},
1196
+ headerSearchInfo.AddSearchPath ({entry, kind, isFramework},
1196
1197
/* isAngled=*/ true );
1197
1198
1198
1199
// In addition to changing the current preprocessor directly, we still need
0 commit comments