File tree Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -1997,15 +1997,20 @@ StringRef ModuleDecl::getModuleLoadedFilename() const {
19971997}
19981998
19991999bool ModuleDecl::isSDKModule () const {
2000- if (getASTContext ().SearchPathOpts .getSDKPath ().empty ())
2000+ auto sdkPath = getASTContext ().SearchPathOpts .getSDKPath ();
2001+ if (sdkPath.empty ())
20012002 return false ;
20022003
2003- auto sdkPath = SmallString<8 >(),
2004- modulePath = SmallString<8 >();
2005- llvm::sys::path::native (getASTContext ().SearchPathOpts .getSDKPath (), sdkPath);
2006- llvm::sys::path::native (getModuleSourceFilename (), modulePath);
2007-
2008- return modulePath.startswith (sdkPath);
2004+ auto modulePath = getModuleSourceFilename ();
2005+ auto si = llvm::sys::path::begin (sdkPath),
2006+ se = llvm::sys::path::end (sdkPath);
2007+ for (auto mi = llvm::sys::path::begin (modulePath),
2008+ me = llvm::sys::path::end (modulePath);
2009+ si != se && mi != me; ++si, ++mi) {
2010+ if (*si != *mi)
2011+ return false ;
2012+ }
2013+ return si == se;
20092014}
20102015
20112016bool ModuleDecl::isStdlibModule () const {
You can’t perform that action at this time.
0 commit comments