mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Add -verify-all-substitution-maps frontend flag
This commit is contained in:
@@ -322,6 +322,9 @@ namespace swift {
|
||||
/// `@differentiable` declaration attribute, etc.
|
||||
bool EnableExperimentalDifferentiableProgramming = false;
|
||||
|
||||
/// Enable verification when every SubstitutionMap is constructed.
|
||||
bool VerifyAllSubstitutionMaps = false;
|
||||
|
||||
/// Sets the target we are building for and updates platform conditions
|
||||
/// to match.
|
||||
///
|
||||
@@ -512,6 +515,7 @@ namespace swift {
|
||||
/// Enable constraint solver support for experimental
|
||||
/// operator protocol designator feature.
|
||||
bool SolverEnableOperatorDesignatedTypes = false;
|
||||
|
||||
};
|
||||
} // end namespace swift
|
||||
|
||||
|
||||
@@ -549,6 +549,9 @@ def sil_merge_partial_modules : Flag<["-"], "sil-merge-partial-modules">,
|
||||
def sil_verify_all : Flag<["-"], "sil-verify-all">,
|
||||
HelpText<"Verify SIL after each transform">;
|
||||
|
||||
def verify_all_substitution_maps : Flag<["-"], "verify-all-substitution-maps">,
|
||||
HelpText<"Verify all SubstitutionMaps on construction">;
|
||||
|
||||
def sil_debug_serialization : Flag<["-"], "sil-debug-serialization">,
|
||||
HelpText<"Do not eliminate functions in Mandatory Inlining/SILCombine dead "
|
||||
"functions. (for debugging only)">;
|
||||
|
||||
@@ -56,7 +56,12 @@ SubstitutionMap::SubstitutionMap(
|
||||
GenericSignature genericSig,
|
||||
ArrayRef<Type> replacementTypes,
|
||||
ArrayRef<ProtocolConformanceRef> conformances)
|
||||
: storage(Storage::get(genericSig, replacementTypes, conformances)) { }
|
||||
: storage(Storage::get(genericSig, replacementTypes, conformances)) {
|
||||
#ifndef NDEBUG
|
||||
if (genericSig->getASTContext().LangOpts.VerifyAllSubstitutionMaps)
|
||||
verify();
|
||||
#endif
|
||||
}
|
||||
|
||||
ArrayRef<Type> SubstitutionMap::getReplacementTypesBuffer() const {
|
||||
return storage ? storage->getReplacementTypes() : ArrayRef<Type>();
|
||||
|
||||
@@ -565,6 +565,8 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
|
||||
Target.isOSDarwin());
|
||||
Opts.EnableSILOpaqueValues |= Args.hasArg(OPT_enable_sil_opaque_values);
|
||||
|
||||
Opts.VerifyAllSubstitutionMaps |= Args.hasArg(OPT_verify_all_substitution_maps);
|
||||
|
||||
Opts.UseDarwinPreStableABIBit =
|
||||
(Target.isMacOSX() && Target.isMacOSXVersionLT(10, 14, 4)) ||
|
||||
(Target.isiOS() && Target.isOSVersionLT(12, 2)) ||
|
||||
|
||||
Reference in New Issue
Block a user