Add ModuleDecl::isOnoneSupportModule, and use it

A few places around the compiler were checking for this module by its
name. The implementation still checks by name, but at least that only
has to occur in one place.

(Unfortunately I can't eliminate the string constant altogether,
because the implicit import for SwiftOnoneSupport happens by name.)

No functionality change.
This commit is contained in:
Jordan Rose
2018-09-06 15:54:39 -07:00
parent 35602c4d29
commit 737a405596
7 changed files with 17 additions and 19 deletions

View File

@@ -36,6 +36,7 @@
#include "swift/Basic/SourceManager.h"
#include "swift/Basic/Statistic.h"
#include "swift/Parse/Token.h"
#include "swift/Strings.h"
#include "swift/Syntax/SyntaxNodes.h"
#include "clang/Basic/Module.h"
#include "llvm/ADT/DenseMap.h"
@@ -1034,6 +1035,10 @@ bool ModuleDecl::isSwiftShimsModule() const {
return !getParent() && getName() == getASTContext().SwiftShimsModuleName;
}
bool ModuleDecl::isOnoneSupportModule() const {
return !getParent() && getName().str() == SWIFT_ONONE_SUPPORT;
}
bool ModuleDecl::isBuiltinModule() const {
return this == getASTContext().TheBuiltinModule;
}