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 {
1997
1997
}
1998
1998
1999
1999
bool ModuleDecl::isSDKModule () const {
2000
- if (getASTContext ().SearchPathOpts .getSDKPath ().empty ())
2000
+ auto sdkPath = getASTContext ().SearchPathOpts .getSDKPath ();
2001
+ if (sdkPath.empty ())
2001
2002
return false ;
2002
2003
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;
2009
2014
}
2010
2015
2011
2016
bool ModuleDecl::isStdlibModule () const {
You can’t perform that action at this time.
0 commit comments