Add AST pointer to TypeRefinementContext.

Updating r22145, this patch adds pointers from a TypeRefinementContext to the
AST node that introduced the context, along with the reason for refinement. This
reason supports the scenario where an AST node may introduce multiple refinement
contexts (e.g., eventually we want an IfStmt to introduce two refinement
contexts, one for the Then branch and one for the Else branch.

The patch also fixes a memory leak for the storage holding a refinement
context's children.


Swift SVN r22232
This commit is contained in:
Devin Coughlin
2014-09-23 21:24:02 +00:00
parent f5c80b115b
commit 42b2139353
4 changed files with 117 additions and 24 deletions

View File

@@ -1424,7 +1424,7 @@ SourceFile::SourceFile(Module &M, SourceFileKind K,
// the source file are guaranteed to be executing on at least the minimum
// platform version.
auto VersionRange = VersionRange::allGTE(M.Ctx.LangOpts.MinPlatformVersion);
TRC = new (M.Ctx) TypeRefinementContext(VersionRange);
TRC = TypeRefinementContext::createRoot(M.Ctx, this, VersionRange);
}
SourceFile::~SourceFile() {}