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.
|
/// `@differentiable` declaration attribute, etc.
|
||||||
bool EnableExperimentalDifferentiableProgramming = false;
|
bool EnableExperimentalDifferentiableProgramming = false;
|
||||||
|
|
||||||
|
/// Enable verification when every SubstitutionMap is constructed.
|
||||||
|
bool VerifyAllSubstitutionMaps = false;
|
||||||
|
|
||||||
/// Sets the target we are building for and updates platform conditions
|
/// Sets the target we are building for and updates platform conditions
|
||||||
/// to match.
|
/// to match.
|
||||||
///
|
///
|
||||||
@@ -512,6 +515,7 @@ namespace swift {
|
|||||||
/// Enable constraint solver support for experimental
|
/// Enable constraint solver support for experimental
|
||||||
/// operator protocol designator feature.
|
/// operator protocol designator feature.
|
||||||
bool SolverEnableOperatorDesignatedTypes = false;
|
bool SolverEnableOperatorDesignatedTypes = false;
|
||||||
|
|
||||||
};
|
};
|
||||||
} // end namespace swift
|
} // end namespace swift
|
||||||
|
|
||||||
|
|||||||
@@ -548,6 +548,9 @@ def sil_merge_partial_modules : Flag<["-"], "sil-merge-partial-modules">,
|
|||||||
|
|
||||||
def sil_verify_all : Flag<["-"], "sil-verify-all">,
|
def sil_verify_all : Flag<["-"], "sil-verify-all">,
|
||||||
HelpText<"Verify SIL after each transform">;
|
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">,
|
def sil_debug_serialization : Flag<["-"], "sil-debug-serialization">,
|
||||||
HelpText<"Do not eliminate functions in Mandatory Inlining/SILCombine dead "
|
HelpText<"Do not eliminate functions in Mandatory Inlining/SILCombine dead "
|
||||||
|
|||||||
@@ -56,7 +56,12 @@ SubstitutionMap::SubstitutionMap(
|
|||||||
GenericSignature genericSig,
|
GenericSignature genericSig,
|
||||||
ArrayRef<Type> replacementTypes,
|
ArrayRef<Type> replacementTypes,
|
||||||
ArrayRef<ProtocolConformanceRef> conformances)
|
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 {
|
ArrayRef<Type> SubstitutionMap::getReplacementTypesBuffer() const {
|
||||||
return storage ? storage->getReplacementTypes() : ArrayRef<Type>();
|
return storage ? storage->getReplacementTypes() : ArrayRef<Type>();
|
||||||
@@ -476,7 +481,7 @@ SubstitutionMap SubstitutionMap::subst(TypeSubstitutionFn subs,
|
|||||||
newConformances.push_back(
|
newConformances.push_back(
|
||||||
conformance.subst(substType, subs, conformances, options));
|
conformance.subst(substType, subs, conformances, options));
|
||||||
}
|
}
|
||||||
|
|
||||||
oldConformances = oldConformances.slice(1);
|
oldConformances = oldConformances.slice(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -565,6 +565,8 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
|
|||||||
Target.isOSDarwin());
|
Target.isOSDarwin());
|
||||||
Opts.EnableSILOpaqueValues |= Args.hasArg(OPT_enable_sil_opaque_values);
|
Opts.EnableSILOpaqueValues |= Args.hasArg(OPT_enable_sil_opaque_values);
|
||||||
|
|
||||||
|
Opts.VerifyAllSubstitutionMaps |= Args.hasArg(OPT_verify_all_substitution_maps);
|
||||||
|
|
||||||
Opts.UseDarwinPreStableABIBit =
|
Opts.UseDarwinPreStableABIBit =
|
||||||
(Target.isMacOSX() && Target.isMacOSXVersionLT(10, 14, 4)) ||
|
(Target.isMacOSX() && Target.isMacOSXVersionLT(10, 14, 4)) ||
|
||||||
(Target.isiOS() && Target.isOSVersionLT(12, 2)) ||
|
(Target.isiOS() && Target.isOSVersionLT(12, 2)) ||
|
||||||
@@ -795,7 +797,7 @@ static bool ParseSearchPathArgs(SearchPathOptions &Opts,
|
|||||||
// Assumes exactly one of setMainExecutablePath() or setRuntimeIncludePath()
|
// Assumes exactly one of setMainExecutablePath() or setRuntimeIncludePath()
|
||||||
// is called before setTargetTriple() and parseArgs().
|
// is called before setTargetTriple() and parseArgs().
|
||||||
// TODO: improve the handling of RuntimeIncludePath.
|
// TODO: improve the handling of RuntimeIncludePath.
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user