Use unique_ptr for Scope, getScope returns a reference

This commit is contained in:
David Ungar
2019-06-12 07:29:00 -07:00
parent 6cfcabd8e5
commit 69f6b41a13
7 changed files with 22 additions and 23 deletions

View File

@@ -664,17 +664,17 @@ static void verifyGenericSignaturesIfNeeded(CompilerInvocation &Invocation,
static void dumpAndPrintScopeMap(CompilerInvocation &Invocation,
CompilerInstance &Instance, SourceFile *SF) {
const ASTScope *scope = SF->getScope();
const ASTScope &scope = SF->getScope();
if (Invocation.getFrontendOptions().DumpScopeMapLocations.empty()) {
llvm::errs() << "***Complete scope map***\n";
scope->print(llvm::errs());
scope.print(llvm::errs());
return;
}
// Probe each of the locations, and dump what we find.
for (auto lineColumn :
Invocation.getFrontendOptions().DumpScopeMapLocations)
scope->dumpOneScopeMapLocation(lineColumn);
scope.dumpOneScopeMapLocation(lineColumn);
}
static SourceFile *getPrimaryOrMainSourceFile(CompilerInvocation &Invocation,