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

@@ -22,7 +22,6 @@
#include "swift/SIL/SILValue.h"
#include "swift/SIL/SILVisitor.h"
#include "swift/Serialization/SerializedSILLoader.h"
#include "swift/Strings.h"
#include "llvm/ADT/FoldingSet.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/Statistic.h"
@@ -634,14 +633,10 @@ shouldSerializeEntitiesAssociatedWithDeclContext(const DeclContext *DC) const {
return false;
}
/// Returns true if it is the OnoneSupport module.
bool SILModule::isOnoneSupportModule() const {
return getSwiftModule()->getName().str() == SWIFT_ONONE_SUPPORT;
}
/// Returns true if it is the optimized OnoneSupport module.
bool SILModule::isOptimizedOnoneSupportModule() const {
return getOptions().shouldOptimize() && isOnoneSupportModule();
return getOptions().shouldOptimize() &&
getSwiftModule()->isOnoneSupportModule();
}
void SILModule::setSerializeSILAction(SILModule::ActionCallback Action) {