Eager tree building for primaries

This commit is contained in:
David Ungar
2019-09-13 17:22:50 -07:00
parent 2ede6f2b82
commit 968c5a8282
8 changed files with 64 additions and 10 deletions

View File

@@ -1745,6 +1745,8 @@ StringRef SourceFile::getFilename() const {
}
ASTScope &SourceFile::getScope() {
assert(getASTContext().LangOpts.EnableASTScopeLookup &&
isSuitableForASTScopes() && "Should not be creating scope tree");
if (!Scope)
Scope = std::unique_ptr<ASTScope>(new (getASTContext()) ASTScope(this));
return *Scope.get();