本文整理汇总了C++中TypeChecker::checkDeclCircularity方法的典型用法代码示例。如果您正苦于以下问题:C++ TypeChecker::checkDeclCircularity方法的具体用法?C++ TypeChecker::checkDeclCircularity怎么用?C++ TypeChecker::checkDeclCircularity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TypeChecker
的用法示例。
在下文中一共展示了TypeChecker::checkDeclCircularity方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: typeCheckFunctionsAndExternalDecls
//.........这里部分代码省略.........
// Complete any protocol requirement signatures that were delayed
// because the protocol was validated via validateDeclForNameLookup().
while (!TC.DelayedRequirementSignatures.empty()) {
auto decl = TC.DelayedRequirementSignatures.pop_back_val();
if (decl->isInvalid() || TC.Context.hadError())
continue;
TC.validateDecl(decl);
}
// Validate any referenced declarations for SIL's purposes.
// Note: if we ever start putting extension members in vtables, we'll need
// to validate those members too.
// FIXME: If we're not planning to run SILGen, this is wasted effort.
while (TC.NextDeclToFinalize < TC.DeclsToFinalize.size()) {
auto decl = TC.DeclsToFinalize[TC.NextDeclToFinalize++];
if (decl->isInvalid())
continue;
// If we've already encountered an error, don't finalize declarations
// from other source files.
if (TC.Context.hadError() &&
decl->getDeclContext()->getParentSourceFile() != &SF)
continue;
TC.finalizeDecl(decl);
}
// Type check synthesized functions and their bodies.
for (unsigned n = SF.SynthesizedDecls.size();
currentSynthesizedDecl != n;
++currentSynthesizedDecl) {
auto decl = SF.SynthesizedDecls[currentSynthesizedDecl];
TC.typeCheckDecl(decl);
}
// Ensure that the requirements of the given conformance are
// fully checked.
for (unsigned i = 0; i != TC.PartiallyCheckedConformances.size(); ++i) {
auto conformance = TC.PartiallyCheckedConformances[i];
TC.checkConformanceRequirements(conformance);
}
TC.PartiallyCheckedConformances.clear();
// Complete any conformances that we used.
for (unsigned i = 0; i != TC.UsedConformances.size(); ++i) {
auto conformance = TC.UsedConformances[i];
if (conformance->isIncomplete())
TC.checkConformance(conformance);
}
TC.UsedConformances.clear();
} while (currentFunctionIdx < TC.definedFunctions.size() ||
currentExternalDef < TC.Context.ExternalDefinitions.size() ||
currentSynthesizedDecl < SF.SynthesizedDecls.size() ||
!TC.FunctionsToSynthesize.empty() ||
TC.NextDeclToFinalize < TC.DeclsToFinalize.size() ||
!TC.ConformanceContexts.empty() ||
!TC.DelayedRequirementSignatures.empty() ||
!TC.UsedConformances.empty() ||
!TC.PartiallyCheckedConformances.empty());
// FIXME: Horrible hack. Store this somewhere more appropriate.
TC.Context.LastCheckedExternalDefinition = currentExternalDef;
SF.LastCheckedSynthesizedDecl = currentSynthesizedDecl;
// Now that all types have been finalized, run any delayed
// circularity checks.
// This has been written carefully to fail safe + finitely if
// for some reason a type gets re-delayed in a non-assertions
// build in an otherwise successful build.
// Types can be redelayed in a failing build because we won't
// type-check required declarations from different files.
for (size_t i = 0, e = TC.DelayedCircularityChecks.size(); i != e; ++i) {
TC.checkDeclCircularity(TC.DelayedCircularityChecks[i]);
assert((e == TC.DelayedCircularityChecks.size() ||
TC.Context.hadError()) &&
"circularity checking for type was re-delayed!");
}
TC.DelayedCircularityChecks.clear();
// Compute captures for functions and closures we visited.
for (AnyFunctionRef closure : TC.ClosuresWithUncomputedCaptures) {
TC.computeCaptures(closure);
}
TC.ClosuresWithUncomputedCaptures.clear();
for (AbstractFunctionDecl *FD : reversed(TC.definedFunctions)) {
TC.computeCaptures(FD);
}
// Check error-handling correctness for all the functions defined in
// this file. This can depend on all of their interior function
// bodies having been type-checked.
for (AbstractFunctionDecl *FD : TC.definedFunctions) {
TC.checkFunctionErrorHandling(FD);
}
TC.definedFunctions.clear();
}